Hi,
I am currently making a discord bot, but when trying to handle errors, I am getting this:
Ignoring exception in on_command_error
Traceback (most recent call last):
File “/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/client.py”, line 343, in _run_event
await coro(*args, **kwargs)
TypeError: on_command_error() missing 2 required positional arguments: ‘error’ and ‘exc’
This is the code that is causing issues:
@bot.event
async def on_command_error(bot, ctx, error, exc):
if isinstance(exc, CommandNotFound):
pass
elif isinstance(exc, CommandOnCooldown):
await ctx.send(f"Command is on cooldown. Command resets in {exc.retry_after:,.2f} seconds.")
elif hasattr(exc, ["original"]):
raise exc.original
else:
raise exc
Any help would be greatly appreciated!