W
W
Wolf_Yout2021-12-12 14:23:38
Python
Wolf_Yout, 2021-12-12 14:23:38

DISLASH.py how to output an error about lack of rights?

I did the restriction of rights with:
@dislash.has_permissions(manage_messages=True)
According to the documentation it was written to use the on_slash_command_error event
I already tried like this:

@slash.event
async def on_slash_command_error(inter, error):
    if isinstance(error, dislash.application_commands.errors.MissingPermissions):
        await inter.reply(
            embed=discord.Embed(title=f'Ошибка',
                                description=f'Извини, но у тебя нет прав!',
                                colour=discord.Color.red()))
    elif isinstance(error, dislash.application_commands.errors.BotMissingPermissions):
        await inter.reply(
            embed=discord.Embed(title=f'Ошибка',
                                description=f'Извини, но у меня нет прав!',
                                colour=discord.Color.red()))
    if isinstance(error, dislash.errors.MissingPermissions):
        await inter.reply(
            embed=discord.Embed(title=f'Ошибка',
                                description=f'Извини, но у тебя нет прав!',
                                colour=discord.Color.red()))
    elif isinstance(error, dislash.errors.BotMissingPermissions):
        await inter.reply(
            embed=discord.Embed(title=f'Ошибка',
                                description=f'Извини, но у меня нет прав!',
                                colour=discord.Color.red()))
    if isinstance(error, dislash.MissingPermissions):
        await inter.reply(
            embed=discord.Embed(title=f'Ошибка',
                                description=f'Извини, но у тебя нет прав!',
                                colour=discord.Color.red()))
    elif isinstance(error, dislash.BotMissingPermissions):
        await inter.reply(
            embed=discord.Embed(title=f'Ошибка',
                                description=f'Извини, но у меня нет прав!',
                                colour=discord.Color.red()))

But I keep getting output to the console.
Help!

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question