20 lines
No EOL
1.1 KiB
JavaScript
20 lines
No EOL
1.1 KiB
JavaScript
const magick = require("../build/Release/image.node");
|
|
const { promisify } = require("util");
|
|
const wrap = require("../utils/wrap.js");
|
|
|
|
exports.run = async (message, args) => {
|
|
if (args.length === 0) return `${message.author.mention}, you need to provide some text to make a Sonic meme!`;
|
|
message.channel.sendTyping();
|
|
const cleanedMessage = args.join(" ").replace(/&/g, "\\&").replace(/>/g, "\\>").replace(/</g, "\\<").replace(/"/g, "\\"").replace(/'/g, "\\'");
|
|
/*await gm(474, 332).out("+size").background("none").gravity("Center").out("-pointsize", 72).out("-font", "Bitstream Vera Sans").out(`pango:<span foreground="white">${wrap(cleanedMessage, {width: 15, indent: ""})}</span>`).writePromise(file);
|
|
const buffer = await gm(template).composite(file).gravity("Center").geometry("474x332+160+10").bufferPromise("png", null, "sonic");*/
|
|
const buffer = await promisify(magick.sonic)(wrap(cleanedMessage, {width: 15, indent: ""}));
|
|
return {
|
|
file: buffer,
|
|
name: "sonic.png"
|
|
};
|
|
};
|
|
|
|
exports.category = 4;
|
|
exports.help = "Creates a Sonic speech bubble image";
|
|
exports.params = "[text]"; |