Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

93
Vistas
awaitMessages filter doesn't run .then?

I'm running a dm prompt from my bot, where the player needs to reply before the bot continues asking. I set up a filter so that the bot doesn't detect and count its own message, but it doesn't seem to be triggering the ".then()" function.

My code:

            let filter = m => m.author.id != client.user.id
            channel.awaitMessages(filter, {max: 1, time: 1000*180, errors: ['time']})
                .then(msg => {
                    console.log("got to the then")
                    let replymsgobject = msg.first()
                    let reply = replymsgobject.content
                    let checkstringarr = [
                        "payment",
                        "about",
                        "team",
                        "requirements"
                    ]
                    if (contains("or", reply, checkstringarr)) {
                        channel.send(`Your post doesn't follow the format.`)
                    } else {
                        channel.send(`succesfully set your post message, would you like to add any extra comments?`)
                        let filter = m => m.author.id != client.user.id
                        channel.awaitMessages(filter, {max: 1, time: 1000*120, errors: ['time']})
                            .then(replymsg => {
                                if (contains("only", replymsg.content, "no")) {
                                    //some stuff
                                } else {
                                    //some stuff
                                }
                            })
                            .catch(collectedcatchmsg => {
                                channel.send(`timed out`)
                            })
                    }
                })
                .catch(collectedcatchmsg => {
                    channel.send(`timed out`)
                })
about 4 years ago · Juan Pablo Isaza
2 Respuestas
Responde la pregunta

0

@Toasty said (sorry Toasty), "it will wait until the timer is over". This is incorrect, it will give you the promise once for example the max messages have been reached.

why would it wait for 3 mins if it gets the required answer in 10secs??

Now I'm a little lost do you want the command executor to reply to that message collector or do you not? Because right now your filter is not accepting any messages sent by the command executor/message sender.

To fix this just edit your filter

const filter = m => m.author.id === message.author.id;

if you want someone else's message to be collected and not the message authors, then you would do

const filter = m => m.author.id !== message.author.id;
about 4 years ago · Juan Pablo Isaza Denunciar

0

Turns out there were 2 errors! First off the filter dictionary was supposed to be inside the table with the requirements, etc., The second error was using != instead of !==, Thanks to @Patrik for helping out here!

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda