#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)
DID I MAKE it clear?
What check?
Like @commands.has_role() or @commands.has_permission()
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.
Can you give another hint?
@bot.listen()
async def on_slash_command_error(inter, exception):
on the exception type
? depends on the exception
just read the docs, lol
I said for when an @commands.has_permissions() fails
-d commands.has_permissions
@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.