I'm experiencing an interaction error interaction has already been acknowledged when attempting to update and reply. This is because I already replied to the interaction through update/reply once.
What I want to do is when a user clicks the button on an embed message, the embed message gets updated/edited and then a hidden/ephemeral message is also sent.
Here's the interaction code:
client.on("interactionCreate", async (interaction) => {
if (interaction.customId === "button") {
const embed = new EmbedBuilder()
.setTitle("This is a new title")
interaction.update({embeds: [embed]});
await interaction.reply({content: "Succcess!", ephemeral: true});
}
})
Use the ButtonInteraction#followUp()
method instead. Note that the ButtonInteraction#update()
must be awaited so it has time to internally set ButtonInteraction#replied
to true. If not, you will get the InteractionNotReplied
error.
await interaction.update({ embeds: [embed] });
await interaction.followUp({ content: "Succcess!", ephemeral: true });