diff --git a/.gitignore b/.gitignore index dd039c3..01c594f 100644 --- a/.gitignore +++ b/.gitignore @@ -38,4 +38,5 @@ todo.txt tweets.json .vscode/ migratedb.js -migratetweets.js \ No newline at end of file +migratetweets.js +processed.txt \ No newline at end of file diff --git a/commands/caption.js b/commands/caption.js index 5fa1646..2c2b910 100644 --- a/commands/caption.js +++ b/commands/caption.js @@ -11,8 +11,8 @@ exports.run = async (message, args) => { const size = await gm(image.path).sizePromise(); const output = await gm().out("-size", `${size.width}x`).background("white").fill("black").font("./assets/caption.otf", size.width / 10).gravity("Center").out(`caption:${args.join(" ")}`).bufferPromise("png"); const size2 = await gm(output).sizePromise(); - const output2 = await gm(output).gravity("Center").trim().out("+repage").extent(size.width, size2.height + (size.width / 10)).streamPromise(); - const outputFinal = await gm(output2).out("-alpha", "set").background("none").out("(").out(image.path).out("-coalesce").out(")").colorspace("sRGB").out("-set", "page", "%[fx:u.w]x%[fx:u.h+v.h]+%[fx:t?(u.w-v.w)/2:0]+%[fx:t?u.h:0]").out("-coalesce").out("null:").out("-insert", 1).out("-layers", "composite").bufferPromise(image.type); + //const output2 = await gm(output).gravity("Center").trim().out("+repage").extent(size.width, size2.height + (size.width / 10)).streamPromise(); + const outputFinal = await gm(output).in("(").gravity("Center").trim().out("+repage").extent(size.width, size2.height + (size.width / 10)).out(")").background("white").out("-alpha", "set").out("(").out(image.path).out("-coalesce").out(")").colorspace("sRGB").out("-set", "page", "%[fx:u.w]x%[fx:u.h+v.h]+%[fx:t?(u.w-v.w)/2:0]+%[fx:t?u.h:0]").out("-coalesce").out("null:").out("-insert", 1).out("-layers", "composite").bufferPromise(image.type); await processMessage.delete(); //return upload(message, outputFinal, `caption.${image.type}`); return message.channel.createMessage("", { diff --git a/commands/haah.js b/commands/haah.js index 174d717..f3ebf4b 100644 --- a/commands/haah.js +++ b/commands/haah.js @@ -7,10 +7,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 mirror!`; const data = `/tmp/${Math.random().toString(36).substring(2, 15)}.miff`; - const data2 = `/tmp/${Math.random().toString(36).substring(2, 15)}.miff`; - await gm(image.path).coalesce().gravity("West").crop("50%", 0).out("+repage").writePromise(data2); - await gm(data2).flop().writePromise(data); - const buffer = await gm(data2).extent("%[fx:u.w*2]", "%[fx:u.h]").out("null:").out(data).gravity("East").out("-layers", "Composite").bufferPromise(image.type); + await gm(image.path).coalesce().gravity("West").crop("50%", 0).out("+repage").writePromise(data); + const buffer = await gm(data).extent("%[fx:u.w*2]", "%[fx:u.h]").out("null:").out("(").out(data).flop().out(")").gravity("East").out("-layers", "Composite").bufferPromise(image.type); return message.channel.createMessage("", { file: buffer, name: `haah.${image.type}` diff --git a/commands/hooh.js b/commands/hooh.js index 1159fd7..781a938 100644 --- a/commands/hooh.js +++ b/commands/hooh.js @@ -7,12 +7,10 @@ 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 mirror!`; const data = `/tmp/${Math.random().toString(36).substring(2, 15)}.miff`; - const data2 = `/tmp/${Math.random().toString(36).substring(2, 15)}.miff`; const size = await gm(image.path).sizePromise(); - await gm(image.path).coalesce().gravity("South").crop(0, "50%").out("+repage").writePromise(data2); - await gm(data2).flip().writePromise(data); + await gm(image.path).coalesce().gravity("South").crop(0, "50%").out("+repage").writePromise(data); // const buffer = await gm(data2).extent("%[fx:u.w]", "%[fx:u.h*2]").out("null:").out(data).gravity("North").out("-layers", "Composite").bufferPromise(image.type); - const buffer = await gm(data2).extent(size.width, size.height).out("null:").out(data).geometry(`+0+${size.height / 2}`).out("-layers", "Composite").bufferPromise(image.type); + const buffer = await gm(data).extent(size.width, size.height).out("null:").out("(").out(data).flip().out(")").geometry(`+0+${size.height / 2}`).out("-layers", "Composite").bufferPromise(image.type); return message.channel.createMessage("", { file: buffer, name: `hooh.${image.type}` diff --git a/commands/magik.js b/commands/magik.js index 38b835f..eb92138 100644 --- a/commands/magik.js +++ b/commands/magik.js @@ -7,9 +7,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"); - const stream = await gm(image.path).coalesce().resize(600, 600).streamPromise("miff"); - const stream2 = await gm(stream).out("-liquid-rescale", "300x300").streamPromise(); - const resultBuffer = await gm(stream2).out("-liquid-rescale", "800x800").bufferPromise(image.type); + const resultBuffer = await gm(image.path).in("(").in("(").coalesce().resize(600, 600).out(")").out("-liquid-rescale", "300x300").out(")").out("-liquid-rescale", "800x800").bufferPromise(image.type); await processMessage.delete(); return message.channel.createMessage("", { file: resultBuffer, diff --git a/commands/motivate.js b/commands/motivate.js index 14f7f1b..57bc39b 100644 --- a/commands/motivate.js +++ b/commands/motivate.js @@ -16,12 +16,12 @@ exports.run = async (message, args) => { 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(/