From a2a144b0b49edd36a5bfadf646eba82adc41f450 Mon Sep 17 00:00:00 2001 From: Matthew R Date: Tue, 5 May 2020 19:25:19 -0400 Subject: [PATCH] allow dashes in redirect links --- src/commands/addredirect.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/commands/addredirect.ts b/src/commands/addredirect.ts index 79aa97f..11bc1e1 100644 --- a/src/commands/addredirect.ts +++ b/src/commands/addredirect.ts @@ -23,7 +23,7 @@ export default class AddRedirect extends Command { } catch { return this.error(message.channel, 'This doesn\'t appear to be a valid URL.'); } - if ((/^[a-zA-Z0-9]+$/gi.test(args[1].toLowerCase()) === false) || args[1].toLowerCase().length > 15) return this.error(message.channel, 'Invalid key. The key must be alphanumeric and less than 16 characters.'); + if ((/^[a-zA-Z0-9]+$/gi.test(args[1].toLowerCase().replace('-', '').trim()) === false) || args[1].toLowerCase().length > 15) return this.error(message.channel, 'Invalid key. The key must be alphanumeric and less than 16 characters.'); // eslint-disable-next-line new-cap const redirect = new this.client.db.redirect({ key: args[1].toLowerCase(),