#customId

23 messages · Page 1 of 1 (latest)

abstract jewelBOT
#

• What's your exact discord.js npm list discord.js and node node -v version?
• Post the full error stack trace, not just the top part!
• Show your code!
• Explain what exactly your issue is.
• Not a discord.js issue? Check out #useful-servers.

vestal geode
#

discord js 14.8 node 18.15

sleek meadow
#

Are you getting any errors? Does it log an id to the console?

vestal geode
#

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),
                                );```
sleek meadow
#

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

vestal geode
#

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]});```
vestal geode
sleek meadow
vestal geode
sleek meadow
#

So it’s a chat input command sending the button?

vestal geode
#

yes

sleek meadow
#

And when you click the button what does the interaction look like

vestal geode
#

I don't have anything

sleek meadow
#

It doesn’t log the interaction?

vestal geode
#

my interaction command name ?

#

or button ?

sleek meadow
#

When you click the button you should be getting an interaction in the console unless you’re returning early in the interactionCreate event

#

Show that event where you check the button interaction

#

You probably return if it’s not a command

sleek meadow
#

What’s above that?

#

Are we still logging the interaction above this?