use attachment

This commit is contained in:
loicbersier 2019-10-12 19:26:35 +02:00
parent c5f2e2d39f
commit 0e079683cb

View file

@ -28,6 +28,13 @@ class vidshittifierCommand extends Command {
} }
async exec(message, args) { 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 input = `${os.tmpdir()}/${message.id}.mp4`;
let output = `${os.tmpdir()}/Shittifyed${message.id}.mp4`; let output = `${os.tmpdir()}/Shittifyed${message.id}.mp4`;
let compression; let compression;
@ -42,8 +49,8 @@ class vidshittifierCommand extends Command {
let loadingmsg = await message.channel.send('Processing <a:loadingmin:527579785212329984>'); let loadingmsg = await message.channel.send('Processing <a:loadingmin:527579785212329984>');
if (args.link) { if (url) {
return youtubedl.exec(args.link, ['-o', input], {}, function(err) { return youtubedl.exec(url, ['-o', input], {}, function(err) {
if (err) { if (err) {
console.error(err); console.error(err);
loadingmsg.delete(); loadingmsg.delete();