From 621a60472f45eb198517cd815823e955e9ca566a Mon Sep 17 00:00:00 2001
From: loicbersier <loic.bersier1@gmail.com>
Date: Wed, 6 Nov 2019 20:03:12 +0100
Subject: [PATCH] Add caption

---
 commands/utility/download.js | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/commands/utility/download.js b/commands/utility/download.js
index d06fb22a..41656f0a 100644
--- a/commands/utility/download.js
+++ b/commands/utility/download.js
@@ -18,6 +18,11 @@ class DownloadCommand extends Command {
 						start: 'Send the link of wich video you want to download',
 					}
 				},
+				{
+					id: 'caption',
+					type: 'string',
+					match: 'rest'
+				},
 				{
 					id: 'spoiler',
 					match: 'flag',
@@ -27,13 +32,15 @@ class DownloadCommand extends Command {
 			clientPermissions: ['ATTACH_FILES'],
 			description: {
 				content: 'Download videos from different website from the link you provided, use "-s" to make the vid a spoiler',
-				usage: '[link]',
-				examples: ['https://www.youtube.com/watch?v=6n3pFFPSlW4']
+				usage: '[link] [caption]',
+				examples: ['https://www.youtube.com/watch?v=6n3pFFPSlW4 Look at this funny gnome']
 			}
 		});
 	}
 
 	async exec(message, args) {
+		if (args.caption == null) args.caption = '';
+		
 		let link = args.link;
 		let fileName;
 
@@ -95,6 +102,7 @@ class DownloadCommand extends Command {
 						const Embed = new MessageEmbed()
 							.setColor(message.member.displayHexColor)
 							.setTitle(`Downloaded by ${message.author.username}`)
+							.setDescription(args.caption)
 							.setURL(link);
 
 						return message.channel.send({embed: Embed, files: [`${os.tmpdir()}/${fileName}compressed.mp4`]})
@@ -111,6 +119,7 @@ class DownloadCommand extends Command {
 					const Embed = new MessageEmbed()
 						.setColor(message.member.displayHexColor)
 						.setTitle(`Downloaded by ${message.author.username}`)
+						.setDescription(args.caption)
 						.setURL(link);
 
 					return message.channel.send({embed: Embed, files: [`${os.tmpdir()}/${fileName}.mp4`]})