From 34d363b07113c728ed28fcaba85018cdbacbeb94 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?DedShot=E2=84=A2=239195?= Date: Fri, 22 May 2020 22:51:30 -0400 Subject: [PATCH] round decimal instead of cancelling the command (Khaaz) --- src/commands/slowmode.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/commands/slowmode.ts b/src/commands/slowmode.ts index b85bbad..72b302b 100644 --- a/src/commands/slowmode.ts +++ b/src/commands/slowmode.ts @@ -20,10 +20,9 @@ export default class Slowmode extends Command { const [length, unit] = args[0].match(/[a-z]+|[^a-z]+/gi); // eslint-disable-next-line no-restricted-globals if (isNaN(length as unknown as number)) return this.error(message.channel, 'Could not determine the slowmode time.'); - const momentSeconds: number = moment.duration(length, unit as unitOfTime.Base || 's').asSeconds(); + const momentSeconds: number = Number(moment.duration(length, unit as unitOfTime.Base || 's').asSeconds().toFixed()); if (momentSeconds > 21600 || momentSeconds < 0) return this.error(message.channel, 'Slowmode must be between 0 seconds and 6 hours.'); - if (momentSeconds % 1) return this.error(message.channel, 'Slowmode cannot have decimals'); return message.channel.edit({ rateLimitPerUser: momentSeconds }).then((c) => message.addReaction(':success:477618704155410452')); } catch (err) {