How to update the interaction message?

editReply returns me "Interaction has already been acknowledg"
await api.interactions.defer(interaction.id, interaction.token, {
flags: MessageFlags.Ephemeral,
});
await wait.setTimeout(4000);
await api.interactions.editReply(
interaction.id,
interaction.token,
{
content: 'Hello World',
},
);
await api.interactions.defer(interaction.id, interaction.token, {
flags: MessageFlags.Ephemeral,
});
await wait.setTimeout(4000);
await api.interactions.editReply(
interaction.id,
interaction.token,
{
content: 'Hello World',
},
);
7 Replies
d.js toolkit
d.js toolkit12mo 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.
Kayo
Kayo12mo ago
@qjuh
Kayo
Kayo12mo ago
Without defer it works but not with him... Can you tell me what would be the correct operation, because I didn't find deferReply anymore.
Kayo
Kayo12mo ago
𝒄𝒐𝒄𝒐𝒌𝒊𝒕𝒕𝒆𝒏
isnt't it deferReply instead of just defer?
d.js docs
d.js docs12mo 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
Kayo
Kayo12mo ago
I solved it by changing the interaction.id that is required in the reply, but in the editReply or followUp you have to pass the applicationID as requested by the documentation. I hadn't seen that dogeHaHa .
await api.interactions.defer(interaction.id, interaction.token, {
flags: MessageFlags.Ephemeral,
});
await wait.setTimeout(4000);
await api.interactions.editReply(
interaction.application_id,
interaction.token,
{
content: 'Hello World',
},
);
await api.interactions.defer(interaction.id, interaction.token, {
flags: MessageFlags.Ephemeral,
});
await wait.setTimeout(4000);
await api.interactions.editReply(
interaction.application_id,
interaction.token,
{
content: 'Hello World',
},
);