正在尝试注册命令:DiscordAPIError[50001]:缺少访问

2022-02-22 00:00:00 discord javascript

紧随其后;https://discordjs.guide/creating-your-bot/creating-commands.html#command-deployment-script

我正在尝试运行node deploy-commands.js将我的命令注册到单个行会,但收到以下错误。

    C:Users\\hello-world-discord-bot>node deploy-commands.js
DiscordAPIError[50001]: Missing Access
    at SequentialHandler.runRequest (C:\\hello-world-discord-bot
ode_modules@discordjsestdistlibhandlersSequentialHandler.js:198:23)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async SequentialHandler.queueRequest (C:\\hello-world-discord-bot
ode_modules@discordjsestdistlibhandlersSequentialHandler.js:99:20)
    at async C:\\hello-world-discord-botdeploy-commands.js:17:3 {
  rawError: { message: 'Missing Access', code: 50001 },
  code: 50001,
  status: 403,
  method: 'put',
  url: 'https://discord.com/api/v9/applications/877359061669118003/guilds/447125601757691915/commands'
}

我已经尝试删除机器人,并在重新添加之前通过开发人员Web控制台重新授予其权限。我检查并重新添加了tokenclientIdguildId,每次都得到相同的错误消息。我可以看到它没有获得访问权限,但我不知道还会从哪里授予访问权限。

我的deploy-commands.js如下所示:

{
    "clientId": "123456789012345678",
    "guildId": "876543210987654321",
    "token": "my-token-goes-here"
}

解决方案

您是否确保在不一致开发人员门户中您的机器人的OAuth2设置的作用域部分中选中了"Applications.Commands"作用域?

相关文章