Interaction has already been awknoledged

Everything works just fine , but i get this error when i use it for the second time , but everything works
5 Replies
d.js toolkit
d.js toolkit14mo 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.
Ashura
Ashura14mo ago
Code:
if(editmodal.components){
editmodal.setComponents()
}
const embedBreed = interaction.message.embeds[0]
const possibleStrings = ["Health", "Stamina", "Melee", "Food", "Oxygen"];
for (let i = 0; i < embedBreed.fields.length; i++) {
const field = embedBreed.fields[i];
const regex = /\*\*<:[^>]+>\s|\*\*/g;
const fieldName = field.name.replace(regex, "");
if (possibleStrings.includes(fieldName)) {
const row = new ActionRowBuilder()
const textinput = new TextInputBuilder()
.setLabel(fieldName)
.setPlaceholder(`Digite o novo ${fieldName} de seu dino.`)
.setRequired(true)
.setMaxLength(3)
.setCustomId(`${fieldName}modal`)
.setStyle(TextInputStyle.Short);
row.addComponents(textinput)
editmodal.addComponents(row)
}
}
interaction.showModal(editmodal)
}
if(editmodal.components){
editmodal.setComponents()
}
const embedBreed = interaction.message.embeds[0]
const possibleStrings = ["Health", "Stamina", "Melee", "Food", "Oxygen"];
for (let i = 0; i < embedBreed.fields.length; i++) {
const field = embedBreed.fields[i];
const regex = /\*\*<:[^>]+>\s|\*\*/g;
const fieldName = field.name.replace(regex, "");
if (possibleStrings.includes(fieldName)) {
const row = new ActionRowBuilder()
const textinput = new TextInputBuilder()
.setLabel(fieldName)
.setPlaceholder(`Digite o novo ${fieldName} de seu dino.`)
.setRequired(true)
.setMaxLength(3)
.setCustomId(`${fieldName}modal`)
.setStyle(TextInputStyle.Short);
row.addComponents(textinput)
editmodal.addComponents(row)
}
}
interaction.showModal(editmodal)
}
sexy dark chocolate
.showModal() counts as a reply, you can't reply or defer the interaction and then do showModal()
d.js docs
d.js docs14mo ago
Documentation suggestion for @ashurabln:method InteractionResponses#followUp() Send a follow-up message to this interaction.
Ashura
Ashura14mo ago
thank you