I tried to make blacklist system in discord.py
class blackk(commands.CheckFailure): pass def __global_check_once(ctx): cursor.execute(f"SELECT ban_id FROM bany WHERE ban_id = {ctx.author.id}") r = cursor.fetchone() if r is not None: raise blackk() else: return @bot.event async def on_command_error(ctx, error): if isinstance(error, blackk): await ctx.send("blacklisted")
I really need it. Someone know better way to do it (example please)
I believe __global_check_once
has been replaced by bot_check_once
. It should return True
or False
. You can find a list of Cog special methods here