All my code hasn't worked yet and was wondering how I could do it
The way you ask is too broad for Stack overflow, like what user @kevintechie said. Anyway, for sending a message at a specific time, I recommend using Cron
The possible varibles of Cron are:
Seconds: 0-59
Minutes: 0-59
Hours: 0-23
Day of Month: 1-31
Months: 0-11 (January - December)
Day of Week: 0-6 (Sunday - Saturday)
Lets say you want to send a message everyday at 6 AM, using your local time
var cron = require("cron");
client.on('message', ...); //you don't have to add anything to the message listener
let morning = new cron.CronJob('00 00 06 * * *', () => {
// Everyday at 6 AM, it will do something you want to it to do
let channel = yourGuild.channels.get('id');
channel.send('Morning everyone');
});
// to start the reminder
morning.start()
// to stop the reminder
morning.stop()
Else if you want it to remind from Mon to Fri, then it would be ...new cron.CronJob('00 00 06 * * 1-5', ()=> {...
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.