Trying to add check failure

pull/8/head
sgoudham 4 years ago
parent 9cc261b018
commit 43204a9606

@ -7,7 +7,8 @@ import mariadb
from decouple import config from decouple import config
from discord import Embed from discord import Embed
from discord.ext import commands, tasks from discord.ext import commands, tasks
from discord.ext.commands import when_mentioned_or, is_owner, guild_only, has_permissions, bot_has_permissions from discord.ext.commands import when_mentioned_or, is_owner, guild_only, has_permissions, bot_has_permissions, \
CheckFailure
import db import db
import settings import settings
@ -199,7 +200,7 @@ async def _help(ctx, *, command: str = None):
await p.paginate() await p.paginate()
except Exception as ex: except Exception as ex:
await ctx.send(ex) await ctx.send("**{}**".format(ex))
@client.command(name="prefix", aliases=["Prefix"]) @client.command(name="prefix", aliases=["Prefix"])
@ -375,8 +376,6 @@ 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):
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):
await on_command_missing_user(ctx) await on_command_missing_user(ctx)
@ -392,10 +391,8 @@ 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 isinstance(args2, CheckFailure):
# if the bot does not permissions to send the command await on_command_forbidden(ctx)
if isinstance(args2, discord.errors.Forbidden):
await on_command_forbidden(ctx)
# Async def for handling command bad argument error # Async def for handling command bad argument error

Loading…
Cancel
Save