From 176967b9fdc6f6a81f0289755c7bb1b5ca1aa3e6 Mon Sep 17 00:00:00 2001 From: loicbersier Date: Fri, 21 Aug 2020 18:53:00 +0200 Subject: [PATCH] append http if not included and disallow file:// Signed-off-by: loicbersier --- commands/utility/screenshot.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/commands/utility/screenshot.js b/commands/utility/screenshot.js index 9cc4339..428ab80 100644 --- a/commands/utility/screenshot.js +++ b/commands/utility/screenshot.js @@ -12,7 +12,7 @@ class screenshotCommand extends Command { args: [ { id: 'url', - type: 'url', + type: 'string', prompt: { start: 'Please send a link of which website you want to take a screenshot of.', retry: 'This does not look like an url, please try again.' @@ -33,8 +33,9 @@ class screenshotCommand extends Command { } async exec(message, args) { - let url = args.url.href; - if (url.includes('config.json')) return message.channel.send('I don\'t think so'); + let url = args.url; + if (!url.includes('http')) url = `http://${url}`; + if (url.includes('config.json') || url.includes('file://')) return message.channel.send('I don\'t think so'); let Embed = this.client.util.embed() .setColor(message.member ? message.member.displayHexColor : 'NAVY') .setTitle(url);