According to my codes, I want to send an auto msg when the certain time that I set. But it is not executing. Do my codes have a problem?
//time
var date = new Date();
var hour = date.getHours();
hour = (hour < 10 ? "0" : "") + hour;
var min = date.getMinutes();
min = (min < 10 ? "0" : "") + min;
console.log(hour + ":" + min);
bot.on("message", function(msg){
if(hour == 19 && min == 50){
bot.sendMessage(msg.chat.id, "7:50 PM")
}
});
I expect the output of "7:50" msg in my Bot, but nothing in my bot despite of 7:50 PM now.
P.S. the msg that printed in the console is correct with the current time.