Advertisement
Fsoky

Handler of errors for discord.py | nobody

Apr 11th, 2021 (edited)
608
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.57 KB | None | 0 0
  1. @bot.event
  2. async def on_command_error(ctx, error):
  3.     print(error)
  4.  
  5.     if isinstance(error, commands.UserInputError):
  6.         await ctx.send(f"Correct use of the command: `{ctx.prefix}{ctx.command.name}` ({ctx.command.brief}): {ctx.prefix}{ctx.command.usage}")
  7.     elif isinstance(error, commands.CommandNotFound):
  8.         await ctx.send("Command was not found... Try again.")
  9.     elif isinstance(error, commands.MissingPermissions):
  10.         await ctx.send("You are not enough a rights")
  11.     elif isinstance(error, commands.MissingRequiredArgument):
  12.         await ctx.send("You didn't specify the argument")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement