DiscordAPIError[30034]每日应用命令创建达上限问题求助
解决DiscordAPIError[30034]的办法
错误详情
DiscordAPIError[30034]: Max number of daily application command creates has been reached (200)
DiscordAPIError[30034]: Max number of daily application command creates has been reached (200) at SequentialHandler.runRequest (D:\Setups\Julian-V\NodeJS\VSCode-DjsV14\node_modules\@discordjs\rest\dist\lib\handlers\SequentialHandler.cjs:293:15) at processTicksAndRejections (node:internal/process/task_queues:96:5) at async SequentialHandler.queueRequest (D:\Setups\Julian-V\NodeJS\VSCode-DjsV14\node_modules\@discordjs\rest\dist\lib\handlers\SequentialHandler.cjs:99:14) at async REST.request (D:\Setups\Julian-V\NodeJS\VSCode-DjsV14\node_modules\@discordjs\rest\dist\lib\REST.cjs:52:22) at async D:\Setups\Julian-V\NodeJS\VSCode-DjsV14\functions\utilities\loadCommands.js:51:9 { rawError: { message: 'Max number of daily application command creates has been reached (200)', code: 30034 }, code: 30034, status: 400, method: 'PUT', url: 'https://discord.com/api/v10/applications/995949416273940623/commands', requestBody: { files: undefined, json: .... }
当前部署代码
(async () => { const { REST, Routes } = require('discord.js'); const rest = new REST({ version: '10' }).setToken(process.env.token); console.log('\nStarted refreshing application (/) commands.\n'); await rest.put(Routes.applicationCommands(clientID), { body: slashArray }); console.log('\nSuccessfully reloaded application (/) commands.\n'); })();
可行解决办法
- 改用服务器级命令部署:全局命令有每日200次的更新限制,开发阶段建议部署到特定测试服务器,无次数限制且即时生效。修改代码中的路由:
// 替换为你的测试服务器ID await rest.put(Routes.applicationGuildCommands(clientID, '你的测试服务器ID'), { body: slashArray }); - 减少脚本执行次数:检查VSCode中是否多次运行了部署脚本,或者是否Bot每次启动都自动执行部署逻辑。改成手动触发部署,或仅在命令文件修改时执行。
- 检查命令数组冗余:对比Replit和VSCode中的
slashArray,确认是否包含重复命令或过多命令,导致每次更新都消耗更多额度。清理冗余命令,只保留需要的。 - 等待额度重置:Discord的每日额度按UTC时间24小时重置,若不急着开发,可等待额度恢复后再尝试全局部署(仅临时解决)。
- 添加执行判断逻辑:在脚本中加入条件,比如仅在特定环境变量触发时才执行部署,避免误操作:
if (process.env.NODE_ENV === 'production' || process.env.DEPLOY_COMMANDS === 'true') { await rest.put(Routes.applicationCommands(clientID), { body: slashArray }); }
内容的提问来源于stack exchange,提问作者Julian-V
相关产品推荐
相关产品推荐

