So, I am trying to send an embed and two buttons in a webhook from my website backend which is built using express.js to Discord using discord.js. So, here is my source code:-
const buttons = new MessageActionRow()
buttons.addComponents(
new MessageButton()
.setLabel('View Purchase')
.setStyle('LINK')
.setURL(`...`), // url is present
)
buttons.addComponents(
new MessageButton()
.setLabel('View Payment')
.setStyle('LINK')
.setURL(`...`), // url is present
)
const embed = new MessageEmbed()
// creating the embed
await webhook.send({ embeds: [embed], components: [buttons] })
I have removed unnecessary code. So if I run this, the embed gets sent, but not the buttons and there is no error except some warning which are unrelated.
(node:13492) DeprecationWarning: Passing strings for MessageEmbed#setFooter is deprecated. Pass a sole object instead.
[0] (Use `node --trace-deprecation ...` to show where the warning was created)
change .setFooter to this style :
.setFooter({text: "your text", iconURL: "your link"