From 8a3bb73af6e0f87a588add319f974ae33fc8526d Mon Sep 17 00:00:00 2001 From: Supositware Date: Sat, 12 Jan 2019 20:57:52 +0100 Subject: [PATCH] trying to see why it dosent work on a sepcific server --- commands/admin/slowmode.js | 43 +++++++++++++++++++++----------------- 1 file changed, 24 insertions(+), 19 deletions(-) diff --git a/commands/admin/slowmode.js b/commands/admin/slowmode.js index b1ebf553..b0fd74aa 100644 --- a/commands/admin/slowmode.js +++ b/commands/admin/slowmode.js @@ -28,26 +28,31 @@ class PruneCommand extends Command { } async exec(message,args) { - let slowmodeNumber = args.slowmodeNumber; - let realtime = args.realtime; - - if (slowmodeNumber > 120) - return message.channel.send('Slowmode can only be set to 120 seconds or lower!'); - - message.channel.setRateLimitPerUser(slowmodeNumber); - - if (realtime) { - let time = 60000 * realtime; - message.channel.send(`Slowmode have been set to ${slowmodeNumber} seconds and will end in ${realtime} minutes!`); - setTimeout (function (){ - message.channel.setRateLimitPerUser(0); - return message.channel.send('Slowmode is now disabled!'); - }, time); - } else { - if (slowmodeNumber == 0) - return message.channel.send('Slowmode have been disabled!'); - return message.channel.send(`Slowmode have been set to ${slowmodeNumber} seconds!`); + try { + let slowmodeNumber = args.slowmodeNumber; + let realtime = args.realtime; + + if (slowmodeNumber > 120) + return message.channel.send('Slowmode can only be set to 120 seconds or lower!'); + + message.channel.setRateLimitPerUser(slowmodeNumber); + + if (realtime) { + let time = 60000 * realtime; + message.channel.send(`Slowmode have been set to ${slowmodeNumber} seconds and will end in ${realtime} minutes!`); + setTimeout (function (){ + message.channel.setRateLimitPerUser(0); + return message.channel.send('Slowmode is now disabled!'); + }, time); + } else { + if (slowmodeNumber == 0) + return message.channel.send('Slowmode have been disabled!'); + return message.channel.send(`Slowmode have been set to ${slowmodeNumber} seconds!`); + } + } catch (err) { + console.error(err); } + } }