pycord: App Commands error handler not registering
Summary
The on_application_command_error handler is not working or even registering
Reproduction Steps
Write code in a cog and make sure other code/commands work in that cog,
use a slash command you don’t have permission to, like with the @commands.has_permissions decorator
watch as it doesn’t register the handler and shows
in discord
In terminal it will say,
raise MissingPermissions(missing)
discord.ext.commands.errors.MissingPermissions: You are missing Administrator permission(s) to run this command.
Minimal Reproducible Code
@commands.Cog.listener()
async def on_application_command_error(self, ctx, error):
if isinstance(error, commands.MissingPermissions):
await ctx.respond(“Missing Perms”)
return
Expected Results
For it to say missing perms to the user when they try and use a command with the decorator @commands.has_permissions decorator and dont have the specified permission
Actual Results
It doesn’t register, shows
and says raise MissingPermissions(missing)
discord.ext.commands.errors.MissingPermissions: You are missing Administrator permission(s) to run this command. in the terminal
Intents
all
System Information
- Python v3.10.2-final
- py-cord v2.0.0-beta
- py-cord pkg_resources: v2.0.0b4
- aiohttp v3.7.4.post0
- system info: Windows 10 10.0.22000
Checklist
- I have searched the open issues for duplicates.
- I have shown the entire traceback, if possible.
- I have removed my token from display, if visible.
Additional Context
Other users have experienced this as well
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 18 (14 by maintainers)
You cannot useon_application_command_errorto listen for errors in other cogs. It will only trigger if the error happens in the same cog.Please see the comments below for a correction to this comment. This is not accurate.