2019-11-13 00:09:06 +00:00
|
|
|
const gm = require("gm").subClass({
|
|
|
|
imageMagick: true
|
|
|
|
});
|
|
|
|
const gmToBuffer = require("../utils/gmbuffer.js");
|
|
|
|
|
|
|
|
exports.run = async (message) => {
|
2019-12-02 20:47:22 +00:00
|
|
|
message.channel.sendTyping();
|
2019-11-13 00:09:06 +00:00
|
|
|
const image = await require("../utils/imagedetect.js")(message);
|
|
|
|
if (image === undefined) return `${message.author.mention}, you need to provide an image to make a Super Smash Bros. leak meme!`;
|
2020-02-18 20:44:39 +00:00
|
|
|
if (image.type === "gif" || image.type === "mp4") return `${message.author.mention}, this command doesn't work with GIFs!`;
|
2019-11-13 00:09:06 +00:00
|
|
|
const template = "./assets/images/leak.png";
|
2020-02-18 20:44:39 +00:00
|
|
|
const command = gm(template).out("-background").out("white").out("-gravity").out("Center").out("(").out("-clone").out("0").out("(").out(image.path).out("-virtual-pixel").out("white").out("-resize").out("640x360!").rotate("white", 15).out(")").out("-geometry").out("+450-200").out("-composite").out(")").out("+swap").out("-composite").out("-alpha").out("remove").out("-alpha").out("off");
|
2020-01-09 01:10:26 +00:00
|
|
|
// const command = gm(template).out("-background", "white").gravity("Center").out("null:").out("(").out(path).out("-resize", "640x360!").out("-virtual-pixel", "white").rotate("white", 15).coalesce().geometry("+450-200").out(")").compose("over").out("-alpha", "remove").out("-alpha", "off").out("-layers", "composite");
|
2020-02-19 14:25:45 +00:00
|
|
|
const buffer = await gmToBuffer(command);
|
2019-11-13 00:09:06 +00:00
|
|
|
return message.channel.createMessage("", {
|
2020-02-19 14:25:45 +00:00
|
|
|
file: buffer,
|
2020-02-18 20:44:39 +00:00
|
|
|
name: `leak.${image.outputType}`
|
2019-11-13 00:09:06 +00:00
|
|
|
});
|
|
|
|
};
|
|
|
|
|
2019-12-02 20:47:22 +00:00
|
|
|
exports.aliases = ["smash", "laxchris", "ssbu", "smashleak"];
|
|
|
|
exports.category = 5;
|
|
|
|
exports.help = "Creates a fake Smash leak thumbnail from an image";
|