Closed ahihiyou20 closed 6 months ago
discord.errors.Forbidden, discord.Forbidden, discord.DiscordException CAN'T be used to catch a forbidden error
try: cmds = await self.get_channel(channel: int).application_commands() except discord.DiscordException: # Even Exception or discord.DiscordException won't trigger the code below print("OOPS")
print "OOPS" if the bot can't get the slash commands due to lack of permissions
it doesn't print "OOPS" and the exception is raised
Traceback:
File "c:\Users\ahihiyou20\scoop\apps\python\current\Lib\site-packages\discord\commands.py", line 140, in __call__ return await _wrapped_interaction( ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "c:\Users\ducna\scoop\apps\python\current\Lib\site-packages\discord\interactions.py", line 203, in _wrapped_interaction await state.http.interact(type, data, channel, nonce=nonce, **kwargs) File "c:\Users\ducna\scoop\apps\python\current\Lib\site-packages\discord\http.py", line 926, in request raise Forbidden(response, data) discord.errors.Forbidden: 403 Forbidden (error code: 50013): Missing Permissions
No response
The provided error is not coming from the given code. It's being raised by code that tries to use an app command.
Summary
discord.errors.Forbidden, discord.Forbidden, discord.DiscordException CAN'T be used to catch a forbidden error
Reproduction Steps
Code
Expected Results
print "OOPS" if the bot can't get the slash commands due to lack of permissions
Actual Results
it doesn't print "OOPS" and the exception is raised
Traceback:
System Information
Checklist
Additional Information
No response