'Infraction Has Been Already Acknowledged - DiscordAPIError Problem

so I have been working on this help command for some time now. In the beginning, there was no such error, but now even after all the methods I came up with, weren't able to fix this error. I tried to remove the selectMenu after 60s to prevent old interactions to launch as well but it still doesn't seem to work properly. I have added my code to this as well, please do help me.

const { MessageSelectMenu, Collector } = require("discord.js");

module.exports = {
    name: 'help',
    description: "This is a help command!",
    async execute(message, args, Discord, client){
        let commandUser = message.author.id
        let helpEmbed = new Discord.MessageEmbed()
            .setColor('#EF4344')
            .setAuthor('Builder BOT • Help-Command','https://media.discordapp.net/attachments/960440764737921074/960790159597641758/builder_bot_06.png')
            .setDescription(`• My prefix is \`b!\`.\n • We recommend to give the BOT Administrator permission.\n • We recommend NOT to change the BOT-role's and channel's permission.\n • Type \`b!help <module>\` for further information regarding a specific module.\n • Type \`b!help <command>\` for further information regarding a specific command.`)
            .addFields({
                name: 'BOT-Modules:',
                value: `• <:Hammer:960753810253414401>_Build-Module_\n • <:Gear:960764548195958834>_Config-Module_\n • <:Pencil:960962910463598615>_Action Log-Module_\n • <:Staff:960964396425814117>_Moderation-Module_\n • <:Misc:960964890460319855>_Misc-Module_\n • <:Rocket:960965476673019954>_Fun-Module_`,
                inline: true
            },{
                name: 'BOT-Updates:',
                value: '**Help command under-development**\n Use the command for more information.\n Eg- \`b!help\`',
                inline: true
            })
            .setTimestamp()
            .setFooter(`Author ID: ${message.author.id}`,`${message.author.displayAvatarURL()}`);

        let helpSelectMenu = new Discord.MessageActionRow().addComponents([
            new MessageSelectMenu()
            .setCustomId('Help-SelectMenu')
            .setPlaceholder('For more information, choose a module!')
            .addOptions([
                {
                    label: 'Build-Module',
                    value: 'Build_Option',
                    description: 'Build servers more easily than ever before!',
                    emoji: `<:Hammer:960753810253414401>`
                },
                {
                    label: 'Config-Module',
                    value: 'Config_Option',
                    description: 'Configure Builder BOT\'s settings!',
                    emoji: `<:Gear:960764548195958834>`
                },
                {
                    label: 'Action Log-Module',
                    value: 'Action Log_Option',
                    description: 'Keep track of everything that happens in the server!',
                    emoji: `<:Pencil:960962910463598615>`
                },
                {
                    label: 'Moderation-Module',
                    value: 'Moderation_Option',
                    description: 'Automate moderation and protect your server!',
                    emoji: `<:Staff:960964396425814117>`
                },
                {
                    label: 'Misc-Module',
                    value: 'Misc_Option',
                    description: 'Uncategorized amazing features!',
                    emoji: `<:Misc:960964890460319855>`
                },
                {
                    label: 'Fun-Module',
                    value: 'Fun_Option',
                    description: 'Engage members with interactive commands!',
                    emoji: `<:Rocket:960965476673019954>`
                }
            ])
        ])

        message.channel.send({ embeds: [helpEmbed], components: [helpSelectMenu] }).catch(() => {
            if(message.channel.permissionsFor(client.user.id).has(['SEND_MESSAGES'])){
                message.channel.send(`<@${message.author.id}>, I don't have the required permissions!`).then(msg => {
                    setTimeout(() => {msg.delete()}, 5000)
                })
            }else{
                return;
            };
        }).then((msg) => {
            setTimeout(() => {msg.edit({ embeds: [helpEmbed], components: []})}, 60000)
        });

        let underDevelopment = new Discord.MessageEmbed()
        .setColor('#EF4344')
        .setDescription('The BOT is currently under development process!')
        .setTimestamp()

        let helpDropdownfilter = (interaction) => (interaction.isSelectMenu() && interaction.user.id === message.author.id);
        let helpDropdownCollector = message.channel.createMessageComponentCollector({
            helpDropdownfilter,
            max: 2,
            time: 60000
        });

        helpDropdownCollector.on('collect', async (interaction) => {
            console.log(interaction.values[0]);
            if(commandUser === interaction.user.id){
                if(interaction.values[0] === 'Build_Option'){
                    underDevelopment.setAuthor('Builder BOT • Build-Module','https://media.discordapp.net/attachments/960440764737921074/960790159597641758/builder_bot_06.png')
                    underDevelopment.setFooter(`Interaction ID: ${interaction.user.id}`,`${interaction.user.displayAvatarURL()}`);
                    await interaction.update({ embeds: [underDevelopment], components: [] });
                }
                if(interaction.values[0] === 'Config_Option'){
                    underDevelopment.setAuthor('Builder BOT • Config-Module','https://media.discordapp.net/attachments/960440764737921074/960790159597641758/builder_bot_06.png')
                    underDevelopment.setFooter(`Interaction ID: ${interaction.user.id}`,`${interaction.user.displayAvatarURL()}`);
                    await interaction.update({ embeds: [underDevelopment], components: []});
                }
                if(interaction.values[0] === 'Action Log_Option'){
                    underDevelopment.setAuthor('Builder BOT • Action Log-Module','https://media.discordapp.net/attachments/960440764737921074/960790159597641758/builder_bot_06.png')
                    underDevelopment.setFooter(`Interaction ID: ${interaction.user.id}`,`${interaction.user.displayAvatarURL()}`);
                    await interaction.update({ embeds: [underDevelopment], components: [] });
                }
                if(interaction.values[0] === 'Moderation_Option'){
                    underDevelopment.setAuthor('Builder BOT • Moderation-Work','https://media.discordapp.net/attachments/960440764737921074/960790159597641758/builder_bot_06.png')
                    underDevelopment.setFooter(`Interaction ID: ${interaction.user.id}`,`${interaction.user.displayAvatarURL()}`);
                    await interaction.update({ embeds: [underDevelopment], components: [] });
                }
                if(interaction.values[0] === 'Misc_Option'){
                    underDevelopment.setAuthor('Builder BOT • Misc-Module','https://media.discordapp.net/attachments/960440764737921074/960790159597641758/builder_bot_06.png')
                    underDevelopment.setFooter(`Interaction ID: ${interaction.user.id}`,`${interaction.user.displayAvatarURL()}`);
                    await interaction.update({ embeds: [underDevelopment], components: [] });
                }
                if(interaction.values[0] === 'Fun_Option'){
                    underDevelopment.setAuthor('Builder BOT • Fun-Module','https://media.discordapp.net/attachments/960440764737921074/960790159597641758/builder_bot_06.png')
                    underDevelopment.setFooter(`Interaction ID: ${interaction.user.id}`,`${interaction.user.displayAvatarURL()}`);
                    await interaction.update({ embeds: [underDevelopment], components: [] });
                }
            }else{
                await interaction.reply({ content: `<@${interaction.user.id}>, you do not have access to this interaction!`, ephemeral: true})
            }
        })
    }
}



Solution 1:[1]

I see that you are using a lot of if conditions. I'd suggest using if and else if instead of using if multiple times. Also, try the following code;

const initial = await message.channel.send({ /** ... */ });
const filter = // ...
const collector = // ...
collector.on("collect", async(interaction) => {
   if(interaction.values[0] === "something"){
      if(initial.editable){
         await initial.edit(/** ... */)
      } else return;
   } else if (interaction.values[0] === "anything"){
      // ...
   }
})

You're basically saving the first response of the bot, to later on edit the responses as they select options from the menu.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Darshan B