forked from Supositware/Haha-Yes
Add "http://" automatically if its not included
Signed-off-by: loicbersier <loic.bersier1@gmail.com>
This commit is contained in:
parent
101d7b18a4
commit
c7e1ba0021
1 changed files with 2 additions and 0 deletions
|
@ -39,6 +39,8 @@ class screenshotCommand extends Command {
|
||||||
|
|
||||||
// eslint-disable-next-line no-useless-escape
|
// 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()@:%_\+.~#?&//=]*)/);
|
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
|
if (args.url.match(urlregex)) { // Only allow link with http/https
|
||||||
await captureWebsite.file(args.url, `${os.tmpdir()}/${message.id}.jpg`, {
|
await captureWebsite.file(args.url, `${os.tmpdir()}/${message.id}.jpg`, {
|
||||||
type: 'jpeg',
|
type: 'jpeg',
|
||||||
|
|
Loading…
Reference in a new issue