button interaction doesnt work (d.js 14.11.0)

Im making a bot and button interactions dont work, when you hit a button it responds with "the application did not respond". Heres my code: https://hastebin.skyra.pw/junucexuze.js There are some variables that i left out for simplicity's sake but theyre unimportant to the part that doesnt work xd. anyways so i'd appreciate if anyone could help me :)
13 Replies
d.js toolkit
d.js toolkit3y ago
• 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.
treble/luna
treble/luna3y ago
Its customId, not customID
john metal gear solid
@luna🌈 Now it just says "this interaction failed"
treble/luna
treble/luna3y ago
Because you did not reply to the collected interaction
john metal gear solid
but i run interaction.editReply? oh wait
treble/luna
treble/luna3y ago
you're editing your original interaction
john metal gear solid
well if i console.log something in the if check it doesnt even get logged
treble/luna
treble/luna3y ago
Idk whether filter can be null
john metal gear solid
fair enough but then how would i not have a filter
treble/luna
treble/luna3y ago
I would try passing in true, not entirely sure whether that'd worl though also your time can be 15 mins max, the webhook token expires after 15 mins
bornikfik
bornikfik3y ago
here is my way of doing it no idea if it works but you can try
try {
const col = await interaction.channel.createMessageComponentCollector({
filter: (interaction) => interaction.customId === "join",
time: timeout,
}); // I want everyone to be able to click the button

col.on("collect", async (i) => {
players++;
await i.update({
embeds: [embed],
ephemeral: false,
components: [row],
});
});
}
try {
const col = await interaction.channel.createMessageComponentCollector({
filter: (interaction) => interaction.customId === "join",
time: timeout,
}); // I want everyone to be able to click the button

col.on("collect", async (i) => {
players++;
await i.update({
embeds: [embed],
ephemeral: false,
components: [row],
});
});
}
treble/luna
treble/luna3y ago
.update will throw an error since the reply hasnt been sent yet i think
bornikfik
bornikfik3y ago
then use interaction.deferReply()

Did you find this page helpful?