Home > Enterprise >  Why my discord.js v14 bot saying "The application did not respond" but the command work?
Why my discord.js v14 bot saying "The application did not respond" but the command work?

Time:01-12

Ty for reading me !

I have a bot discord.js, and i try to change it for it work in discord.js V14.

I had no problem but just with one thing, the channel.send().

Here my command :

const { EmbedBuilder, ApplicationCommandType } = require('discord.js');

module.exports = {
    name: 'regles',
    description: "Affiche les règles du serveur Mobile Rush.",
    type: ApplicationCommandType.ChatInput,
    cooldown: 3000,
    run: async (client, interaction) => {
        const embed = new EmbedBuilder() // création de l'embed
            .setColor(`#FCFF22`) // ou .setColor(`#0099ff`)
            .setTitle(`:scroll: Règlement du serveur :scroll:`)

            .setDescription(`Voici le règlement du serveur, veuillez le prendre en compte et l'intégrer à votre expérience sur le discord.\n \n`
             `:page_with_curl: 1 - Traiter tout le monde avec respect : Aucun harcèlement, troll/taunt virulent, sexisme, racisme ou discours de haine ne sera toléré.\n \n`
             `:page_with_curl: 2 - Pas de contenu violent, obscène ou NSFW qu'il s'agisse d'un texte, image ou lien mettant en scène de la nudité, du sexe, de violence ou un quelconque contenu dérangeant.\n \n`
             `:page_with_curl: 3 - Pas de spam dans les channels.\n \n`
             `:page_with_curl: 4 - Les publicités en tout genre ne sont pas autorisées sur le serveur.\n \n`
             `:page_with_curl: 5 - Veuillez utiliser les bons salons textuels pour ne pas voir vos messages supprimés par les modérateurs.\n \n`
             `*En cas de non respect des règles, <@817169336074371072> appliquera des sanctions plus ou moins lourdes.*`);

        const channel = await client.channels.cache.get('818097356725157900');//channel test-bot
        channel.send({ embeds: [embed] });
        
    }
};

Error message

The command work good, my embed go to the right channel, but i got this error each time when i use channel.send, but not when i use interaction.reply.

I try with a new bot code that i get on discord.js doc, i try with a code the a guy do, but always the same thing .. I search on internet, i didn't find something with that.

I hope someone can help me !

How can i get my discord.js v14 bot to stop saying "The application did not respond" if the slash command works? Someone here have the same error, but he resolve it with and interaction.reply, but i can't do that for go to another channel

CodePudding user response:

Discord Interactions don't consider themselves responded to unless you use the inbuilt reply function, simply replace channel.send with interaction.reply({ embeds: [embed] })

(You can reply a dummy message, like "Complete!" etc, then send the embed to the channel you want to.)

CodePudding user response:

const channel = await client.channels.cache.get('818097356725157900');
interaction.reply('This message is send');
await interaction.deleteReply();
channel.send({ embeds: [embed] });

I just going to do that, I can also do interaction.reply ephemeral, ty Dan for your response !

  • Related