Iam trying to make my bot posting message based on array at midnight + also before specific time. The only way I know is to set the delay to the bot but what I want to do is to call a function at midnight (00:00 CET)
I've got array that contains text which bot should announce at midnight. Please point me in good direction :joy:
This is a function that bot use to storage data, to send
if (command === 'koth'){
const massageContent = message.content.toLowerCase();
// console.log(massageContent.slice(config.prefix.length+command.length+1))
if(AreaLowerCase.includes(massageContent.slice(config.prefix.length+command.length+1)) === true) {
AreaToDefend.push(massageContent.slice(config.prefix.length+command.length+1));
// console.log(AreaToDefend)
} else return message.channel.send("Area isnt exist, check the name");
}
I would recommend getting node-schedule-tz .
With this you can create a schedule like so :
var ruleName = new schedule.RecurrenceRule();
tournRule.hour = 00;
tournRule.minute = 00;
tournRule.tz = 'CET';
var r = schedule.scheduleJob(ruleName, function() {
// Call your desired function
})
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.