#collector issue
1 messages · Page 1 of 1 (latest)
do you have the GUILD_MESSAGES intent?
if yes, add logs in your filter, see where it fails
const filter = (m: Message) => {
console.log('yay');
return parseInt(m.content) == parseInt(random);
};
```I add that into my filter and it works, it logged yay when bot gives me number of `7` and i say `7` in chat, i proceeded to add a console log in my `.then()` but it doesnt log anything
```ts
.then(async (collected: Collection<string, Message<boolean>>) => {
console.log('yay then works');
})
but however the ```ts
.catch(async () => {
await channel.send('Nobody guessed the correct number! 2 bad so sad.');
});
**does** work
log both parseInts
console.log(parseInt(m.content));
console.log(parseInt(random));
console.log(parseInt(m.content) == parseInt(random));
i added those and got the same outputs, both are 9
// console
9
9
true
I think I got the issue. since you don't specifiy any other end condition other than "time" and "time" is also in the errors array the collector will always reject
since you already check if the collector collected nothing you can remove the "errors" and "catch" part and handle everything in the then callback
also why then if you are in an async context
i was just lost so i tried everything, i plan to fix all bad stuff when the code works
yup that part helped, ty!
im sorry to bother again, but i have another issue you could possibly shed some light on
basically i get the correct number and all, but it takes forever for the bot to respond
i currently have the time set to 90000 (1 minute, 30 second) and the bot will wait until that time is over, then send the success msg
is there any way for me to stop the collector and send the msg right away when someone gets the correct number
not with awaitMessage since that is a promisified collector
you can use a "normal" collector however
<:_:874569335308431382> TextChannel#createMessageCollector()
Creates a Message Collector.
alr ill def try that 👍
in the "end" event you get a reason, if you manually stop it you can set that reason