Well i have this function here that runs on intervals and what it does is, when it runs, it sets 2 settimeout.
Here's the problem, an asynchronous function that should be called after the 2nd time out is called before the 2nd timeout is even triggered. This is my code.
    var runner = Interval.run(function() {
    //-212965881
    bot.sendMessage('-212965881', "Drop usernames now").then(function(){
        ready = 1;
        list = {};
        console.log(ready);
        setTimeout(function(){
            return bot.sendMessage('-212965881',"Round has begun. Please start liking now. Leech check will begin in 1 minute");
        }, 10000);
    }).then(function(){
        ready = 0;
        setTimeout(function(){
            return bot.sendMessage('-212965881',"Leech check has begun!");
        }, 15000);
    }).then(function(){
        //This one fires before 15 seconds
        let msg = {chat:{}};
        msg.chat.id = '-212965881';
        return bot.event('/check', msg);
    }).catch(function(err){
        console.log(err);
    });
},  20000);
Not sure why this happens. Perhaps im going about it the wrong way. Can anyone throw some light on this? Thanks
 
     
    