diff --git a/commands/Utility/slowmode.js b/commands/Utility/slowmode.js index 2df45d4..3f6e7b5 100644 --- a/commands/Utility/slowmode.js +++ b/commands/Utility/slowmode.js @@ -1,8 +1,16 @@ exports.run = async (client, message, args, level) => { - let rateLimit = +args[0] || 0; + message.delete(); + let rateLimit = +args[0]; + + if(typeof rateLimit !== "number") return (await message.reply("you need to provide a valid time limit!")).delete(5000); + if(rateLimit < 0 || rateLimit > 21600) return (await message.reply(`I can't complete this request because the Discord API is only able to handle times from 0 seconds to 21600 seconds (6 hours), and you requested a time of ${rateLimit} seconds.`)).delete(5000); - message.channel.rateLimitPerUser = rateLimit; - (await message.channel.send(`${message.author} has set ${message.channel}'s slowmode to ${rateLimit} seconds.`)).delete(5000); + message.channel.setRateLimitPerUser(rateLimit, `command handle from ${message.author.tag}.`); + if(rateLimit === 0) { + (await message.channel.send(`${message.author} has removed ${message.channel}'s slowmode.`)).delete(5000); + } else { + (await message.channel.send(`${message.author} has set ${message.channel}'s slowmode to ${rateLimit} seconds.`)).delete(5000); + } }; exports.conf = {