Skip to content
Advertisement

How do I check for required scopes in a discord bot user using Python?

I am making a discord API wrapper and I finally thought of embarking on commands. As most of you know, discord requires bots to have the application.commands scope for checking whether the bot user has permissions to receive application commands.

I wanted to check if the bot had the setting enabled using Python, but it never seems to work. I have tried many things and even have sifted through the documentation, but I am not able to find a solution. Can anyone help?

My Attempts:

  • Tried to listen for any codes saying that the scope is not enabled
  • Checked the docs for any status codes and handling scopes

Please help!

https://discord.com/developers/docs/interactions/application-commands#authorizing-your-application

Advertisement

Answer

This is only a workaround, but you could try to make a get request to the commands endpoint

GET /applications/{application.id}/guilds/{guild.id}/commands

If you get a 403 - Forbidden then the bot doesn’t have the application.commands scope

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement