diff --git a/commands/9gag.js b/commands/9gag.js index c07957e..99fceb0 100644 --- a/commands/9gag.js +++ b/commands/9gag.js @@ -9,9 +9,8 @@ exports.run = async (message) => { if (image === undefined) return `${message.author.mention}, you need to provide an image to add a 9GAG watermark!`; const watermark = "./assets/images/9gag.png"; const data = gm(image.data).coalesce().out("null:").out(watermark).gravity("East").out("-layers", "composite").out("-layers", "optimize"); - const resultBuffer = await gmToBuffer(data); return message.channel.createMessage("", { - file: resultBuffer, + file: await gmToBuffer(data), name: `9gag.${image.type}` }); }; diff --git a/commands/bandicam.js b/commands/bandicam.js index 50db095..c899150 100644 --- a/commands/bandicam.js +++ b/commands/bandicam.js @@ -11,9 +11,8 @@ exports.run = async (message) => { gm(image.data).size(async (error, size) => { if (error) throw error; const data = gm(image.data).coalesce().out("null:").out(watermark).gravity("North").resize(null, size.height).out("-layers", "composite").out("-layers", "optimize"); - const resultBuffer = await gmToBuffer(data); return message.channel.createMessage("", { - file: resultBuffer, + file: await gmToBuffer(data), name: `bandicam.${image.type}` }); }); diff --git a/commands/blur.js b/commands/blur.js index f79120a..e91b3c3 100644 --- a/commands/blur.js +++ b/commands/blur.js @@ -8,9 +8,8 @@ exports.run = async (message) => { const image = await require("../utils/imagedetect.js")(message); if (image === undefined) return `${message.author.mention}, you need to provide an image to blur!`; const command = gm(image.data).blur(10); - const resultBuffer = await gmToBuffer(command); return message.channel.createMessage("", { - file: resultBuffer, + file: await gmToBuffer(command), name: `blur.${image.type}` }); }; diff --git a/commands/blurple.js b/commands/blurple.js index 4188ed5..00bfc40 100644 --- a/commands/blurple.js +++ b/commands/blurple.js @@ -8,9 +8,8 @@ exports.run = async (message) => { const image = await require("../utils/imagedetect.js")(message); if (image === undefined) return `${message.author.mention}, you need to provide an image to make blurple!`; const data = gm(image.data).threshold(75, true).out("+level-colors").out("\"#7289DA\",white"); - const resultBuffer = await gmToBuffer(data); return message.channel.createMessage("", { - file: resultBuffer, + file: await gmToBuffer(data), name: `blurple.${image.type}` }); }; diff --git a/commands/circle.js b/commands/circle.js index 60b5c01..34d0e91 100644 --- a/commands/circle.js +++ b/commands/circle.js @@ -8,9 +8,8 @@ exports.run = async (message) => { const image = await require("../utils/imagedetect.js")(message); if (image === undefined) return `${message.author.mention}, you need to provide an image to add radial blur!`; const data = gm(image.data).out("-radial-blur", 10); - const resultBuffer = await gmToBuffer(data); return message.channel.createMessage("", { - file: resultBuffer, + file: await gmToBuffer(data), name: `circle.${image.type}` }); }; diff --git a/commands/deviantart.js b/commands/deviantart.js index 7bc9e28..69c2964 100644 --- a/commands/deviantart.js +++ b/commands/deviantart.js @@ -11,9 +11,8 @@ exports.run = async (message) => { gm(image.data).size(async (error, size) => { if (error) throw error; const data = gm(image.data).coalesce().out("null:").out(watermark).gravity("Center").resize(null, size.height).out("-layers", "composite").out("-layers", "optimize"); - const resultBuffer = await gmToBuffer(data); return message.channel.createMessage("", { - file: resultBuffer, + file: await gmToBuffer(data), name: `deviantart.${image.type}` }); }); diff --git a/commands/explode.js b/commands/explode.js index ea65b32..7c846ac 100644 --- a/commands/explode.js +++ b/commands/explode.js @@ -8,9 +8,8 @@ exports.run = async (message) => { const image = await require("../utils/imagedetect.js")(message); if (image === undefined) return `${message.author.mention}, you need to provide an image to explode!`; const data = gm(image.data).implode([-2]); - const resultBuffer = await gmToBuffer(data); return message.channel.createMessage("", { - file: resultBuffer, + file: await gmToBuffer(data), name: `explode.${image.type}` }); }; diff --git a/commands/flip.js b/commands/flip.js index ad28c73..e50e06f 100644 --- a/commands/flip.js +++ b/commands/flip.js @@ -8,9 +8,8 @@ exports.run = async (message) => { const image = await require("../utils/imagedetect.js")(message); if (image === undefined) return `${message.author.mention}, you need to provide an image to flip!`; const command = gm(image.data).flip(); - const resultBuffer = await gmToBuffer(command); return message.channel.createMessage("", { - file: resultBuffer, + file: await gmToBuffer(command), name: `flip.${image.type}` }); }; diff --git a/commands/flop.js b/commands/flop.js index 356f0d3..c0bf630 100644 --- a/commands/flop.js +++ b/commands/flop.js @@ -8,9 +8,8 @@ exports.run = async (message) => { const image = await require("../utils/imagedetect.js")(message); if (image === undefined) return `${message.author.mention}, you need to provide an image to flop!`; const command = gm(image.data).flop(); - const resultBuffer = await gmToBuffer(command); return message.channel.createMessage("", { - file: resultBuffer, + file: await gmToBuffer(command), name: `flop.${image.type}` }); }; diff --git a/commands/funky.js b/commands/funky.js index 95f8eae..b4270c7 100644 --- a/commands/funky.js +++ b/commands/funky.js @@ -11,9 +11,8 @@ exports.run = async (message) => { gm(image.data).size(async (error, size) => { if (error) throw error; const data = gm(image.data).coalesce().out("null:").out(watermark).gravity("NorthEast").resize(null, size.height).out("-layers", "composite").out("-layers", "optimize"); - const resultBuffer = await gmToBuffer(data); return message.channel.createMessage("", { - file: resultBuffer, + file: await gmToBuffer(data), name: `funky.${image.type}` }); }); diff --git a/commands/gamexplain.js b/commands/gamexplain.js index 87cb98e..cebec0a 100644 --- a/commands/gamexplain.js +++ b/commands/gamexplain.js @@ -12,9 +12,8 @@ exports.run = async (message) => { const path = `/tmp/${Math.random().toString(36).substring(2, 15)}.${image.type}`; require("util").promisify(fs.writeFile)(path, image.data); const command = gm(template).background("white").out("null:").out("(").out(path).out("-virtual-pixel", "transparent").resize("1181x571!").coalesce().out(")").compose("over").gravity("Center").out("-geometry", "+0+40").out("-layers", "composite").out("-layers", "optimize"); - const resultBuffer = await gmToBuffer(command, image.type); return message.channel.createMessage("", { - file: resultBuffer, + file: await gmToBuffer(command, image.type), name: `gamexplain.${image.type}` }); }; diff --git a/commands/haah.js b/commands/haah.js index 5b93648..e36f5d1 100644 --- a/commands/haah.js +++ b/commands/haah.js @@ -18,9 +18,8 @@ exports.run = async (message) => { gm(data2).flop().write(data, async (error) => { if (error) throw error; const command = gm(data2).extent(size.width, size.height).out("null:").out(data).geometry(`+${size.width / 2}+0`).out("-layers", "Composite").out("-layers", "optimize"); - const resultBuffer = await gmToBuffer(command, image.type); return message.channel.createMessage("", { - file: resultBuffer, + file: await gmToBuffer(command, image.type), name: `haah.${image.type}` }); }); diff --git a/commands/homebrew.js b/commands/homebrew.js index e301476..a96987e 100644 --- a/commands/homebrew.js +++ b/commands/homebrew.js @@ -9,9 +9,8 @@ exports.run = async (message, args) => { const template = "./assets/images/hbc.png"; const cleanedMessage = args.join(" ").toLowerCase().replace(/\n/g, " "); const command = gm(template).gravity("Center").font("./assets/hbc.ttf").out("-kerning", "-5").fill("white").pointSize(96).drawText(0, 0, cleanedMessage); - const resultBuffer = await gmToBuffer(command); return message.channel.createMessage("", { - file: resultBuffer, + file: await gmToBuffer(command), name: "homebrew.png" }); }; diff --git a/commands/hooh.js b/commands/hooh.js index 08621f1..b54f6fc 100644 --- a/commands/hooh.js +++ b/commands/hooh.js @@ -18,9 +18,8 @@ exports.run = async (message) => { gm(data2).flip().write(data, async (error) => { if (error) throw error; const command = gm(data2).extent(size.width, size.height).out("null:").out(data).geometry(`+0+${size.height / 2}`).out("-layers", "Composite").out("-layers", "Optimize"); - const resultBuffer = await gmToBuffer(command, image.type); return message.channel.createMessage("", { - file: resultBuffer, + file: await gmToBuffer(command, image.type), name: `hooh.${image.type}` }); }); diff --git a/commands/hypercam.js b/commands/hypercam.js index 81dec80..f816cfb 100644 --- a/commands/hypercam.js +++ b/commands/hypercam.js @@ -11,9 +11,8 @@ exports.run = async (message) => { gm(image.data).size(async (error, size) => { if (error) throw error; const data = gm(image.data).coalesce().out("null:").out(watermark).gravity("NorthWest").resize(null, size.height).out("-layers", "composite").out("-layers", "optimize"); - const resultBuffer = await gmToBuffer(data); return message.channel.createMessage("", { - file: resultBuffer, + file: await gmToBuffer(data), name: `hypercam.${image.type}` }); }); diff --git a/commands/ifunny.js b/commands/ifunny.js index 4b18dd6..a4b9aa2 100644 --- a/commands/ifunny.js +++ b/commands/ifunny.js @@ -11,9 +11,8 @@ exports.run = async (message) => { gm(image.data).size(async (error, size) => { if (error) throw error; const data = gm(image.data).coalesce().out("null:").out(watermark).gravity("South").resize(size.width, null).out("-layers", "composite").out("-layers", "optimize"); - const resultBuffer = await gmToBuffer(data); return message.channel.createMessage("", { - file: resultBuffer, + file: await gmToBuffer(data), name: `ifunny.${image.type}` }); }); diff --git a/commands/implode.js b/commands/implode.js index f785357..b2cabc1 100644 --- a/commands/implode.js +++ b/commands/implode.js @@ -8,9 +8,8 @@ exports.run = async (message) => { const image = await require("../utils/imagedetect.js")(message); if (image === undefined) return `${message.author.mention}, you need to provide an image to implode!`; const data = gm(image.data).implode([1]); - const resultBuffer = await gmToBuffer(data); return message.channel.createMessage("", { - file: resultBuffer, + file: await gmToBuffer(data), name: `implode.${image.type}` }); }; diff --git a/commands/invert.js b/commands/invert.js index 015181e..29ec550 100644 --- a/commands/invert.js +++ b/commands/invert.js @@ -8,9 +8,8 @@ exports.run = async (message) => { const image = await require("../utils/imagedetect.js")(message); if (image === undefined) return `${message.author.mention}, you need to provide an image to invert!`; const data = gm(image.data).negative(); - const resultBuffer = await gmToBuffer(data); return message.channel.createMessage("", { - file: resultBuffer, + file: await gmToBuffer(data), name: `invert.${image.type}` }); }; diff --git a/commands/jpeg.js b/commands/jpeg.js index 085f544..35d26be 100644 --- a/commands/jpeg.js +++ b/commands/jpeg.js @@ -8,9 +8,8 @@ exports.run = async (message) => { const image = await require("../utils/imagedetect.js")(message); if (image === undefined) return `${message.author.mention}, you need to provide an image to add more JPEG!`; const data = gm(image.data).setFormat("jpg").quality(1); - const resultBuffer = await gmToBuffer(data); return message.channel.createMessage("", { - file: resultBuffer, + file: await gmToBuffer(data), name: "jpeg.jpg" }); }; diff --git a/commands/leak.js b/commands/leak.js index 7ab1084..1727d43 100644 --- a/commands/leak.js +++ b/commands/leak.js @@ -14,10 +14,9 @@ exports.run = async (message) => { require("util").promisify(fs.writeFile)(path, image.data); const command = gm(template).out("-background").out("white").out("-gravity").out("Center").out("(").out("-clone").out("0").out("(").out(path).out("-virtual-pixel").out("white").out("-resize").out("640x360!").rotate("white", 15).out(")").out("-geometry").out("+450-200").out("-composite").out(")").out("+swap").out("-composite").out("-alpha").out("remove").out("-alpha").out("off"); // const command = gm(template).out("-background", "white").gravity("Center").out("null:").out("(").out(path).out("-resize", "640x360!").out("-virtual-pixel", "white").rotate("white", 15).coalesce().geometry("+450-200").out(")").compose("over").out("-alpha", "remove").out("-alpha", "off").out("-layers", "composite"); - const resultBuffer = await gmToBuffer(command, "png"); return message.channel.createMessage("", { - file: resultBuffer, - name: "leak.png" + file: await gmToBuffer(command), + name: `leak.${image.type}` }); }; diff --git a/commands/magik.js b/commands/magik.js index 3c9178b..44dce82 100644 --- a/commands/magik.js +++ b/commands/magik.js @@ -8,7 +8,7 @@ exports.run = async (message) => { if (image === undefined) return `${message.author.mention}, you need to provide an image to add some magik!`; if (image.type === "gif") return `${message.author.mention}, this command doesn't work with GIFs!`; const processMessage = await message.channel.createMessage(" Processing... This might take a while"); - gm(image.data).resize(800, 800).stream((error, stream) => { + gm(image.data).resize(800, 800).stream("miff", (error, stream) => { if (error) throw error; gm(stream).out("-liquid-rescale", "400x400").stream(async (error, stream2) => { if (error) throw error; diff --git a/commands/mc.js b/commands/mc.js index fa7eeb4..a5553f0 100644 --- a/commands/mc.js +++ b/commands/mc.js @@ -4,9 +4,8 @@ exports.run = async (message, args) => { if (args.length === 0) return `${message.author.mention}, you need to provide some text to generate a Minecraft achievement!`; message.channel.sendTyping(); const request = await fetch(`https://www.minecraftskinstealer.com/achievement/a.php?i=13&h=Achievement+get%21&t=${encodeURIComponent(args.join("+"))}`); - const buffer = await request.buffer(); return message.channel.createMessage("", { - file: buffer, + file: await request.buffer(), name: "mc.png" }); }; diff --git a/commands/meme.js b/commands/meme.js index 3af0839..48183eb 100644 --- a/commands/meme.js +++ b/commands/meme.js @@ -21,9 +21,8 @@ exports.run = async (message, args) => { gm().out("-size", size.width).background("none").gravity("Center").out("(", "(").font("Impact").out("-pointsize", 40).out(`pango:${bottomText ? bottomText.toUpperCase().replace(/&/g, "\\&").replace(/>/g, "\\>").replace(/`).out(")", "(", "+clone").out("-channel", "A").out("-morphology", "EdgeOut", "Octagon", "+channel", "+level-colors", "black", ")").compose("DstOver").out(")", "-composite").write(file3, async (error) => { if (error) throw error; const data = gm(file).out("-coalesce").out("null:").gravity("North").out(file2).out("-layers", "composite").out("null:").gravity("South").out(file3).out("-layers", "composite").out("-layers", "optimize"); - const resultBuffer = await gmToBuffer(data, image.type); return message.channel.createMessage("", { - file: resultBuffer, + file: await gmToBuffer(data, image.type), name: `meme.${image.type}` }); }); diff --git a/commands/motivate.js b/commands/motivate.js index d897c4e..c1e21d3 100644 --- a/commands/motivate.js +++ b/commands/motivate.js @@ -36,17 +36,19 @@ exports.run = async (message, args) => { gm(text2).size(async (error, size4) => { if (error) throw error; const command2 = gm(await gmToBuffer(command, image.type)).gravity("North").coalesce().background("black").extent(600, size2.height + size3.height + size4.height).out("null:", "(", text2, "-set", "page", `+0+${size2.height + size3.height}`, ")", "-layers", "composite", "-layers", "optimize"); + const resultBuffer = await gmToBuffer(command2, image.type); processMessage.delete(); return message.channel.createMessage("", { - file: await gmToBuffer(command2, image.type), + file: resultBuffer, name: `motivate.${image.type}` }); }); }); } else { + const resultBuffer = await gmToBuffer(command, image.type); processMessage.delete(); return message.channel.createMessage("", { - file: await gmToBuffer(command, image.type), + file: resultBuffer, name: `motivate.${image.type}` }); } diff --git a/commands/qrcreate.js b/commands/qrcreate.js index d0b2d27..d26f0c1 100644 --- a/commands/qrcreate.js +++ b/commands/qrcreate.js @@ -14,9 +14,8 @@ exports.run = async (message, args, content) => { if (error) throw error; }); writable.once("end", () => { - const imageBuffer = Buffer.concat(chunks); return message.channel.createMessage("", { - file: imageBuffer, + file: Buffer.concat(chunks), name: "qr.png" }); }); diff --git a/commands/retro.js b/commands/retro.js index 672ca83..d4ae371 100644 --- a/commands/retro.js +++ b/commands/retro.js @@ -13,9 +13,8 @@ exports.run = async (message, args) => { } else { text = new RetroText().setLine(2, line1).setBackgroundStyle("outlineTri").setTextStyle("chrome"); } - const textImage = await text.fetchBuffer(); return message.channel.createMessage("", { - file: textImage, + file: await text.fetchBuffer(), name: "retro.png" }); }; diff --git a/commands/scott.js b/commands/scott.js index 41d2b8e..01dea0b 100644 --- a/commands/scott.js +++ b/commands/scott.js @@ -12,9 +12,8 @@ exports.run = async (message) => { const path = `/tmp/${Math.random().toString(36).substring(2, 15)}.${image.type}`; require("util").promisify(fs.writeFile)(path, image.data); const command = gm(template).out("null:").out("(").out(path).out("-virtual-pixel", "transparent").resize("415x234!").coalesce().out("+distort", "Perspective", "0,0 129,187 415,0 517,182 415,234 517,465 0,234 132,418").out(")").compose("over").gravity("Center").geometry("-238-98").out("-layers", "composite").out("-layers", "optimize"); - const resultBuffer = await gmToBuffer(command, image.type); return message.channel.createMessage("", { - file: resultBuffer, + file: await gmToBuffer(command, image.type), name: `scott.${image.type}` }); }; diff --git a/commands/sharpen.js b/commands/sharpen.js index 0af3400..cba3e75 100644 --- a/commands/sharpen.js +++ b/commands/sharpen.js @@ -8,9 +8,8 @@ exports.run = async (message) => { const image = await require("../utils/imagedetect.js")(message); if (image === undefined) return `${message.author.mention}, you need to provide an image to sharpen!`; const command = gm(image.data).sharpen(10); - const resultBuffer = await gmToBuffer(command); return message.channel.createMessage("", { - file: resultBuffer, + file: await gmToBuffer(command), name: `sharpen.${image.type}` }); diff --git a/commands/shutterstock.js b/commands/shutterstock.js index cd4fad8..070dfd5 100644 --- a/commands/shutterstock.js +++ b/commands/shutterstock.js @@ -11,9 +11,8 @@ exports.run = async (message) => { gm(image.data).size(async (error, size) => { if (error) throw error; const command = gm(image.data).coalesce().out("null:").out(watermark).gravity("Center").resize(null, size.height).out("-layers", "composite").out("-layers", "optimize"); - const output = await gmToBuffer(command); return message.channel.createMessage("", { - file: output, + file: await gmToBuffer(command), name: `shutterstock.${image.type}` }); }); diff --git a/commands/sonic.js b/commands/sonic.js index a549459..1b3c760 100644 --- a/commands/sonic.js +++ b/commands/sonic.js @@ -13,9 +13,8 @@ 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 resultBuffer = await gmToBuffer(command, "png"); return message.channel.createMessage("", { - file: resultBuffer, + file: await gmToBuffer(command, "png"), name: "sonic.png" }); }); diff --git a/commands/stretch.js b/commands/stretch.js index 0204b0d..a782aa1 100644 --- a/commands/stretch.js +++ b/commands/stretch.js @@ -8,9 +8,8 @@ exports.run = async (message) => { const image = await require("../utils/imagedetect.js")(message); if (image === undefined) return `${message.author.mention}, you need to provide an image to stretch!`; const data = gm(image.data).resize("512x512!"); - const resultBuffer = await gmToBuffer(data); return message.channel.createMessage("", { - file: resultBuffer, + file: await gmToBuffer(data), name: `stretch.${image.type}` }); }; diff --git a/commands/swirl.js b/commands/swirl.js index 451a114..3c30789 100644 --- a/commands/swirl.js +++ b/commands/swirl.js @@ -8,9 +8,8 @@ exports.run = async (message) => { const image = await require("../utils/imagedetect.js")(message); if (image === undefined) return `${message.author.mention}, you need to provide an image to swirl!`; const data = gm(image.data).swirl(180); - const resultBuffer = await gmToBuffer(data); return message.channel.createMessage("", { - file: resultBuffer, + file: await gmToBuffer(data), name: `swirl.${image.type}` }); }; diff --git a/commands/tile.js b/commands/tile.js index 6fb057b..9305238 100644 --- a/commands/tile.js +++ b/commands/tile.js @@ -10,9 +10,8 @@ exports.run = async (message) => { gm(image.data).command("montage").out("-duplicate").out(24).tile("5x5").geometry("+0+0").stream(async (error, output) => { if (error) throw error; const data = gm(output).resize("800x800>"); - const resultBuffer = await gmToBuffer(data); return message.channel.createMessage("", { - file: resultBuffer, + file: await gmToBuffer(data), name: `tile.${image.type}` }); }); diff --git a/commands/trump.js b/commands/trump.js index febf731..8751227 100644 --- a/commands/trump.js +++ b/commands/trump.js @@ -12,9 +12,8 @@ exports.run = async (message) => { const path = `/tmp/${Math.random().toString(36).substring(2, 15)}.${image.type}`; require("util").promisify(fs.writeFile)(path, image.data); const command = gm(template).background("white").out("null:").out("(").out(path).out("-virtual-pixel", "transparent").resize("365x179!").coalesce().out("+distort", "Perspective", "0,0 207,268 365,0 548,271 365,179 558,450 0,179 193,450").out(")").compose("over").gravity("Center").geometry("-217-135").out("-layers", "composite").out("-layers", "optimize"); - const resultBuffer = await gmToBuffer(command, image.type); return message.channel.createMessage("", { - file: resultBuffer, + file: await gmToBuffer(command, image.type), name: `trump.${image.type}` }); }; diff --git a/commands/waaw.js b/commands/waaw.js index fbafa8c..b52d14d 100644 --- a/commands/waaw.js +++ b/commands/waaw.js @@ -18,9 +18,8 @@ exports.run = async (message) => { gm(data2).flop().write(data, async (error) => { if (error) throw error; const command = gm(data2).extent(size.width, size.height).out("null:").out(data).geometry(`+${size.width / 2}+0`).out("-layers", "Composite").out("-layers", "optimize"); - const resultBuffer = await gmToBuffer(command, image.type); return message.channel.createMessage("", { - file: resultBuffer, + file: await gmToBuffer(command, image.type), name: `waaw.${image.type}` }); }); diff --git a/commands/wall.js b/commands/wall.js index a181b10..2c8f240 100644 --- a/commands/wall.js +++ b/commands/wall.js @@ -10,9 +10,8 @@ exports.run = async (message) => { gm(image.data).resize(128).stream(async (error, output) => { if (error) throw error; const data = gm(output).virtualPixel("tile").matteColor("none").out("-background", "none").resize("512x512!").out("-distort").out("Perspective").out("0,0,57,42 0,128,63,130 128,0,140,60 128,128,140,140"); - const resultBuffer = await gmToBuffer(data); return message.channel.createMessage("", { - file: resultBuffer, + file: await gmToBuffer(data), name: `wall.${image.type}` }); }); diff --git a/commands/wdt.js b/commands/wdt.js index 0cca6ee..0bfed3c 100644 --- a/commands/wdt.js +++ b/commands/wdt.js @@ -12,9 +12,8 @@ exports.run = async (message) => { const path = `/tmp/${Math.random().toString(36).substring(2, 15)}.${image.type}`; require("util").promisify(fs.writeFile)(path, image.data); const command = gm(template).coalesce().out("null:").out(path).gravity("Center").resize("374x374>").out("-layers", "composite").out("-layers", "optimize"); - const resultBuffer = await gmToBuffer(command, image.type); return message.channel.createMessage("", { - file: resultBuffer, + file: await gmToBuffer(command, image.type), name: `wdt.${image.type}` }); }; diff --git a/commands/wide.js b/commands/wide.js index 2b86bca..9421431 100644 --- a/commands/wide.js +++ b/commands/wide.js @@ -11,9 +11,8 @@ exports.run = async (message) => { if (error) throw error; if (size.width > 10000) return `${message.author.mention}, this image is too wide!`; const data = gm(image.data).resize(`${(size.width * 19) / 2}x${size.height / 2}!`); - const resultBuffer = await gmToBuffer(data); return message.channel.createMessage("", { - file: resultBuffer, + file: await gmToBuffer(data), name: `wide.${image.type}` }); }); diff --git a/commands/woow.js b/commands/woow.js index 48d4343..b3668a8 100644 --- a/commands/woow.js +++ b/commands/woow.js @@ -18,9 +18,8 @@ exports.run = async (message) => { gm(data2).flip().write(data, async (error) => { if (error) throw error; const command = gm(data2).extent(size.width, size.height).out("null:").out(data).geometry(`+0+${size.height / 2}`).out("-layers", "Composite").out("-layers", "optimize"); - const resultBuffer = await gmToBuffer(command, image.type); return message.channel.createMessage("", { - file: resultBuffer, + file: await gmToBuffer(command, image.type), name: `woow.${image.type}` }); });