Search code examples
javascriptrestdiscorddiscord.js

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: ....

Here is code:

(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');
      })();

What can I try next? It still works on replit but when I run in vscode it shows this error.


Solution

  • You are being rate limited by Discord as you can only add so many application commands. You can either wait until the rate limit has ended, or move over to guild commands for testing purposes. The new code would look like this:

    (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.applicationGuildCommands(clientID, guildID), { body: slashArray });
    
            console.log('\nSuccessfully reloaded application (/) commands.\n');
          })();
    

    This code will only add slash commands to the guild specified by the guildID variable, this will also only work if the bot has permission to add application commands on that guild.