Button Interaction
Hey, heres my code: buttonCollector.on('collect', async buttonInteraction => {
console.log(buttonInteraction.customId);
if (buttonInteraction.customId === 'accept') {
const paymentMethods = allowedUsers[freelancerId];;
const paypalButton = new ButtonBuilder()
.setCustomId('paypal')
.setLabel('PayPal')
.setStyle(ButtonStyle.Primary);
const cashAppButton = new ButtonBuilder()
.setCustomId('cashapp')
.setLabel('CashApp')
.setStyle(ButtonStyle.Primary);
const paymentActionRow = new ActionRowBuilder()
.addComponents(paypalButton, cashAppButton);
const acceptEmbed = new EmbedBuilder()
.setTitle('Payment Options')
.setDescription('Please select a payment method:')
.setColor('Blue');
await buttonInteraction.update({ embeds: [acceptEmbed], components: [paymentActionRow] });
} else if (buttonInteraction.customId === 'decline') {
buttonInteraction.reply({ content: 'Payment request declined.', ephemeral: true });
} else if (buttonInteraction.customId === 'decline') {
buttonInteraction.reply({ content: 'Payment request declined.', ephemeral: true });
}
});. It doesnt seem to be getting here, did I do smth wrong?
18 Replies
- What's your exact discord.js
npm list discord.js
and node node -v
version?
- Not a discord.js issue? Check out #other-js-ts.
- Consider reading #how-to-get-help to improve your question!
- Explain what exactly your issue is.
- Post the full error stack trace, not just the top part!
- Show your code!
- Issue solved? Press the button!
- ✅
Marked as resolved by OPUnknown User•8mo ago
Message Not Public
Sign In & Join Server To View
the event isnt triggering
like its not logging that
If you aren't getting any errors, try to place
console.log
checkpoints throughout your code to find out where execution stops.
- Once you do, log relevant values and if-conditions
- More sophisticated debugging methods are breakpoints and runtime inspections: learn morei just did that
it doesnt work xd
like
Unknown User•8mo ago
Message Not Public
Sign In & Join Server To View
i put in console logs
Unknown User•8mo ago
Message Not Public
Sign In & Join Server To View
there nowhere else to put in logs that would be relevant to this xd
Unknown User•8mo ago
Message Not Public
Sign In & Join Server To View
where do you suggest i place it
Unknown User•8mo ago
Message Not Public
Sign In & Join Server To View
🤨
alright
Unknown User•8mo ago
Message Not Public
Sign In & Join Server To View
maybe im doing something wrong
but its definetly still logging
Unknown User•8mo ago
Message Not Public
Sign In & Join Server To View
oh
yeah that worked tysm