2020-08-28 02:34:12 +00:00
|
|
|
const magick = require("../utils/image.js");
|
2020-01-08 01:17:04 +00:00
|
|
|
|
|
|
|
exports.run = async (message, args) => {
|
|
|
|
const image = await require("../utils/imagedetect.js")(message);
|
|
|
|
if (image === undefined) return `${message.author.mention}, you need to provide an image/GIF to add a caption!`;
|
2020-04-23 22:38:01 +00:00
|
|
|
const newArgs = args.filter(item => !item.includes(image.url) );
|
2020-01-09 01:10:26 +00:00
|
|
|
if (args.length === 0) return `${message.author.mention}, you need to provide some text to add a caption!`;
|
2020-01-08 01:17:04 +00:00
|
|
|
const processMessage = await message.channel.createMessage("<a:processing:479351417102925854> Processing... This might take a while");
|
2020-10-18 21:53:35 +00:00
|
|
|
const { buffer, type } = await magick.run({
|
2020-08-28 02:34:12 +00:00
|
|
|
cmd: "caption",
|
|
|
|
path: image.path,
|
2020-10-18 21:53:35 +00:00
|
|
|
caption: newArgs.join(" ")
|
2020-08-28 02:34:12 +00:00
|
|
|
});
|
2020-09-23 19:12:39 +00:00
|
|
|
if (processMessage.channel.messages.get(processMessage.id)) await processMessage.delete();
|
2020-04-12 19:51:48 +00:00
|
|
|
return {
|
2020-10-18 21:53:35 +00:00
|
|
|
file: buffer,
|
|
|
|
name: `caption.${type}`
|
2020-04-12 19:51:48 +00:00
|
|
|
};
|
2020-01-08 01:17:04 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
exports.aliases = ["gifc", "gcaption", "ifcaption", "ifunnycaption"];
|
|
|
|
exports.category = 5;
|
2020-03-05 15:28:10 +00:00
|
|
|
exports.help = "Adds a caption to an image/GIF";
|