round decimal instead of cancelling the command (Khaaz)

merge-requests/6/head
DedShot™#9195 2020-05-22 22:51:30 -04:00
parent 5cd7cb7bf2
commit 34d363b071
1 changed files with 1 additions and 2 deletions

View File

@ -20,10 +20,9 @@ export default class Slowmode extends Command {
const [length, unit] = args[0].match(/[a-z]+|[^a-z]+/gi); const [length, unit] = args[0].match(/[a-z]+|[^a-z]+/gi);
// eslint-disable-next-line no-restricted-globals // 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.'); 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 > 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')); return message.channel.edit({ rateLimitPerUser: momentSeconds }).then((c) => message.addReaction(':success:477618704155410452'));
} catch (err) { } catch (err) {