Bubby
Bubby
DIAdiscord.js - Imagine an app
Created by Bubby on 10/15/2023 in #djs-questions
MessageComponentCollector gives wrong button customId
ty!
31 replies
DIAdiscord.js - Imagine an app
Created by Bubby on 10/15/2023 in #djs-questions
MessageComponentCollector gives wrong button customId
geez
31 replies
DIAdiscord.js - Imagine an app
Created by Bubby on 10/15/2023 in #djs-questions
MessageComponentCollector gives wrong button customId
ohhhhh
31 replies
DIAdiscord.js - Imagine an app
Created by Bubby on 10/15/2023 in #djs-questions
MessageComponentCollector gives wrong button customId
What's that for?
31 replies
DIAdiscord.js - Imagine an app
Created by Bubby on 10/15/2023 in #djs-questions
MessageComponentCollector gives wrong button customId
That is correct
31 replies
DIAdiscord.js - Imagine an app
Created by Bubby on 10/15/2023 in #djs-questions
MessageComponentCollector gives wrong button customId
hopefully that answers your question
31 replies
DIAdiscord.js - Imagine an app
Created by Bubby on 10/15/2023 in #djs-questions
MessageComponentCollector gives wrong button customId
The code that was inside that is the exact same. I just switched the handlers themselves
31 replies
DIAdiscord.js - Imagine an app
Created by Bubby on 10/15/2023 in #djs-questions
MessageComponentCollector gives wrong button customId
could you be a bit more specific?
31 replies
DIAdiscord.js - Imagine an app
Created by Bubby on 10/15/2023 in #djs-questions
MessageComponentCollector gives wrong button customId
outputs the same thing
31 replies
DIAdiscord.js - Imagine an app
Created by Bubby on 10/15/2023 in #djs-questions
MessageComponentCollector gives wrong button customId
as you can see, the customIds are correct
31 replies
DIAdiscord.js - Imagine an app
Created by Bubby on 10/15/2023 in #djs-questions
MessageComponentCollector gives wrong button customId
I'm guessing you wanted me to check what the buttons' customIds come out to be when logged, so I changed it to tttMsg.components[2] to show the third row, which is where the issue persists. Here's the full output of that log:
MessageActionRow {
type: 'ACTION_ROW',
components: [
MessageButton {
type: 'BUTTON',
label: '-',
customId: 'ttt_button_7',
style: 'SECONDARY',
emoji: null,
url: null,
disabled: false
},
MessageButton {
type: 'BUTTON',
label: '-',
customId: 'ttt_button_8',
style: 'SECONDARY',
emoji: null,
url: null,
disabled: false
},
MessageButton {
type: 'BUTTON',
label: '-',
customId: 'ttt_button_9',
style: 'SECONDARY',
emoji: null,
url: null,
disabled: false
}
]
}
MessageActionRow {
type: 'ACTION_ROW',
components: [
MessageButton {
type: 'BUTTON',
label: '-',
customId: 'ttt_button_7',
style: 'SECONDARY',
emoji: null,
url: null,
disabled: false
},
MessageButton {
type: 'BUTTON',
label: '-',
customId: 'ttt_button_8',
style: 'SECONDARY',
emoji: null,
url: null,
disabled: false
},
MessageButton {
type: 'BUTTON',
label: '-',
customId: 'ttt_button_9',
style: 'SECONDARY',
emoji: null,
url: null,
disabled: false
}
]
}
31 replies
DIAdiscord.js - Imagine an app
Created by Bubby on 10/15/2023 in #djs-questions
MessageComponentCollector gives wrong button customId
k
31 replies
DIAdiscord.js - Imagine an app
Created by Bubby on 10/15/2023 in #djs-questions
MessageComponentCollector gives wrong button customId
or outside of it
31 replies
DIAdiscord.js - Imagine an app
Created by Bubby on 10/15/2023 in #djs-questions
MessageComponentCollector gives wrong button customId
you mean underneath console.log(interaction.customId)?
31 replies
DIAdiscord.js - Imagine an app
Created by Bubby on 10/15/2023 in #djs-questions
MessageComponentCollector gives wrong button customId
yes, it does
31 replies
DIAdiscord.js - Imagine an app
Created by Bubby on 10/15/2023 in #djs-questions
MessageComponentCollector gives wrong button customId
lemme see
31 replies
DIAdiscord.js - Imagine an app
Created by Bubby on 10/15/2023 in #djs-questions
MessageComponentCollector gives wrong button customId
For new people, make sure to scroll up ^^
31 replies
DIAdiscord.js - Imagine an app
Created by Bubby on 10/15/2023 in #djs-questions
MessageComponentCollector gives wrong button customId
I have my buttons defined with their custom IDs, and then I have the beginning of the collector. When pressing any of the buttons on row 3, it thinks button 5 with the customId ttt_button_5 was pressed, even though that's obviously not the correct button. In the console.log line where I log the customId of the button pressed, it does indeed output ttt_button_5.
const tttButtonsRow1 = new MessageActionRow()
.addComponents([
new MessageButton()
.setCustomId('ttt_button_1')
.setLabel('-')
.setStyle('SECONDARY'),
new MessageButton()
.setCustomId('ttt_button_2')
.setLabel('-')
.setStyle('SECONDARY'),
new MessageButton()
.setCustomId('ttt_button_3')
.setLabel('-')
.setStyle('SECONDARY')
]);
const tttButtonsRow2 = new MessageActionRow()
.addComponents([
new MessageButton()
.setCustomId('ttt_button_4')
.setLabel('-')
.setStyle('SECONDARY'),
new MessageButton()
.setCustomId('ttt_button_5')
.setLabel('-')
.setStyle('SECONDARY'),
new MessageButton()
.setCustomId('ttt_button_6')
.setLabel('-')
.setStyle('SECONDARY')
]);
const tttButtonsRow3 = new MessageActionRow()
.addComponents([
new MessageButton()
.setCustomId('ttt_button_7')
.setLabel('-')
.setStyle('SECONDARY'),
new MessageButton()
.setCustomId('ttt_button_8')
.setLabel('-')
.setStyle('SECONDARY'),
new MessageButton()
.setCustomId('ttt_button_9')
.setLabel('-')
.setStyle('SECONDARY')
]);
let button1 = null;
let button2 = null;
let button3 = null;
let button4 = null;
let button5 = null;
let button6 = null;
let button7 = null;
let button8 = null;
let button9 = null;
let buttonArray = [button1, button2, button3, button4, button5, button6, button7, button8, button9];
await message.channel.send({ content: `<@${opponent.id}>, <@${message.author.id}> has challenged you to a game of old-fashioned Tic-Tac-Toe!`, embeds: [tttEmbed], components: [tttButtonsRow1, tttButtonsRow2, tttButtonsRow3] }).then(async tttMsg => {

const filter = interaction => (interaction.customId == 'ttt_button_1') || (interaction.customId == 'ttt_button_2') || (interaction.customId == 'ttt_button_3') || (interaction.customId == 'ttt_button_4') || (interaction.customId = 'ttt_button_5') || (interaction.customId == 'ttt_button_6') || (interaction.customId == 'ttt_button_7') || (interaction.customId == 'ttt_button_8') || (interaction.customId == 'ttt_button_9');
const collector = tttMsg.createMessageComponentCollector({
filter: filter
});

collector.on('collect', async (interaction) => {
console.log(interaction.customId); ...
const tttButtonsRow1 = new MessageActionRow()
.addComponents([
new MessageButton()
.setCustomId('ttt_button_1')
.setLabel('-')
.setStyle('SECONDARY'),
new MessageButton()
.setCustomId('ttt_button_2')
.setLabel('-')
.setStyle('SECONDARY'),
new MessageButton()
.setCustomId('ttt_button_3')
.setLabel('-')
.setStyle('SECONDARY')
]);
const tttButtonsRow2 = new MessageActionRow()
.addComponents([
new MessageButton()
.setCustomId('ttt_button_4')
.setLabel('-')
.setStyle('SECONDARY'),
new MessageButton()
.setCustomId('ttt_button_5')
.setLabel('-')
.setStyle('SECONDARY'),
new MessageButton()
.setCustomId('ttt_button_6')
.setLabel('-')
.setStyle('SECONDARY')
]);
const tttButtonsRow3 = new MessageActionRow()
.addComponents([
new MessageButton()
.setCustomId('ttt_button_7')
.setLabel('-')
.setStyle('SECONDARY'),
new MessageButton()
.setCustomId('ttt_button_8')
.setLabel('-')
.setStyle('SECONDARY'),
new MessageButton()
.setCustomId('ttt_button_9')
.setLabel('-')
.setStyle('SECONDARY')
]);
let button1 = null;
let button2 = null;
let button3 = null;
let button4 = null;
let button5 = null;
let button6 = null;
let button7 = null;
let button8 = null;
let button9 = null;
let buttonArray = [button1, button2, button3, button4, button5, button6, button7, button8, button9];
await message.channel.send({ content: `<@${opponent.id}>, <@${message.author.id}> has challenged you to a game of old-fashioned Tic-Tac-Toe!`, embeds: [tttEmbed], components: [tttButtonsRow1, tttButtonsRow2, tttButtonsRow3] }).then(async tttMsg => {

const filter = interaction => (interaction.customId == 'ttt_button_1') || (interaction.customId == 'ttt_button_2') || (interaction.customId == 'ttt_button_3') || (interaction.customId == 'ttt_button_4') || (interaction.customId = 'ttt_button_5') || (interaction.customId == 'ttt_button_6') || (interaction.customId == 'ttt_button_7') || (interaction.customId == 'ttt_button_8') || (interaction.customId == 'ttt_button_9');
const collector = tttMsg.createMessageComponentCollector({
filter: filter
});

collector.on('collect', async (interaction) => {
console.log(interaction.customId); ...
31 replies
DIAdiscord.js - Imagine an app
Created by Bubby on 10/15/2023 in #djs-questions
MessageComponentCollector gives wrong button customId
Should also note this:
31 replies
DIAdiscord.js - Imagine an app
Created by Bubby on 10/15/2023 in #djs-questions
MessageComponentCollector gives wrong button customId
Already have it in the tag, but version is 13.16.0
31 replies