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.