const gm = require("gm").subClass({ imageMagick: true }); const gmToBuffer = require("../utils/gmbuffer.js"); const wrap = require("../utils/wrap.js"); exports.run = async (message, args) => { if (args.length === 0) return `${message.author.mention}, you need to provide an image to make a Sonic meme!`; message.channel.sendTyping(); const template = "./assets/images/sonic.jpg"; const file = `/tmp/${Math.random().toString(36).substring(2, 15)}.png`; const cleanedMessage = args.join(" ").replace(/&/g, "\\&").replace(/>/g, "\\>").replace(/ { if (error) console.error; const command = gm(template).composite(file).gravity("Center").geometry("474x332+160+10"); const resultBuffer = await gmToBuffer(command, "png"); return message.channel.createMessage("", { file: resultBuffer, name: "sonic.png" }); }); };