I just can't figure out how to send a button interaction with a message in Discord.js v13 in v12 you just use discord-buttons but here it's built-in somehow and I can't quite get it.
const { MessageActionRow, MessageButton } = require('discord.js');
client.on('interactionCreate', async interaction => {
if (!interaction.isCommand()) return;
if (interaction.commandName === 'ping') {
const row = new MessageActionRow()
.addComponents(
new MessageButton()
.setCustomId('primary')
.setLabel('Primary')
.setStyle('PRIMARY'),
);
await interaction.reply({ content: 'Pong!', components: [row] });
}
});
For external redirect button, you should use .setLabel('LINK') instead of .setLabel('Primary') then remove .setCustomId('primary'). Add .setURL('URL')