From 0e079683cb197cb1101b8878279f63770918c0ee Mon Sep 17 00:00:00 2001 From: loicbersier Date: Sat, 12 Oct 2019 19:26:35 +0200 Subject: [PATCH] use attachment --- commands/fun/vidshittifier.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/commands/fun/vidshittifier.js b/commands/fun/vidshittifier.js index aab7dab7..724d348a 100644 --- a/commands/fun/vidshittifier.js +++ b/commands/fun/vidshittifier.js @@ -28,6 +28,13 @@ class vidshittifierCommand extends Command { } async exec(message, args) { + let Attachment = (message.attachments).array(); + let url = args.link; + // Get attachment link + if (Attachment[0] && !args.link) { + url = Attachment[0].url; + } + let input = `${os.tmpdir()}/${message.id}.mp4`; let output = `${os.tmpdir()}/Shittifyed${message.id}.mp4`; let compression; @@ -42,8 +49,8 @@ class vidshittifierCommand extends Command { let loadingmsg = await message.channel.send('Processing '); - if (args.link) { - return youtubedl.exec(args.link, ['-o', input], {}, function(err) { + if (url) { + return youtubedl.exec(url, ['-o', input], {}, function(err) { if (err) { console.error(err); loadingmsg.delete();