[Bug]: DiscordAPIError: Bots cannot use this endpoint
See original GitHub issueWhat happened?
My guild was moved to v2 of the permissions system and now it’s failing to start.
Reproduction
From the demo repo.
// init permissions; enabled log to see changes
await client.initApplicationPermissions(true);
Package
discordx
Version
Stable
Relevant log output
Charlotte >> command: kick >> permissions >> updating >> guild: #The lobby
C:\Users\xo\code\OmgImAlexis\charlotte\node_modules\discord.js\src\rest\RequestHandler.js:350
throw new DiscordAPIError(data, res.status, request);
^
DiscordAPIError: Bots cannot use this endpoint
at RequestHandler.execute (C:\Users\xo\code\OmgImAlexis\charlotte\node_modules\discord.js\src\rest\RequestHandler.js:350:13)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async RequestHandler.push (C:\Users\xo\code\OmgImAlexis\charlotte\node_modules\discord.js\src\rest\RequestHandler.js:51:14)
at async ApplicationCommandPermissionsManager.set (C:\Users\xo\code\OmgImAlexis\charlotte\node_modules\discord.js\src\managers\ApplicationCommandPermissionsManager.js:168:20)
at async file:///C:/Users/xo/code/OmgImAlexis/charlotte/node_modules/discordx/src/Client.ts:833:15
at async Promise.all (index 12)
at async Client.initGuildApplicationPermissions (file:///C:/Users/xo/code/OmgImAlexis/charlotte/node_modules/discordx/src/Client.ts:816:5)
at async Promise.all (index 0)
at async Client.initApplicationPermissions (file:///C:/Users/xo/code/OmgImAlexis/charlotte/node_modules/discordx/src/Client.ts:776:5)
at async Client.<anonymous> (file:///C:/Users/xo/code/OmgImAlexis/charlotte/src/client.ts:37:5) {
method: 'put',
path: '/applications/962572053003796551/guilds/927461441051701280/commands/968148318783942756/permissions',
code: 20001,
httpStatus: 403,
requestData: { json: { permissions: [] }, files: [] }
}
Code of Conduct
- I agree to follow this project’s Code of Conduct
Issue Analytics
- State:
- Created a year ago
- Comments:6 (6 by maintainers)
Top Results From Across the Web
403 Error when setting application command permissions on ...
My bot got a 403 error, even though it never happened before, and the code hasn't changed at all. The paths /applications/{applicationId}/ ...
Read more >Why can't bots use this endpoint? - Discord Support
js doesn't use it) authenticated as the bot, I got the following error: `{"message": "Bots cannot use this endpoint", "code": 20001}`. The error...
Read more >InteractionService.ModifySlashCommandPermissionsAsync ...
InteractionService.ModifySlashCommandPermissionsAsync() fails with API error 20001: Bots cannot use this endpoint. It seems like Discord.Net ...
Read more >Errors - discord.js Guide
This error throws when the bot attempts to send a DM message to a user but cannot do so. A variety of reasons...
Read more >How Roles cause Missing Permission Errors in Discord.js
After struggling to understand why my Discord.js bot was throwing a DiscordAPIError: Missing Permissions even with full admin permissions, I found out that ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
with v9.6.0, this feature is temporary disabled in discordx. We will update accordingly discord.js.
Update:
the docs have been merged, and the API still exists, however, the reason why you where getting this error is because there is a NEW authentication needed to call the Permission set api: https://discord.com/developers/docs/interactions/application-commands#permissions
As we can see, the API is still the same https://discord.com/developers/docs/interactions/application-commands#edit-application-command-permissions but now requires a
Bearer token
with the applications.commands.permissions.updateHOWEVER, there IS a new field called
default_member_permissions
https://discord.com/developers/docs/interactions/application-commands#application-command-permissions-object-using-default-permissionsThis is likely replacing the permission decorator we have with the boolean as it says:
https://discord.com/developers/docs/change-log#updated-command-permissions