Help width interactions

Hello I have this code in slash conmmand, when I try to interact outside the if works perfectly but if y try into the if give me an error:
Error [InteractionAlreadyReplied]: The reply to this interaction has already been sent or deferred.
at StringSelectMenuInteraction.reply (C:\Users\Rober\Desktop\BotLocal\node_modules\discord.js\src\structures\interfaces\InteractionResponses.js:102:46)
at Client.<anonymous> (C:\Users\Rober\Desktop\BotLocal\src\commands\ticket\order2.js:47:29)
at processTicksAndRejections (node:internal/process/task_queues:96:5) {
code: 'InteractionAlreadyReplied'
}
Error [InteractionAlreadyReplied]: The reply to this interaction has already been sent or deferred.
at StringSelectMenuInteraction.reply (C:\Users\Rober\Desktop\BotLocal\node_modules\discord.js\src\structures\interfaces\InteractionResponses.js:102:46)
at Client.<anonymous> (C:\Users\Rober\Desktop\BotLocal\src\commands\ticket\order2.js:47:29)
at processTicksAndRejections (node:internal/process/task_queues:96:5) {
code: 'InteractionAlreadyReplied'
}
Code:
const StartOrder = new ButtonBuilder()
.setCustomId('confirm')
.setLabel('Confirm Ban')
.setStyle(ButtonStyle.Success);

const row = new ActionRowBuilder()
.addComponents(StartOrder);



await interaction.reply({
components: [row],
});


client.on('interactionCreate',async interac => {


interaction.editReply({ content: 'Response', components: [] })
await Start.StartOrderCode(interac);



if (interac.customId === 'Service') {

interac.reply("Res");
}

});
const StartOrder = new ButtonBuilder()
.setCustomId('confirm')
.setLabel('Confirm Ban')
.setStyle(ButtonStyle.Success);

const row = new ActionRowBuilder()
.addComponents(StartOrder);



await interaction.reply({
components: [row],
});


client.on('interactionCreate',async interac => {


interaction.editReply({ content: 'Response', components: [] })
await Start.StartOrderCode(interac);



if (interac.customId === 'Service') {

interac.reply("Res");
}

});
6 Replies
d.js toolkit
d.js toolkit2y ago
• 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.
d.js docs
d.js docs2y ago
guide Popular Topics: Interaction collectors The third type of collector allows you to collect interactions; such as when users activate a slash command or click on a button in a message. read more
chewie
chewie2y ago
Please use that instead of adding another event listener.
d.js docs
d.js docs2y ago
- DiscordAPIError: Interaction has already been acknowledged - [InteractionAlreadyReplied]: The reply to this interaction has already been sent or deferred. You have already replied to the interaction. - Use <Interaction>.followUp() to send a new message - If you deferred reply it's better to use <Interaction>.editReply() - Responding to slash commands / buttons / select menus
chewie
chewie2y ago
also this
MrRober
MrRoberOP2y ago
ok now i have this
DataOrder = {
service: "Not Selected",
platform: "Not Selected",
payment: "Not Selected"
}
const StartOrder = new ButtonBuilder()
.setCustomId('confirm')
.setLabel('Confirm Ban')
.setStyle(ButtonStyle.Success);

const row = new ActionRowBuilder()
.addComponents(StartOrder);



await interaction.reply({
components: [row],
});


client.on(Events.InteractionCreate, async interac => {

await Start.StartOrderCode(interac);

if (interac.customId === 'Service') {

await Embeds.EditEmbed(interac, DataOrder);
await menuSelect.createMenuSelect(interac,"Platform");

}

});
DataOrder = {
service: "Not Selected",
platform: "Not Selected",
payment: "Not Selected"
}
const StartOrder = new ButtonBuilder()
.setCustomId('confirm')
.setLabel('Confirm Ban')
.setStyle(ButtonStyle.Success);

const row = new ActionRowBuilder()
.addComponents(StartOrder);



await interaction.reply({
components: [row],
});


client.on(Events.InteractionCreate, async interac => {

await Start.StartOrderCode(interac);

if (interac.customId === 'Service') {

await Embeds.EditEmbed(interac, DataOrder);
await menuSelect.createMenuSelect(interac,"Platform");

}

});
but when the editReply "await Embeds.EditEmbed(interac, DataOrder); " and "await menuSelect.createMenuSelect(interac,"Platform");" they duplicate te embed and the menu select like a follow up
Want results from more Discord servers?
Add your server