Synced changes

This commit is contained in:
Emily 2020-04-01 02:45:45 +11:00
parent 93abdb367d
commit c0111e0943
5 changed files with 220 additions and 33 deletions

View file

@ -34,13 +34,20 @@ module.exports = async (client, message) => {
return message.channel.send('You don\'t have permission to run this command!')
}
const delay = () => {
setTimeout(() => {
client.cooldown.get(cmd).delete(message.author.id);
message.channel.send(`${message.member} cooldown has expired for ${command} command.`)
}, commands.get(command) * 1000);
}
// Cooldown
if (client.cooldown.get(cmd.help.name).has(message.author.id)) {
const init = client.cooldown.get(command).get(message.author.id)
const curr = new Date()
const diff = Math.round((curr - init) / 1000)
const time = cmd.conf.cooldown / 1000
return message.reply(`this command is on cooldown! You'll be able to use it again in ${time - diff} seconds.`)
} else {
client.cooldown.get(cmd.help.name).set(message.author.id, new Date())
setTimeout(() => {
client.cooldown.get(cmd.help.name).delete(message.author.id)
}, client.commands.get(cmd.help.name).conf.cooldown)
}
message.author.permLevel = level

View file

@ -1,4 +1,3 @@
module.exports = (client) => {
client.logger.ready('Connected to Discord as ' + client.user.tag)
client.logger.debug(client.cooldown)
}