isNaN() instead of Number.isNaN()
parent
8316ff53cd
commit
5cd7cb7bf2
|
@ -17,8 +17,9 @@ export default class Slowmode extends Command {
|
||||||
try {
|
try {
|
||||||
if (!args[0]) return this.error(message.channel, 'This command requires an argument.');
|
if (!args[0]) return this.error(message.channel, 'This command requires an argument.');
|
||||||
|
|
||||||
const [length, unit]: Array<string> = args[0].match(/[a-z]+|[^a-z]+/gi);
|
const [length, unit] = args[0].match(/[a-z]+|[^a-z]+/gi);
|
||||||
if (Number.isNaN(Number(length))) return this.error(message.channel, 'Could not determine the slowmode time.');
|
// 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 = moment.duration(length, unit as unitOfTime.Base || 's').asSeconds();
|
||||||
|
|
||||||
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.');
|
||||||
|
|
Loading…
Reference in New Issue