DiscordAPIError: Bots cannot use this endpoint
See original GitHub issueDescribe the bug I’ve updated my Discord NestJS to version (3.3.4) but unfortunately I’m still running into issues with registering Discord slash commands with permissions.
[Nest] 16152 - 16/06/2022, 21:34:10 LOG [NestApplication] Nest application successfully started +747ms
[Nest] 16152 - 16/06/2022, 21:34:31 LOG [RegisterCommandService] All guild commands removed!
[Nest] 16152 - 16/06/2022, 21:34:31 LOG [RegisterCommandService] All guild commands are registered!
...\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 (...\node_modules\discord.js\src\rest\RequestHandler.js:350:13)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at RequestHandler.push (...\node_modules\discord.js\src\rest\RequestHandler.js:51:14)
at ApplicationCommandPermissionsManager.set (...\node_modules\discord.js\src\managers\ApplicationCommandPermissionsManager.js:168:20)
To Reproduce My configuration is as follows (I have removed all commands that were not required to produce the error, it looks like any command triggers it):
{
token: appConfiguration.token,
discordClientOptions: {
intents: Object.keys(Intents.FLAGS).map(
(i) => Intents.FLAGS[i] // temporary, while developing
)
},
removeGlobalCommands: true,
registerCommandOptions: [
{
forGuild: appConfiguration.guildId,
removeCommandsBefore: true
}
],
slashCommandsPermissions: [
{
commandClassType: URLCommand,
permissions: [
{
id: permissionConfiguration.staffRole, // string id
type: ApplicationCommandPermissionTypes.ROLE,
permission: true // default false, in the @Command()
}
]
}
]
};
"dependencies": {
"@discord-nestjs/common": "^3.3.4",
"@discord-nestjs/core": "^3.3.4",
"@nestjs/common": "^8.0.0",
"@nestjs/config": "^1.2.0",
"@nestjs/core": "^8.0.0",
"@nestjs/event-emitter": "^1.1.0",
"@nestjs/mapped-types": "*",
"@nestjs/platform-express": "^8.0.0",
"@nestjs/schedule": "^1.1.0",
"@nestjs/typeorm": "^8.0.3",
"@shockbyte/nest-common": "^0.0.5",
"discord.js": "^13.*",
"husky": "^7.0.4",
"mysql2": "^2.3.3",
"nestjs-dynamic-providers": "^0.1.2",
"reflect-metadata": "^0.1.13",
"rimraf": "^3.0.2",
"rxjs": "^7.2.0",
"typeorm": "^0.2.45"
}
Expected behavior Prior to the DiscordAPI command changes, this configuration worked as expected and commands were protected by the needed permissions.
Issue Analytics
- State:
- Created a year ago
- Comments:16 (6 by maintainers)
Top Results From Across the Web
403 Error when setting application command permissions on ...
Discord has released Permissions V2 to all guilds yesterday (April 27, 2022). Bots can no longer control the permissions, ...
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 >Search Endpoint For Bots #1754 - discord/discord-api-docs
I was hoping to use the search endpoint to all... ... { DiscordAPIError: Bots cannot use this endpoint at item.request.gen.end ...
Read more >Errors - discord.js Guide
API Errors or DiscordAPIErrors are thrown by the Discord API when an invalid request carries out. API Errors can be mostly diagnosed using...
Read more >throw new discordapierror.discordapierror(data, "code" in data ...
I can't send a private message to a user in discord with node.js ... It appears that the Bot and the users were...
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 FreeTop 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
Top GitHub Comments
Alright, so this will be fairly easy to accomplish once this is complete – we may just need to rework how the permissions are handled a little, but the tools should be there: https://github.com/discordjs/discord.js/pull/8162
We would basically need to change
await command.permissions.set({ permissions });
to use thecommand.setDefaultXXX
methods when this PR is accessible for us to use in DiscordJS v13.@fjodor-rybakov Since this error is still occuring and easily replicatable with
slashComandPermissions
in use on the sample projects, is it possible we could re-open this issue so that we can track our resolution process?