Reputation: 69
I am trying to update my discord bot to the new version of discord.js (v13). I have a message with an embed and two buttons, one for previous Page and one for next page. When a user clicks a button, I am trying to edit the embed to show something else. But then I get a
TypeError: interaction.message.edit() is not a function.
I can print out the interaction.message
and it shows the message Object, but the function can not be called. I am using the interactionCreate
event.
Thanks in advance!
Upvotes: 5
Views: 15714
Reputation: 111
You can use the interaction.update()
method:
// send a message
message.channel.send({ embeds: [embed], components: [buttons] })
/*
listen for the "interactionCreate" event or use any other method
of detecting an interaction like interaction collectors or awaitMessageComponent
*/
client.on("interactionCreate", (interaction) => {
interaction.update({ embeds: [aDifferentEmbed] })
})
Upvotes: 7