Reputation: 35
So basically I made a timer command using ms.js, and when i use the command /timer 5s, it responds with the timer has ended directly after without actually waiting the 5 seconds, any help?
case 'timer':
let time = ms(args[1])
setTimeout(() => {
message.channel.send('Your timer has now ended.')
}, ms(time));
break;
Upvotes: 0
Views: 26
Reputation: 2823
first of all check the value of time
variable. if that is ok then modify your code like below. and be careful that the setTimeout
use millisecond as time parameter
case 'timer':
let time = ms(args[1])
setTimeout(() => {
message.channel.send('Your timer has now ended.')
},time);
break;
Upvotes: 1