#Message Collector Error
1 messages · Page 1 of 1 (latest)
@supple field I know the slash command listener is working correctly.
And the collector.end event listener is too. But nothing is passing through to 'collect'. Do collectors need to be outside of slash commands / other interactions?
I run into the same issue with awaitMessages too
Yeah
module.exports = {
data: new SlashCommandBuilder()
.setName('ping')
.setDescription('Collects messages for 10 sec'),
async execute(interaction) {
const filter = m => m.content.includes('discord');
const collector = await interaction.channel.createMessageCollector({ filter, time: 15000 });
await collector.on('collect', m => {
console.log(`Collected ${m.content}`);
});
await collector.on('end', collected => {
console.log(`Collected ${collected.size} items`);
});
await interaction.reply('collecting...');
}
this is with added awaits before everything in case something was off due to that. But that shouldn't be the case if its just creating the collector
and you get nothing when a message is collected in your on('collect') ?
const filter = (message) => { return true; };
await interaction.reply({ content: 'Pong!', fetchReply: true })
.then(interaction.channel.awaitMessages({ filter, time: 10000 })
.then((collected) => { console.log(collected.size); })
.catch((err) => { console.log(err); }));
this is another try I made with await messages and I always got collected.size = 0
Yea nothing comes through to the console
I might just try reinstalling discord.js
const client = new Client({ intents: [Intents.FLAGS.GUILDS] });
@summer apex you need GUILD_MESSAGES
cheers. figured it was something i missed, appreciate the help