mrmBot-Matrix/commands/leak.js

21 lines
1.4 KiB
JavaScript
Raw Normal View History

const gm = require("gm").subClass({
imageMagick: true
});
exports.run = async (message) => {
message.channel.sendTyping();
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!`;
if (image.type === "gif") return `${message.author.mention}, this command doesn't work with GIFs!`;
const template = "./assets/images/leak.png";
2020-03-15 17:54:51 +00:00
const buffer = await 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").bufferPromise(image.type, image.delay);
// 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");
return {
file: buffer,
name: `leak.${image.type}`
};
};
exports.aliases = ["smash", "laxchris", "ssbu", "smashleak"];
exports.category = 5;
exports.help = "Creates a fake Smash leak thumbnail from an image";