I have a problem I almost resolved but i'm now stuck.
I want to make my bot send a message in a channel at mirror hours (00h00, 01h01, 02h02...) for a running gag with my friends and currently I made this:
At the top of my code I have var currentdate = new Date();
And then, later in my source code:
if(currentdate.getMinutes() == currentdate.getHours())
{
bot.channels.get('SPECIFICCHANNELID').send('Touchez votre nez :nose:');
}
It's sort of working since the message is sent by the bot in the right channel, but the message is only sent when the bot detects a message, so if during any mirror hour, no one send a message, then the bot will not send anything.
And if there is multiples messages during this interval of time, the bot will also send the message multiple times, of course I want it to send the message only 1 time for exemple at 11:11:00.
Thank you for the help and sorry if my english is bad !
on('message')
listener, that may answer why your code is not called if a message is not sent. – user9016207on('message')
but when I put it outside of it, the bot just do nothing at all. – Misubata