I'm new to discord js and trying to make my bot send a message at a specific time (set via timestamp).
client.on('ready', function(e)
{
console.log(`Logged in as ${client.user.tag}!`)
let scheduledMessage = new cron.CronJob('0 10 15 * * *', () => {
const guild = client.guilds.cache.get('ID');
const channel = client.channels.cache.get('ID');
const exampleEmbed = new MessageEmbed()
.setColor('#ebdc05')
.setTitle('Another ten minutes')
channel.send({ embeds: [exampleEmbed] });
});
scheduledMessage.start()
});
I found this method that sends a message at 15:10:00. My problem is that I would need the bot to send the message every 31 hours.
I also found the method to write '0 0 */31 * * *' instead of '0 10 15 * * *'. And that works, every 31 hours a message would be sent, but I'm afraid my bot sometimes could send the message a bit after the 31-hour mark and just add up seconds and minutes after time, that at some point it sends the message at like 15:12:00 or sth.
So I came up with the idea to just make a timestamp, and add the time to always have the 31 hours, then let the bot send the message at the exact timestamp. Sadly, I found nothing to that problem.
Is that even possible?
Edit: The timestamp variant would be useful because I can subtract and add time to that very easily and also show it in an embed.