round decimal instead of cancelling the command (Khaaz)
parent
5cd7cb7bf2
commit
34d363b071
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue