Testing if forbidden permissions works

pull/8/head
sgoudham 4 years ago
parent 6357338e92
commit 1eca1958c1

@ -375,7 +375,7 @@ async def on_member_remove(member):
# Bot Event for handling all errors within discord.commands # Bot Event for handling all errors within discord.commands
@client.event @client.event
async def on_command_error(ctx, args2): async def on_command_error(ctx, args2):
discord.errors.Forbidden = getattr(discord.errors.Forbidden, "original", discord.errors.Forbidden) Forbidden = hasattr(exec, args2)
# if the user did not specify an user # if the user did not specify an user
if isinstance(args2, commands.MissingRequiredArgument): if isinstance(args2, commands.MissingRequiredArgument):
@ -392,8 +392,9 @@ async def on_command_error(ctx, args2):
# if the user provides an argument that isn't recognised # if the user provides an argument that isn't recognised
elif isinstance(args2, commands.BadArgument): elif isinstance(args2, commands.BadArgument):
await on_command_bad_argument(ctx) await on_command_bad_argument(ctx)
if Forbidden:
# if the bot does not permissions to send the command # if the bot does not permissions to send the command
elif isinstance(args2, discord.errors.Forbidden): if isinstance(args2, discord.errors.Forbidden):
await on_command_forbidden(ctx) await on_command_forbidden(ctx)

Loading…
Cancel
Save