Added a small hack to make sonic work again

This commit is contained in:
TheEssem 2020-02-20 15:08:48 -06:00
parent 1ecae70c41
commit 1c9d40041b
2 changed files with 3 additions and 3 deletions

View File

@ -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:<span foreground="white">${wrap(cleanedMessage, {width: 15, indent: ""})}</span>`).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"

View File

@ -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) => {