forked from Supositware/Haha-Yes
Tell the remaining cooldown for the command
This commit is contained in:
parent
dc2c09f0ce
commit
cb411ed813
1 changed files with 26 additions and 0 deletions
26
event/listeners/cooldown.js
Normal file
26
event/listeners/cooldown.js
Normal file
|
@ -0,0 +1,26 @@
|
|||
const { Listener } = require('discord-akairo');
|
||||
|
||||
class cooldownListener extends Listener {
|
||||
constructor() {
|
||||
super('cooldown', {
|
||||
emitter: 'commandHandler',
|
||||
event: 'cooldown'
|
||||
});
|
||||
}
|
||||
|
||||
async exec(message, command, number) {
|
||||
let seconds = parseInt((number / 1000) % 60),
|
||||
minutes = parseInt((number / (1000 * 60)) % 60),
|
||||
hours = parseInt((number / (1000 * 60 * 60)) % 24);
|
||||
|
||||
hours = (hours < 10) ? '0' + hours : hours;
|
||||
minutes = (minutes < 10) ? '0' + minutes : minutes;
|
||||
seconds = (seconds < 10) ? '0' + seconds : seconds;
|
||||
|
||||
let time = hours + ':' + minutes + ':' + seconds;
|
||||
|
||||
message.reply(`You can use the \`${command.id}\` command in \`${time}\``);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = cooldownListener;
|
Loading…
Reference in a new issue