append http if not included and disallow file://

Signed-off-by: loicbersier <loic.bersier1@gmail.com>
This commit is contained in:
loicbersier 2020-08-21 18:53:00 +02:00
parent b7ea6a396e
commit 176967b9fd

View file

@ -12,7 +12,7 @@ class screenshotCommand extends Command {
args: [ args: [
{ {
id: 'url', id: 'url',
type: 'url', type: 'string',
prompt: { prompt: {
start: 'Please send a link of which website you want to take a screenshot of.', 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.' retry: 'This does not look like an url, please try again.'
@ -33,8 +33,9 @@ class screenshotCommand extends Command {
} }
async exec(message, args) { async exec(message, args) {
let url = args.url.href; let url = args.url;
if (url.includes('config.json')) return message.channel.send('I don\'t think so'); 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() let Embed = this.client.util.embed()
.setColor(message.member ? message.member.displayHexColor : 'NAVY') .setColor(message.member ? message.member.displayHexColor : 'NAVY')
.setTitle(url); .setTitle(url);