fix lowercasing issue'
parent
884a81d4b8
commit
96bcaed4b1
|
@ -18,7 +18,7 @@ export default class AddRedirect extends Command {
|
|||
const check = await this.client.db.redirect.findOne({ key: args[1].toLowerCase() });
|
||||
if (check) return this.error(message.channel, `Redirect key ${args[1].toLowerCase()} already exists. Linked to: ${check.to}`);
|
||||
try {
|
||||
const test = new URL(args[0].toLowerCase());
|
||||
const test = new URL(args[0]);
|
||||
if (test.protocol !== 'https:') return this.error(message.channel, 'Protocol must be HTTPS.');
|
||||
} catch {
|
||||
return this.error(message.channel, 'This doesn\'t appear to be a valid URL.');
|
||||
|
@ -27,10 +27,10 @@ export default class AddRedirect extends Command {
|
|||
// eslint-disable-next-line new-cap
|
||||
const redirect = new this.client.db.redirect({
|
||||
key: args[1].toLowerCase(),
|
||||
to: args[0].toLowerCase(),
|
||||
to: args[0],
|
||||
});
|
||||
await redirect.save();
|
||||
return this.success(message.channel, `Redirect https://loc.sh/${args[1].toLowerCase()} -> ${args[0].toLowerCase()} is now active.`);
|
||||
return this.success(message.channel, `Redirect https://loc.sh/${args[1].toLowerCase()} -> ${args[0]} is now active.`);
|
||||
} catch (err) {
|
||||
return this.client.util.handleError(err, message, this);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue