0
votes

code:

@client.event
async def on_command_error(self, ctx, exc):
    if  isinstance(exc, CommandOnCooldown):
        await ctx.send(f"Подождите, команда будет доступна через {exc.retry_after} секунд")

cmd: Bot connected Ignoring exception in on_command_error Traceback (most recent call last): File "C:\Users\gnati\AppData\Local\Programs\Python\Python38-32\lib\site-packages\discord\client.py", line 343, in _run_event await coro(*args, **kwargs) TypeError: on_command_error() missing 1 required positional argument: 'exc' Ignoring exception in on_command_error Traceback (most recent call last): File "C:\Users\gnati\AppData\Local\Programs\Python\Python38-32\lib\site-packages\discord\client.py", line 343, in _run_event

1

1 Answers

0
votes

It's not about the positional argument, but the type placed in the isinstance (that is "CommandOnCooldown") should be like this Instead:

@client.event
async def on_command_error(self,ctx,error):
    if isinstance(error, commands.CommandOnCooldown):
        await ctx.send(f"Подождите, команда будет доступна через {exc.retry_after} секунд")

Give an Upvote if it works :)