From c7e1ba00210463e1bb3a0b0bbd870c6059ecb372 Mon Sep 17 00:00:00 2001 From: loicbersier Date: Sat, 2 May 2020 02:11:02 +0200 Subject: [PATCH] Add "http://" automatically if its not included Signed-off-by: loicbersier --- commands/utility/screenshot.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/commands/utility/screenshot.js b/commands/utility/screenshot.js index c1e016e9..f7125258 100644 --- a/commands/utility/screenshot.js +++ b/commands/utility/screenshot.js @@ -39,6 +39,8 @@ class screenshotCommand extends Command { // eslint-disable-next-line no-useless-escape let urlregex = new RegExp(/https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)/); + if (!args.url.includes('http')) args.url = 'http://' + args.url; + console.log(args.url); if (args.url.match(urlregex)) { // Only allow link with http/https await captureWebsite.file(args.url, `${os.tmpdir()}/${message.id}.jpg`, { type: 'jpeg',