How to make discord bot wait for reply for 5 minutes and then send a message? Using discord js

I am using Discord js to make a discord bot. The role of the bot is to send a message to user in personal messages and then wait for user response for 5 minutes. If user does not sends anything back to the member then a message is send by the bot that there request has been denied because they did not send any email id. I am using discord.js collector npm package for taking message and sending it to the user. The problem I am getting is that the bot send back a reply to the user just after 30 seconds if user does not types anything. I don’t want that. I wish the bot to wait for 5 mins before sending request denied message. Here is what my code looks like.

 message.reply("Please check your DM to verify your email id");
                const filter = (m) => m.author.id === message.author.id;
                
                    const botMessage = await message.author.send("Enter your registered email Id please?");
                    const userMessage = await MessageCollector.asyncQuestion({
                      botMessage,
                      user: message.author.id,
                      time:300000 // milliseconds
                    }).catch(()=>{
                      message.author.send("Request Denied because you did not responded with a registerd email ID. You can request again!");
                      return 0;
                    }); 
                    

I have also used discord js library to implement there own parameters such as idle but I am still getting the error. Here is what my code looks there.

message.reply("Please check your DM to verify your email id");
                    const filter = (m) => m.author.id === message.author.id;
                    
                        const botMessage = await message.author.send("Enter your registered email Id please?");
                        const userMessage = await MessageCollector.asyncQuestion({
                          botMessage,
                          user: message.author.id,
                          idle:300000 // milliseconds
                        }).catch(()=>{
                          message.author.send("Request Denied because you did not responded with a registerd email ID. You can request again!");
                          return 0;
                        }); 
                  

Would be great if someone could tell me where I am making a mistake.

74 thoughts on “How to make discord bot wait for reply for 5 minutes and then send a message? Using discord js”

  1. les therapies comportementales cognitives et emotionnelles en 150 fiches medicaments goutte , pharmacie centrale brest telephone pharmacie normand bourges , Comprar Tamiflu genГ©rico, Comprar Tamiflu medicamento. Comprar Tamiflu sin receta Comprar Tamiflu genГ©rico [url=https://kit.co/nemitech/comprar-tamiflu-generico-comprar-tamiflu-medicamento#]Comprar Tamiflu genГ©rico[/url] pharmacie avignon la rocade Barato Avodart en PerГє, Comprar Avodart medicamento. Comprar Avodart sin receta Comprar Avodart genГ©rico [url=https://kit.co/spelexin/comprar-avodart-sin-receta-barato-avodart-en-peru#]DГіnde comprar Avodart 0.5 mg[/url] , pharmacie leclerc gonfreville l’orcher pharmacie thiault bourges , pharmacie auchan maurepas. pharmacie esplanade angers pharmacie de garde saint etienne Comprar Valtrex sin receta, DГіnde comprar Valtrex 1g. Comprar Valtrex sin receta Comprar Valtrex genГ©rico [url=https://kit.co/esatev/comprar-valtrex-sin-receta-donde-comprar-valtrex-1g#]Comprar Valtrex sin receta, DГіnde comprar Valtrex 1g[/url] , pharmacie foch. pharmacie ermont, pharmacie en ligne julie ricci pharmacie ouverte goussainville . pharmacie avignon rue de la republique, pharmacie beaulieu saint etienne pharmacie homeopathie argenteuil pharmacie bleue angers .

    Reply