0
votes

I have tried making a command menu embed with buttons to go through pages. The only problem with this is you can't edit the bot message (I believe), since you can only use listeners for the button like this:

bot.on('clickButton', (button) => {
   if (button.id === 'someid') {
      button...
   }
})

... So how exactly could you edit an embed?

1
So you want to only edit an Embed Message? Or should the message change when you click the button? Have u tried to do Msg.edit ?ceqoX

1 Answers

1
votes

You can edit the bot's message which has buttons attached to it. The button is an instance of MessageComponent. Which has a .message property you can use to access the original message the button was attached to.

const message = button.message;
const embed = new Discord.MessageEmbed();
// ... Set embed properties ...
message.edit(embed);

If you want to edit a reply to an interaction that was sent by the bot, use InteractionReply.edit() method.

button.reply.edit(embed);