From fc9dbdfcf9a7a0e89c967dd2b913e9b0fbe4e598 Mon Sep 17 00:00:00 2001 From: sgoudham Date: Tue, 28 Jul 2020 23:59:09 +0100 Subject: [PATCH] Added error handling for owner only commands --- main.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/main.py b/main.py index 7bf324c5..e6bdf66d 100644 --- a/main.py +++ b/main.py @@ -346,6 +346,8 @@ async def on_command_error(ctx, args2): await on_command_permission(ctx) elif isinstance(args2, commands.BotMissingPermissions): await on_bot_forbidden(ctx, args2) + elif isinstance(args2, commands.NotOwner): + await on_not_owner(ctx) # Async def for handling command bad argument error @@ -400,6 +402,13 @@ async def on_command_missing_argument(ctx): await ctx.send(embed=embed) +# Async def for handling permission errors +async def on_not_owner(ctx): + # Send an error message to the user saying that they don't have permission to use this command + embed = Embed(description="**❌ Owner Only Command ❌**") + await ctx.send(embed=embed) + + # Run the bot, allowing it to come online try: client.run(API_TOKEN)