#collector issue

1 messages · Page 1 of 1 (latest)

regal stirrup
edgy hound
#

do you have the GUILD_MESSAGES intent?

#

if yes, add logs in your filter, see where it fails

regal stirrup
# edgy hound 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
edgy hound
#

log both parseInts

regal stirrup
# edgy hound log both `parseInt`s
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
edgy hound
#

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

regal stirrup
regal stirrup
#

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

edgy hound
#

not with awaitMessage since that is a promisified collector

#

you can use a "normal" collector however

grim grottoBOT
regal stirrup
#

alr ill def try that 👍

edgy hound
#

in the "end" event you get a reason, if you manually stop it you can set that reason