Add caption

This commit is contained in:
loicbersier 2019-11-06 20:03:12 +01:00
parent 3af87cab64
commit 621a60472f

View file

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