#how to make a listener that when there is an error of when a check fails it will send

1 messages · Page 1 of 1 (latest)

jagged wolf
#

the check name and why it fails, please help

jagged wolf
#

DID I MAKE it clear?

astral egret
#

What check?

jagged wolf
#

Like @commands.has_role() or @commands.has_permission()

buoyant pike
#

use an error handler

#

-d on_slash_command_error

glad waveBOT
#

await on_slash_command_error(interaction, exception)```
This function is a [*coroutine*](https://docs.python.org/3/library/asyncio-task.html#coroutine).

The default slash command error handler provided by the bot.

By default this prints to [`sys.stderr`](https://docs.python.org/3/library/sys.html#sys.stderr "(in Python v3.11)") however it could be overridden to have a different implementation.

This only fires if you do not specify any listeners for slash command error.
jagged wolf
#

Can you give another hint?

astral egret
#
@bot.listen()
async def on_slash_command_error(inter, exception):
jagged wolf
#

on the exception type

buoyant pike
#

? depends on the exception

fast snow
#

just read the docs, lol

jagged wolf
buoyant pike
#

-d commands.has_permissions

glad waveBOT
#

@disnake.ext.commands.has_permissions(**perms)```
A [`check()`](https://docs.disnake.dev/page/ext/commands/api.html#disnake.ext.commands.check "disnake.ext.commands.check") that is added that checks if the member has all of the permissions necessary.

Note that this check operates on the current channel permissions, not the guild wide permissions.

The permissions passed in must be exactly like the properties shown under [`disnake.Permissions`](https://docs.disnake.dev/page/api.html#disnake.Permissions "disnake.Permissions").

This check raises a special exception, [`MissingPermissions`](https://docs.disnake.dev/page/ext/commands/api.html#disnake.ext.commands.MissingPermissions "disnake.ext.commands.MissingPermissions") that is inherited from [`CheckFailure`](https://docs.disnake.dev/page/ext/commands/api.html#disnake.ext.commands.CheckFailure "disnake.ext.commands.CheckFailure").

Changed in version 2.6: Considers if the author is timed out.