mrmBot-Matrix/commands/sonic.js

20 lines
757 B
JavaScript
Raw Normal View History

const magick = require("../utils/image.js");
2019-09-13 20:02:41 +00:00
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!`;
2019-09-13 20:02:41 +00:00
message.channel.sendTyping();
const cleanedMessage = args.join(" ").replaceAll("&", "\\&amp;").replaceAll(">", "\\&gt;").replaceAll("<", "\\&lt;").replaceAll("\"", "\\&quot;").replaceAll("'", "\\&apos;").replaceAll("%", "\\%");
2020-12-30 17:37:41 +00:00
const { buffer } = await magick.run({
cmd: "sonic",
text: 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]";