hello! I just started coding like two days ago and I want to make a discord bot that is able to send anonymous dms, I already have the code to send the messages instantly thanks to a youtube tutorial but I was wondering if you could somehow make the bot wait a certain amount of time before sending the message, this is the code I have for the instant dm if it helps with anything
client.on ('message', message =>{
if (message.author.bot) return;
mention = message.mentions.users.first();
if (message.content.startsWith (prefix + "send") ) {
if (mention == null) { return; }
message.delete();
mentionMessage = message.content.slice (5);
mention.send('someone sent you a letter! **||** ' + mentionMessage + ' **||** make sure to send them a reply! (if you know who they are of course ^^)');
message.channel.send ('your letter will be delivered!')
} },)
var sendmsg = function(){
mention.send('someone sent you a letter! **||** ' + mentionMessage + ' **||** make sure to send them a reply! (if you know who they are of course ^^)');
};
setTimeout(sendmsg,3000); //Send the message after 3 seconds.
is there a specific place where I have to write it?
I’ve been trying to do it and I kinda understand how it works but I havent been able to really make it work
ok sorry Im a huge dumbass, I’ve been trying to find the ready on the message event but I can really seem to find it,Im really sorry but can you describe it more specifically please?
client.on (‘ready’, () =>{
var sendmsg = function(){
mention.send(‘someone sent you a letter! || ’ + mentionMessage + ’ || make sure to send them a reply! (if you know who they are of course ^^)’);
};
setTimeout(sendmsg,3000);
}
what do you mean something like that?
sorry, this is just hard to figure out
I already tried a bunch of option but it either sends instantly or breaks everything
I’ve been trying to look for some coding , I want my bot to send private dms but juss like private dms and I’m not sure how to code that can someone help me ?