#customId
23 messages · Page 1 of 1 (latest)
discord js 14.8 node 18.15
Are you getting any errors? Does it log an id to the console?
I just updated my code this time I have no more messages in the console even my
console.log(Button ID: ${buttonId});
if (interaction.isButton()) {
const buttonId = interaction.customId;
console.log(`Button ID: ${buttonId}`);
if (buttonId === 'primary') {
await interaction.reply('Send !');
}
}
const row = new ActionRowBuilder()
.addComponents(
new ButtonBuilder()
.setCustomId('primary')
.setLabel('Click me!')
.setStyle(ButtonStyle.Success),
);```
So you’re sending the button at the bottom? And the top portion is your handler?
Or how do you send the button to begin with
My code ```
if (interaction.customId === 'primary') {
await interaction.reply('Send !');
}
const row = new ActionRowBuilder()
.addComponents(
new ButtonBuilder()
.setCustomId('primary')
.setLabel('Click me!')
.setStyle(ButtonStyle.Success),
);
const embedTicket = new EmbedBuilder()
.setTitle(Title)
.setColor("#8A2BE2")
.setDescription(Content)
.setFooter({
text: interaction.member.user.tag,
iconURL: interaction.member.user.displayAvatarURL({dynamic: true})
});
await interaction.channel.send({components: [row], embeds: [embedTicket]});```
when I click on the button nothing happens
Log the interaction before you check the customId
My interaction :
So it’s a chat input command sending the button?
yes
And when you click the button what does the interaction look like
I don't have anything
It doesn’t log the interaction?