I need a little help with how to use this method, a pseudocode example would likely be enough. This is what I have, it's in the cog I have all of my listeners in:
@commands.Cog.listener()
async def before_slash_command_invoke(
self,
inter
):
blacklist = self.cur.execute('SELECT * FROM blacklist WHERE (userID=? AND guildID=?)', (inter.author.id, inter.guild_id)).fetchall()
commands = [inter.data.name]
if hasattr(inter.data, 'options'):
if inter.data.options != []:
commands.append(inter.data.name + ' ' + inter.data.options[0].name)
if hasattr(inter.data.options[0], 'options'):
if inter.data.options[0].options != []:
commands.append(inter.data.name + ' ' + inter.data.options[0].name + ' ' + inter.data.options[0].options[0].name)
for item in blacklist:
for i in commands:
if i == item[2]:
await inter.send(embed=disnake.Embed(color=cmn.colors.red, description='You have been blacklisted from this command.'), ephemeral=True)
return
return await super().cog_before_invoke(inter)
I know this is probably not using it correctly, I thought it would be this simple, but it seems to not be, because this doesn't trigger when I run a command.