const gm = require("gm").subClass({ imageMagick: true }); exports.run = async (message, args) => { const image = await require("../utils/imagedetect.js")(message); if (image === undefined) return `${message.author.mention}, you need to provide an image/GIF to make a motivational poster!`; if (args.length === 0) return `${message.author.mention}, you need to provide some text to make a motivational poster!`; const processMessage = await message.channel.createMessage(" Processing... This might take a while"); const [topText, bottomText] = args.join(" ").split(/(? elem.trim()); const file = `/tmp/${Math.random().toString(36).substring(2, 15)}.miff`; const text = `/tmp/${Math.random().toString(36).substring(2, 15)}.png`; const text2 = `/tmp/${Math.random().toString(36).substring(2, 15)}.png`; const buffer = await gm().in("(").in(image.path).coalesce().resize(500, 500).borderColor("black").border(5, 5).out(")").borderColor("white").border(3, 3).bufferPromise("miff", image.delay); await gm(buffer).coalesce().background("black").gravity("Center").extent(600, "%[fx:s.h+50]").writePromise(file); const size2 = await gm(file).sizePromise(); await gm().background("black").out("-size", "600").fill("white").font("Times").pointSize(56).gravity("Center").out(`pango:${topText.replace(/&/g, "\\&").replace(/>/g, "\\>").replace(//g, "\\>").replace(/