Refactored image/embed handling to prepare for something, don't use fuzz with sonic

This commit is contained in:
TheEssem 2020-04-12 14:51:48 -05:00
parent 2fbad4a38a
commit f6425dc294
62 changed files with 122 additions and 119 deletions

View File

@ -8,10 +8,10 @@ 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 buffer = await gm(image.path).coalesce().out("null:").out(watermark).gravity("East").out("-layers", "composite").bufferPromise(image.type, image.delay);
return message.channel.createMessage("", {
return {
file: buffer,
name: `9gag.${image.type}`
});
};
};
exports.aliases = ["ninegag", "gag"];

View File

@ -8,10 +8,10 @@ exports.run = async (message) => {
if (image === undefined) return `${message.author.mention}, you need to provide an image to add a Bandicam watermark!`;
const watermark = "./assets/images/bandicam.png";
const buffer = await gm(image.path).coalesce().out("null:").out(watermark).gravity("North").scale(null, "%[fx:u.h]").out("-layers", "composite").bufferPromise(image.type, image.delay);
return message.channel.createMessage("", {
return {
file: buffer,
name: `bandicam.${image.type}`
});
};
};
exports.aliases = ["bandi"];

View File

@ -4,14 +4,14 @@ exports.run = async (message) => {
message.channel.sendTyping();
const imageData = await fetch("http://shibe.online/api/birds");
const json = await imageData.json();
return message.channel.createMessage({
return {
embed: {
color: 16711680,
image: {
url: json[0]
}
}
});
};
};
exports.aliases = ["birb", "birds", "birbs"];

View File

@ -7,10 +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 blur!`;
const buffer = await gm(image.path).coalesce().blur(15).bufferPromise(image.type, image.delay);
return message.channel.createMessage("", {
return {
file: buffer,
name: `blur.${image.type}`
});
};
};
exports.category = 5;

View File

@ -7,10 +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 make blurple!`;
const buffer = await gm(image.path).coalesce().threshold(75, true).out("+level-colors").out("\"#7289DA\",white").bufferPromise(image.type, image.delay);
return message.channel.createMessage("", {
return {
file: buffer,
name: `blurple.${image.type}`
});
};
};
exports.aliases = ["blurp"];

View File

@ -15,10 +15,10 @@ exports.run = async (message, args) => {
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, image.delay);
await processMessage.delete();
//return upload(message, outputFinal, `caption.${image.type}`);
return message.channel.createMessage("", {
return {
file: outputFinal,
name: `caption.${image.type}`
});
};
};
exports.aliases = ["gifc", "gcaption", "ifcaption", "ifunnycaption"];

View File

@ -13,10 +13,10 @@ exports.run = async (message, args) => {
const size2 = await gm(text).sizePromise();
const outputFinal = await gm(image.path).gravity("North").extent(size.width, size2.height + size.height).out("null:", "(", text, "-set", "page", `+0+${size.height}`, ")", "-layers", "composite", "-layers", "optimize").bufferPromise(image.type, image.delay);
await processMessage.delete();
return message.channel.createMessage("", {
return {
file: outputFinal,
name: `caption2.${image.type}`
});
};
};
exports.aliases = ["tags2", "meirl", "memecaption", "medotmecaption"];

View File

@ -8,14 +8,14 @@ exports.run = async (message) => {
}
});
const json = await data.json();
return message.channel.createMessage({
return {
embed: {
color: 16711680,
image: {
url: json[0].url
}
}
});
};
};
exports.aliases = ["kitters", "kitties", "kitty", "cattos", "catto", "cats"];

View File

@ -7,10 +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 add radial blur!`;
const buffer = await gm(image.path).coalesce().out("-rotational-blur", 10).bufferPromise(image.type, image.delay);
return message.channel.createMessage("", {
return {
file: buffer,
name: `circle.${image.type}`
});
};
};
exports.aliases = ["cblur", "radial", "radialblur"];

View File

@ -8,10 +8,10 @@ exports.run = async (message) => {
if (image === undefined) return `${message.author.mention}, you need to provide an image to add a DeviantArt watermark!`;
const watermark = "./assets/images/deviantart.png";
const buffer = await gm(image.path).coalesce().out("null:").out(watermark).gravity("Center").scale(null, "%[fx:u.h]").out("-layers", "composite").bufferPromise(image.type, image.delay);
return message.channel.createMessage("", {
return {
file: buffer,
name: `deviantart.${image.type}`
});
};
};
exports.aliases = ["da", "deviant"];

View File

@ -4,14 +4,14 @@ exports.run = async (message) => {
message.channel.sendTyping();
const imageData = await fetch("https://dog.ceo/api/breeds/image/random");
const json = await imageData.json();
return message.channel.createMessage({
return {
embed: {
color: 16711680,
image: {
url: json.message
}
}
});
};
};
exports.aliases = ["doggos", "doggo", "pupper", "puppers", "dogs", "puppy", "puppies", "pups", "pup"];

View File

@ -8,10 +8,11 @@ exports.run = async (message, args) => {
const cleaned = await clean(evaled);
const sendString = `\`\`\`js\n${cleaned}\n\`\`\``;
if (sendString.length >= 2000) {
return message.channel.createMessage("The result was too large, so here it is as a file:", [{
return {
text: "The result was too large, so here it is as a file:",
file: cleaned,
name: "result.txt"
}]);
};
} else {
return sendString;
}

View File

@ -11,10 +11,11 @@ exports.run = async (message, args) => {
const cleaned = await clean(execed.stdout);
const sendString = `\`\`\`bash\n${cleaned}\n\`\`\``;
if (sendString.length >= 2000) {
return message.channel.createMessage("The result was too large, so here it is as a file:", [{
return {
text: "The result was too large, so here it is as a file:",
file: cleaned,
name: "result.txt"
}]);
};
} else {
return sendString;
}

View File

@ -7,10 +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 explode!`;
const buffer = await gm(image.path).coalesce().implode([-2]).bufferPromise(image.type, image.delay);
return message.channel.createMessage("", {
return {
file: buffer,
name: `explode.${image.type}`
});
};
};
exports.aliases = ["exp"];

View File

@ -7,10 +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 flip!`;
const buffer = await gm(image.path).flip().bufferPromise(image.type, image.delay);
return message.channel.createMessage("", {
return {
file: buffer,
name: `flip.${image.type}`
});
};
};
exports.category = 5;

View File

@ -7,10 +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 flop!`;
const buffer = await gm(image.path).flop().bufferPromise(image.type, image.delay);
return message.channel.createMessage("", {
return {
file: buffer,
name: `flop.${image.type}`
});
};
};
exports.aliases = ["flip2"];

View File

@ -8,10 +8,10 @@ exports.run = async (message) => {
if (image === undefined) return `${message.author.mention}, you need to provide an image to add New Funky Mode!`;
const watermark = "./assets/images/funky.png";
const buffer = await gm(image.path).coalesce().out("null:").out(watermark).gravity("NorthEast").scale(null, "%[fx:u.h]").out("-layers", "composite").bufferPromise(image.type, image.delay);
return message.channel.createMessage("", {
return {
file: buffer,
name: `funky.${image.type}`
});
};
};
exports.aliases = ["funkymode", "newfunkymode", "funkykong"];

View File

@ -8,10 +8,10 @@ exports.run = async (message) => {
if (image === undefined) return `${message.author.mention}, you need to provide an image to make a GameXplain thumbnail meme!`;
const template = "./assets/images/gamexplain.png";
const buffer = await gm(template).background("white").out("null:").out("(").out(image.path).coalesce().out("-virtual-pixel", "transparent").scale("1181x571!").out(")").compose("over").gravity("Center").out("-geometry", "+0+40").out("-layers", "composite").bufferPromise(image.type, image.delay);
return message.channel.createMessage("", {
return {
file: buffer,
name: `gamexplain.${image.type}`
});
};
};
exports.aliases = ["gx"];

View File

@ -9,10 +9,10 @@ exports.run = async (message) => {
const data = `/tmp/${Math.random().toString(36).substring(2, 15)}.miff`;
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, image.delay);
return message.channel.createMessage("", {
return {
file: buffer,
name: `haah.${image.type}`
});
};
};
exports.aliases = ["magik4", "mirror2"];

View File

@ -29,7 +29,7 @@ exports.run = async (message, args) => {
}]
}
};
return message.channel.createMessage(embed);
return embed;
} else {
const categories = {
general: [],

View File

@ -8,10 +8,10 @@ exports.run = async (message, args) => {
const template = "./assets/images/hbc.png";
const cleanedMessage = args.join(" ").toLowerCase().replace(/\n/g, " ");
const buffer = await gm(template).gravity("Center").font("./assets/hbc.ttf").out("-kerning", "-5").fill("white").pointSize(96).drawText(0, 0, cleanedMessage).bufferPromise("png");
return message.channel.createMessage("", {
return {
file: buffer,
name: "homebrew.png"
});
};
};
exports.aliases = ["hbc", "brew", "wiibrew"];

View File

@ -11,10 +11,10 @@ exports.run = async (message) => {
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, image.delay);
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, image.delay);
return message.channel.createMessage("", {
return {
file: buffer,
name: `hooh.${image.type}`
});
};
};
exports.aliases = ["magik6", "mirror4"];

View File

@ -8,10 +8,10 @@ exports.run = async (message) => {
if (image === undefined) return `${message.author.mention}, you need to provide an image to add a Hypercam watermark!`;
const watermark = "./assets/images/hypercam.png";
const buffer = await gm(image.path).coalesce().out("null:").out(watermark).gravity("NorthWest").scale(null, "%[fx:u.h]").out("-layers", "composite").bufferPromise(image.type, image.delay);
return message.channel.createMessage("", {
return {
file: buffer,
name: `hypercam.${image.type}`
});
};
};
exports.aliases = ["hcam"];

View File

@ -8,10 +8,10 @@ exports.run = async (message) => {
if (image === undefined) return `${message.author.mention}, you need to provide an image to add a iFunny watermark!`;
const watermark = "./assets/images/ifunny.png";
const buffer = await gm(image.path).coalesce().extent("%[fx:u.w]", "%[fx:u.h+(42*min(u.w/1024,u.h/42))]").out("null:").out(watermark).gravity("South").scale("%[fx:u.w]", null).out("-layers", "composite").bufferPromise(image.type, image.delay);
return message.channel.createMessage("", {
return {
file: buffer,
name: `ifunny.${image.type}`
});
};
};
exports.category = 5;

View File

@ -7,10 +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 implode!`;
const buffer = await gm(image.path).implode([1]).bufferPromise(image.type, image.delay);
return message.channel.createMessage("", {
return {
file: buffer,
name: `implode.${image.type}`
});
};
};
exports.aliases = ["imp"];

View File

@ -1,7 +1,7 @@
const client = require("../utils/client.js");
const { version } = require("../package.json");
exports.run = async (message) => {
exports.run = async () => {
const dev = client.users.get(process.env.OWNER);
const artist = client.users.get("401980971517214723");
const infoEmbed = {
@ -43,7 +43,7 @@ exports.run = async (message) => {
]
}
};
return message.channel.createMessage(infoEmbed);
return infoEmbed;
};
exports.aliases = ["botinfo", "credits"];

View File

@ -7,10 +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 invert!`;
const buffer = await gm(image.path).coalesce().negative().bufferPromise(image.type, image.delay);
return message.channel.createMessage("", {
return {
file: buffer,
name: `invert.${image.type}`
});
};
};
exports.aliases = ["inverse", "negate", "negative"];

View File

@ -7,10 +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 add more JPEG!`;
const buffer = await gm(`${image.path}[0]`).quality(1).bufferPromise("jpg");
return message.channel.createMessage("", {
return {
file: buffer,
name: "jpeg.jpg"
});
};
};
exports.aliases = ["needsmorejpeg", "jpegify", "magik2", "morejpeg", "jpg"];

View File

@ -10,10 +10,10 @@ exports.run = async (message) => {
const template = "./assets/images/leak.png";
const buffer = await gm(template).out("-background").out("white").out("-gravity").out("Center").out("(").out("-clone").out("0").out("(").out(image.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").bufferPromise(image.type, image.delay);
// 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");
return message.channel.createMessage("", {
return {
file: buffer,
name: `leak.${image.type}`
});
};
};
exports.aliases = ["smash", "laxchris", "ssbu", "smashleak"];

View File

@ -9,10 +9,10 @@ exports.run = async (message) => {
const processMessage = await message.channel.createMessage("<a:processing:479351417102925854> Processing... This might take a while");
const resultBuffer = await gm(image.path).in("(").in("(").coalesce().scale(600, 600).out(")").out("-liquid-rescale", "300x300").out(")").out("-liquid-rescale", "800x800").bufferPromise(image.type, image.delay);
await processMessage.delete();
return message.channel.createMessage("", {
return {
file: resultBuffer,
name: `magik.${image.type}`
});
};
};
exports.aliases = ["imagemagic", "imagemagick", "imagemagik", "magic", "magick", "cas", "liquid"];

View File

@ -4,10 +4,10 @@ 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("+"))}`);
return message.channel.createMessage("", {
return {
file: await request.buffer(),
name: "mc.png"
});
};
};
exports.aliases = ["ach", "achievement", "minecraft"];

View File

@ -15,10 +15,10 @@ exports.run = async (message, args) => {
await gm(file).out("-size", "%[fx:u.w]").out("-delete", "0--1").background("none").gravity("Center").out("(", "(").font("Impact").out("-pointsize", 40).out(`pango:<span foreground='white'>${topText.toUpperCase().replace(/&/g, "\\&amp;").replace(/>/g, "\\&gt;").replace(/</g, "\\&lt;").replace(/"/g, "\\&quot;").replace(/'/g, "\\&apos;")}</span>`).out(")", "(", "+clone").out("-alpha", "extract").out("-morphology", "EdgeOut", "Octagon", "-background", "black", "-alpha", "shape", ")").compose("DstOver").out(")", "-composite").writePromise(file2);
if (bottomText) await gm(file).out("-size", "%[fx:u.w]").out("-delete", "0--1").background("none").gravity("Center").out("(", "(").font("Impact").out("-pointsize", 40).out(`pango:<span foreground='white'>${bottomText.toUpperCase().replace(/&/g, "\\&amp;").replace(/>/g, "\\&gt;").replace(/</g, "\\&lt;").replace(/"/g, "\\&quot;").replace(/'/g, "\\&apos;")}</span>`).out(")", "(", "+clone").out("-alpha", "extract").out("-morphology", "EdgeOut", "Octagon", "-background", "black", "-alpha", "shape", ")").compose("DstOver").out(")", "-composite").writePromise(file3);
const buffer = await gm(file).out("-coalesce").out("null:").gravity("North").out(file2).out("-layers", "composite").out("null:").gravity("South").out(bottomText ? file3 : "null:").out("-layers", "composite").bufferPromise(image.type, image.delay);
return message.channel.createMessage("", {
return {
file: buffer,
name: `meme.${image.type}`
});
};
};
exports.category = 5;

View File

@ -8,10 +8,10 @@ exports.run = async (message) => {
if (image === undefined) return `${message.author.mention}, you need to provide an image to add a MemeCenter watermark!`;
const watermark = "./assets/images/memecenter.png";
const output = await gm(image.path).coalesce().background("white").extent("%[fx:u.w]", "%[fx:u.h+15]").out("null:").out(watermark).gravity("SouthEast").compose("over").out("-layers", "composite").bufferPromise(image.type, image.delay);
return message.channel.createMessage("", {
return {
file: output,
name: `memecenter.${image.type}`
});
};
};
exports.aliases = ["memec", "mcenter"];

View File

@ -26,10 +26,10 @@ exports.run = async (message, args) => {
resultBuffer = await command2.bufferPromise(image.type, image.delay);
}
processMessage.delete();
return message.channel.createMessage("", {
return {
file: resultBuffer,
name: `motivate.${image.type}`
});
};
};
exports.aliases = ["motivational", "motiv", "demotiv", "demotivational", "poster"];

View File

@ -14,10 +14,10 @@ exports.run = async (message, args, content) => {
if (error) throw error;
});
writable.once("end", () => {
return message.channel.createMessage("", {
return {
file: Buffer.concat(chunks),
name: "qr.png"
});
};
});
};

View File

@ -13,10 +13,10 @@ exports.run = async (message, args) => {
} else {
text = new RetroText().setLine(2, line1).setBackgroundStyle("outlineTri").setTextStyle("chrome");
}
return message.channel.createMessage("", {
return {
file: await text.fetchBuffer(),
name: "retro.png"
});
};
};
exports.category = 4;

View File

@ -8,10 +8,10 @@ exports.run = async (message) => {
if (image === undefined) return `${message.author.mention}, you need to provide a GIF to reverse!`;
if (image.type !== "gif") return `${message.author.mention}, that isn't a GIF!`;
const buffer = await gm(image.path).coalesce().out("-reverse").bufferPromise(image.type, image.delay);
return message.channel.createMessage("", {
return {
file: buffer,
name: "reverse.gif"
});
};
};
exports.aliases = ["backwards"];

View File

@ -8,10 +8,10 @@ exports.run = async (message) => {
if (image === undefined) return `${message.author.mention}, you need to provide an image to make a Scott the Woz TV meme!`;
const template = "./assets/images/scott.png";
const buffer = await gm(template).out("null:").out("(").out(image.path).coalesce().out("-virtual-pixel", "transparent").resize("415x234!").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").bufferPromise(image.type, image.delay);
return message.channel.createMessage("", {
return {
file: buffer,
name: `scott.${image.type}`
});
};
};
exports.aliases = ["woz", "tv", "porn"];

View File

@ -19,10 +19,10 @@ exports.run = async (message, args) => {
await page.goto(url);
const screenshot = await page.screenshot();
await page.close();
return message.channel.createMessage("", {
return {
file: screenshot,
name: "screenshot.png"
});
};
};
exports.aliases = ["webshot", "ss", "shot", "page"];

View File

@ -39,7 +39,7 @@ exports.run = async (message) => {
]
}
};
return message.channel.createMessage(infoEmbed);
return infoEmbed;
};
exports.aliases = ["server"];

View File

@ -7,10 +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 sharpen!`;
const buffer = await gm(image.path).coalesce().sharpen(10).bufferPromise(image.type, image.delay);
return message.channel.createMessage("", {
return {
file: buffer,
name: `sharpen.${image.type}`
});
};
};

View File

@ -8,10 +8,10 @@ exports.run = async (message) => {
if (image === undefined) return `${message.author.mention}, you need to provide an image to add a Shutterstock watermark!`;
const watermark = "./assets/images/shutterstock.png";
const buffer = await gm(image.path).coalesce().out("null:").out(watermark).gravity("Center").scale(null, "%[fx:u.h]").out("-layers", "composite").bufferPromise(image.type, image.delay);
return message.channel.createMessage("", {
return {
file: buffer,
name: `shutterstock.${image.type}`
});
};
};
exports.aliases = ["stock", "stockphoto"];

View File

@ -10,10 +10,10 @@ exports.run = async (message) => {
const value = await gm(image.path).identifyPromise();
const delay = value.Delay ? value.Delay[0].split("x") : [0, 100];
const buffer = await gm().delay(`${parseInt(delay[0]) * 2}x${delay[1]}`).out(image.path).bufferPromise(image.type, image.delay);
return message.channel.createMessage("", {
return {
file: buffer,
name: "slow.gif"
});
};
};
exports.aliases = ["slowdown", "slower", "gifspeed2"];

View File

@ -11,10 +11,10 @@ exports.run = async (message, args) => {
const cleanedMessage = args.join(" ").replace(/&/g, "\\&amp;").replace(/>/g, "\\&gt;").replace(/</g, "\\&lt;").replace(/"/g, "\\&quot;").replace(/'/g, "\\&apos;");
await 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>`).writePromise(file);
const buffer = await gm(template).composite(file).gravity("Center").geometry("474x332+160+10").bufferPromise("png", null, "sonic");
return message.channel.createMessage("", {
return {
file: buffer,
name: "sonic.png"
});
};
};
exports.category = 4;

View File

@ -15,18 +15,18 @@ exports.run = async (message) => {
const delay = value.Delay ? value.Delay[0].split("x") : [0, 100];
if (Math.round(parseInt(delay[0]) / 2) >= 2) {
const buffer = await gm().delay(`${parseInt(delay[0]) / 2}x${delay[1]}`).out(image.path).bufferPromise(image.type, image.delay);
return message.channel.createMessage("", {
return {
file: buffer,
name: "speed.gif"
});
};
} else {
if (!value.Scene) return `${message.author.mention}, that GIF is already too fast!`;
const numbers = (await util.promisify(exec)(`seq 0 2 ${value.Scene.length}`)).stdout.split("\n").join(",");
const buffer = await gm().out("(").out(image.path).coalesce().out(")").out("-delete", numbers).bufferPromise(image.type, image.delay);
return message.channel.createMessage("", {
return {
file: buffer,
name: "speed.gif"
});
};
}
};

View File

@ -8,10 +8,10 @@ exports.run = async (message) => {
const processMessage = await message.channel.createMessage("<a:processing:479351417102925854> Processing... This might take a while");
const resultBuffer = await gm(image.path).coalesce().out("-duplicate", "29").scale("256x256>").scale("256x256<").background("white").virtualPixel("background").out("-rotate", "%[fx:360*t/n]").set("delay", "5").set("dispose", "background").out("-loop", "0").bufferPromise("gif");
await processMessage.delete();
return message.channel.createMessage("", {
return {
file: resultBuffer,
name: "spin.gif"
});
};
};
exports.aliases = ["rotate"];

View File

@ -41,7 +41,7 @@ exports.run = async (message) => {
]
}
};
return message.channel.createMessage(embed);
return embed;
};
exports.aliases = ["status", "stat"];

View File

@ -7,10 +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 stretch!`;
const buffer = await gm(image.path).coalesce().resize("512x512!").bufferPromise(image.type, image.delay);
return message.channel.createMessage("", {
return {
file: buffer,
name: `stretch.${image.type}`
});
};
};
exports.aliases = ["aspect", "ratio", "aspect43", "43"];

View File

@ -7,10 +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 swirl!`;
const buffer = await gm(image.path).coalesce().swirl(180).bufferPromise(image.type, image.delay);
return message.channel.createMessage("", {
return {
file: buffer,
name: `swirl.${image.type}`
});
};
};
exports.aliases = ["whirlpool"];

View File

@ -8,10 +8,10 @@ exports.run = async (message) => {
if (image === undefined) return `${message.author.mention}, you need to provide an image to tile!`;
const output = await gm(image.path).coalesce().command("montage").out("-duplicate").out(24).tile("5x5").geometry("+0+0").streamPromise("miff");
const buffer = await gm(output).coalesce().resize("800x800>").bufferPromise(image.type, image.delay);
return message.channel.createMessage("", {
return {
file: buffer,
name: `tile.${image.type}`
});
};
};
exports.aliases = ["wall2"];

View File

@ -8,10 +8,10 @@ exports.run = async (message) => {
if (image === undefined) return `${message.author.mention}, you need to provide an image to make a Trump meme!`;
const template = "./assets/images/trump.png";
const buffer = await gm(template).background("white").out("null:").out("(").out(image.path).coalesce().out("-virtual-pixel", "transparent").resize("365x179!").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").bufferPromise(image.type, image.delay);
return message.channel.createMessage("", {
return {
file: buffer,
name: `trump.${image.type}`
});
};
};
exports.category = 5;

View File

@ -55,7 +55,7 @@ exports.run = async (message, args) => {
]
}
};
return message.channel.createMessage(infoEmbed);
return infoEmbed;
};
exports.aliases = ["user"];

View File

@ -13,10 +13,10 @@ exports.run = async (message) => {
await gm(data2).flop().writePromise(data);
// const buffer = await gm(data2).extent("%[fx:u.w*2]", "%[fx:u.h]").out("null:").out(data).gravity("West").out("-layers", "Composite").bufferPromise(image.type, image.delay);
const buffer = await gm(data2).extent(size.width, size.height).out("null:").out(data).geometry(`+${size.width / 2}+0`).out("-layers", "Composite").bufferPromise(image.type, image.delay);
return message.channel.createMessage("", {
return {
file: buffer,
name: `waaw.${image.type}`
});
};
};
exports.aliases = ["magik3", "mirror"];

View File

@ -8,10 +8,10 @@ exports.run = async (message) => {
if (image === undefined) return `${message.author.mention}, you need to provide an image to make a wall from!`;
const output = await gm(image.path).coalesce().resize(128).streamPromise("miff");
const buffer = await gm(output).coalesce().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").bufferPromise(image.type, image.delay);
return message.channel.createMessage("", {
return {
file: buffer,
name: `wall.${image.type}`
});
};
};
exports.category = 5;

View File

@ -8,10 +8,10 @@ exports.run = async (message) => {
if (image === undefined) return `${message.author.mention}, you need to provide an image to make a "who did this" meme!`;
const template = "./assets/images/whodidthis.png";
const buffer = await gm(template).out("null:").out("(").out(image.path).coalesce().out(")").gravity("Center").resize("374x374>").out("-layers", "composite").bufferPromise(image.type, image.delay);
return message.channel.createMessage("", {
return {
file: buffer,
name: `wdt.${image.type}`
});
};
};
exports.aliases = ["whodidthis"];

View File

@ -7,10 +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 stretch!`;
const buffer = await gm(image.path).coalesce().resize("%[fx:(u.w*19)/2]x%[fx:u.h/2]!").bufferPromise(image.type, image.delay);
return message.channel.createMessage("", {
return {
file: buffer,
name: `wide.${image.type}`
});
};
};
exports.aliases = ["w19", "wide19"];

View File

@ -11,10 +11,10 @@ exports.run = async (message) => {
const json = await request.json();
const image = await fetch(json["1"]);
const imageBuffer = await image.buffer();
return message.channel.createMessage("", {
return {
file: imageBuffer,
name: json["1"].split("/")[json["1"].split("/").length - 1]
});
};
};
exports.aliases = ["wiki"];

View File

@ -11,10 +11,10 @@ exports.run = async (message) => {
await gm(image.path).coalesce().gravity("North").crop(0, "50%").out("+repage").writePromise(data2);
await gm(data2).flip().writePromise(data);
const buffer = await gm(data2).extent("%[fx:u.w]", "%[fx:u.h*2]").out("null:").out(data).gravity("South").out("-layers", "Composite").bufferPromise(image.type, image.delay);
return message.channel.createMessage("", {
return {
file: buffer,
name: `woow.${image.type}`
});
};
};
exports.aliases = ["magik5", "mirror3"];

View File

@ -16,7 +16,7 @@ exports.run = async (message, args) => {
}
}
};
return message.channel.createMessage(embed);
return embed;
} catch (e) {
return `${message.author.mention}, I couldn't get that XKCD!`;
}

View File

@ -38,8 +38,10 @@ module.exports = async (message) => {
logger.log("info", `${message.author.username} (${message.author.id}) ran command ${command}`);
try {
const result = await cmd(message, args, content.replace(command, "").trim()); // we also provide the message content as a parameter for cases where we need more accuracy
if (typeof result === "string") {
if (typeof result === "string" || (typeof result === "object" && result.embed)) {
await client.createMessage(message.channel.id, result);
} else if (typeof result === "object" && result.file) {
await client.createMessage(message.channel.id, result.text ? result.text : "", result);
}
} catch (error) {
if (!error.toString().includes("Request entity too large")) {

View File

@ -72,7 +72,7 @@ module.exports = async () => {
type !== "sonic" ? "-layers" : "",
type !== "sonic" ? "OptimizeTransparency" : ""
)
.out("-fuzz", "2%")
.out(type !== "sonic" ? "-fuzz" : "", type !== "sonic" ? "2%" : "")
.out("-limit", "memory", "64MB")
.out("-limit", "map", "128MB")
.stream(format, (err, stdout, stderr) => {

View File

@ -16,7 +16,6 @@ const client = new Client(process.env.TOKEN, {
TYPING_START: true,
USER_UPDATE: true
},
maxShards: "auto",
opusOnly: true
maxShards: "auto"
});
module.exports = client;