首页 > 解决方案 > Discord Bot Timer 说有效的东西不是,有没有办法解决这个问题?

问题描述

我做了一个计时器命令,但是当我输入一个有效时间它说它无效时会发生什么,有人可以帮助我吗?

bot.on('message', message => {
    let args = message.content.substring(PREFIX.length).split(" ");
    switch (args[0]) {
        case 'timer':      
            let time = (args[1]);
                if(!time){
                return message.reply("You didn't specify a time!");
            }    
            message.reply(`Your timer has started for ${ms(ms(time))}`);  
            setTimeout(function(){                 
                message.reply(`your timer has stopped`)
            }, ms(time));    
            if (isNaN(time)) return message.reply('That is not a valid number');      
    }
});

这是正在发生的事情

标签: javascripttimerdiscordbots

解决方案


推荐阅读