diff --git a/commands/sonic.js b/commands/sonic.js index cdfbcbf..c3e54a6 100644 --- a/commands/sonic.js +++ b/commands/sonic.js @@ -13,7 +13,7 @@ exports.run = async (message, args) => { gm(474, 332).out("+size").background("none").gravity("Center").out("-pointsize", 72).out("-font", "Bitstream Vera Sans").out(`pango:${wrap(cleanedMessage, {width: 15, indent: ""})}`).write(file, async (error) => { if (error) throw error; const command = gm(template).composite(file).gravity("Center").geometry("474x332+160+10"); - const buffer = await gmToBuffer(command, "png"); + const buffer = await gmToBuffer(command, "png", "sonic"); return message.channel.createMessage("", { file: buffer, name: "sonic.png" diff --git a/utils/gmbuffer.js b/utils/gmbuffer.js index 38d1727..597f052 100644 --- a/utils/gmbuffer.js +++ b/utils/gmbuffer.js @@ -1,9 +1,9 @@ // workaround for a gm bug where it doesn't output buffers properly // https://github.com/aheckmann/gm/issues/572#issuecomment-293768810 -module.exports = (data, format) => { +module.exports = (data, format, type) => { return new Promise((resolve, reject) => { if (format) { - data.out("-layers", "optimize").stream(format, (err, stdout, stderr) => { + data.out(type !== "sonic" ? "-layers" : "", type !=="sonic" ? "optimize" : "").stream(format, (err, stdout, stderr) => { if (err) return reject(err); const chunks = []; stdout.on("data", (chunk) => {