why this collector isnt working?its not responding to the answers

module.exports = {
data: new SlashCommandBuilder()
.setName("quotes-quiz")
.setDescription("Answer some league quotes"),

async execute(interaction) {
const item = quiz[Math.floor(Math.random() * quiz.length)];
const collectorFilter = response => {
return item.answer.some(answer => answer.toLowerCase() === response.content.toLowerCase());
};

interaction.reply({content: item.question, fetchReply: true})
.then(() => {
interaction.channel.awaitMessages({filter: collectorFilter, max: 1, time: 10_000, errors: ['time']})
.then(collected => {
interaction.followUp(`${collected.first().author} got the correct answer!`);
})
.catch(collected => {
interaction.followUp('Looks like nobody got the answer this time.');

});
});

}
}
module.exports = {
data: new SlashCommandBuilder()
.setName("quotes-quiz")
.setDescription("Answer some league quotes"),

async execute(interaction) {
const item = quiz[Math.floor(Math.random() * quiz.length)];
const collectorFilter = response => {
return item.answer.some(answer => answer.toLowerCase() === response.content.toLowerCase());
};

interaction.reply({content: item.question, fetchReply: true})
.then(() => {
interaction.channel.awaitMessages({filter: collectorFilter, max: 1, time: 10_000, errors: ['time']})
.then(collected => {
interaction.followUp(`${collected.first().author} got the correct answer!`);
})
.catch(collected => {
interaction.followUp('Looks like nobody got the answer this time.');

});
});

}
}
here is what the json looks like
[
{
"question": "Who says: \"The warrior's spirit is never broken.\"",
"answer": ["Xin Zhao", "xinzhao", "Xin"]
},
{
"question": "Who says: \"Break men to break their shackles.\"",
"answer": ["urgot", "Urgot"]
},
{
"question": "Who says: \"Everyone stay put, I'll be right back.\"",
"answer": ["galio", "Galio"]
}
]
[
{
"question": "Who says: \"The warrior's spirit is never broken.\"",
"answer": ["Xin Zhao", "xinzhao", "Xin"]
},
{
"question": "Who says: \"Break men to break their shackles.\"",
"answer": ["urgot", "Urgot"]
},
{
"question": "Who says: \"Everyone stay put, I'll be right back.\"",
"answer": ["galio", "Galio"]
}
]
7 Replies
d.js toolkit
d.js toolkit7mo ago
- 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 OP
monbrey
monbrey7mo ago
Do you have the necessary intents to receive messages?
UMI
UMIOP7mo ago
what do you mean 🥲 im still pretty new to this
monbrey
monbrey7mo ago
GuildMessages and MessageContent intents
UMI
UMIOP7mo ago
Ah I thought I only needex ot use the collections I was following the discord. js guide on collections
monbrey
monbrey7mo ago
The collectors are just handlers for those events, so the intents need to be enabled to receive them
UMI
UMIOP7mo ago
ohh okk thank you 🫶
Want results from more Discord servers?
Add your server