#The application did not respond

12 messages · Page 1 of 1 (latest)

fathom linden
#

• What's your exact discord.js npm list discord.js and node node -v version?
• Post the full error stack trace, not just the top part!
• Show your code!
• Explain what exactly your issue is.
• Not a discord.js issue? Check out #useful-servers.

hollow anvilBOT
#

To help you we need more information:
• What are you trying to do?
• What is your code?
• What errors and debug logs do you have?

gray sigil
#
const BotConfig = require("./botConfig.json");
const fs = require("node:fs");
const path = require('node:path');
const { REST } = require("@discordjs/rest");

const client = new Client({ intents: [GatewayIntentBits.Guilds] });
client.commands = new Collection();
const slashCommands = []

client.once("ready", () => {
    console.log(`${client.user.username} is online.`);

    let guildID = BotConfig.guildID;
    let clientID = BotConfig.clientID;
    let token = BotConfig.token;

    const rest = new REST({version: 10}).setToken(token);

    rest.put(Routes.applicationGuildCommands(clientID, guildID), { body: slashCommands})
    .then(() => console.log(`Succesvol geregristreerd applicatie command.`))
    .catch(console.error);

});

const commandsPath = path.join(__dirname, 'slashCommands');
const commandFiles = fs.readdirSync(commandsPath).filter(file => file.endsWith('.js'));

for (const file of commandFiles) {
    const filePath = path.join(commandsPath, file);
    const command = require(filePath);

        client.commands.set(command.data.name, command);
        slashCommands.push(command.data.toJSON());

        console.log(`De file ${command.data.name}.js is geladen.`)
    }

client.on('InteractionCreate', async interaction => {
    if (!interaction.isChatInputCommand()) return;

    const command = interaction.client.commands.get(interaction.commandName);

    if (!command) {
        console.error(`No command matching ${interaction.commandName} was found.`);
        return;
    }

    try {
        await command.execute(client,interaction);
    } catch (error) {
        console.error(error);
        await interaction.reply({ content: 'There was an error while executing this command!', ephemeral: true });
    }
});

client.login(BotConfig.token);```
wispy sky
#

The event name is interactionCreate

gray sigil
#

and now i get another error

#

When i start the bot i get

#

Error =

ReferenceError: reden is not defined
    at Object.execute (C:\Users\Mula\Desktop\spow\slashCommands\vcban.js:51:111) 
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Client.<anonymous> (C:\Users\Mula\Desktop\spow\index.js:50:3)       
node:events:491
      throw er; // Unhandled 'error' event
      ^

DiscordAPIError[40060]: Interaction has already been acknowledged.
    at SequentialHandler.runRequest (C:\Users\Mula\Desktop\spow\node_modules\@discordjs\rest\dist\index.js:667:15)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async SequentialHandler.queueRequest (C:\Users\Mula\Desktop\spow\node_modules\@discordjs\rest\dist\index.js:464:14)
    at async REST.request (C:\Users\Mula\Desktop\spow\node_modules\@discordjs\rest\dist\index.js:910:22)
    at async ChatInputCommandInteraction.reply (C:\Users\Mula\Desktop\spow\node_modules\discord.js\src\structures\interfaces\InteractionResponses.js:111:5)
    at async Client.<anonymous> (C:\Users\Mula\Desktop\spow\index.js:53:3)
Emitted 'error' event on Client instance at:
    at emitUnhandledRejectionOrErr (node:events:394:10)
    at process.processTicksAndRejections (node:internal/process/task_queues:84:21) {
  requestBody: {
    files: [],
    json: {
      type: 4,
      data: {
        content: 'There was an error while executing this command!',
        tts: false,
        nonce: undefined,
        embeds: undefined,
        components: undefined,
        username: undefined,
        avatar_url: undefined,
        allowed_mentions: undefined,
        flags: 64,
        message_reference: undefined,
        attachments: undefined,
        sticker_ids: undefined,
        thread_name: undefined
      }
    }
  },
  rawError: {
    message: 'Interaction has already been acknowledged.',
    code: 40060
  },
  code: 40060,
  status: 400,
  method: 'POST',
  url: 'https://discord.com/api/v10/interactions/1074798442502684702/aW50ZXJhY3Rpb246MTA3NDc5ODQ0MjUwMjY4NDcwMjpqRWRPdm9xdVhYQTJtYmFUVWNVQXhiRUFlMDNNeklpaDZQdGtJOGd6VDE4aXBFYWh4YVZVQmtvbmZJWFdTdHU3bHpEZlZxQWtLa3kxTlo3a09XV214NVFiUHl6bmx1OW1mMmxQbVEzU2hibkNkZ09JREVON0tuUDB1V3pEQkExMQ/callback'
}```
solid turtle
#

then don't reply twice

gray sigil
#

Where

solid turtle
#

index.js:53

gray sigil
#

and how to change then

#

to what