Simplified and fixed image API, updated packages

This commit is contained in:
TheEssem 2020-10-06 14:48:22 -05:00
parent f1404a8393
commit ac4e1f5dd8
55 changed files with 135 additions and 161 deletions

View file

@ -4,7 +4,7 @@ exports.run = async (message) => {
message.channel.sendTyping();
const image = await require("../utils/imagedetect.js")(message);
if (image === undefined) return `${message.author.mention}, you need to provide an image to add a 9GAG watermark!`;
const buffer = await magick({
const buffer = await magick.run({
cmd: "watermark",
path: image.path,
water: "./assets/images/9gag.png",

View file

@ -4,7 +4,7 @@ exports.run = async (message) => {
message.channel.sendTyping();
const image = await require("../utils/imagedetect.js")(message);
if (image === undefined) return `${message.author.mention}, you need to provide an image to add a Bandicam watermark!`;
const buffer = await magick({
const buffer = await magick.run({
cmd: "watermark",
path: image.path,
water: "./assets/images/bandicam.png",

View file

@ -4,7 +4,7 @@ exports.run = async (message) => {
message.channel.sendTyping();
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 magick({
const buffer = await magick.run({
cmd: "blur",
path: image.path,
sharp: false,

View file

@ -4,7 +4,7 @@ exports.run = async (message) => {
message.channel.sendTyping();
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 magick({
const buffer = await magick.run({
cmd: "blurple",
path: image.path,
type: image.type.toUpperCase(),

View file

@ -6,7 +6,7 @@ exports.run = async (message, args) => {
const newArgs = args.filter(item => !item.includes(image.url) );
if (args.length === 0) return `${message.author.mention}, you need to provide some text to add a caption!`;
const processMessage = await message.channel.createMessage("<a:processing:479351417102925854> Processing... This might take a while");
const outputFinal = await magick({
const outputFinal = await magick.run({
cmd: "caption",
path: image.path,
caption: newArgs.join(" "),

View file

@ -6,7 +6,7 @@ exports.run = async (message, args) => {
if (image === undefined) return `${message.author.mention}, you need to provide an image/GIF to add a caption!`;
const newArgs = args.filter(item => !item.includes(image.url) );
const processMessage = await message.channel.createMessage("<a:processing:479351417102925854> Processing... This might take a while");
const outputFinal = await magick({
const outputFinal = await magick.run({
cmd: "captionTwo",
path: image.path,
caption: newArgs.length !== 0 ? newArgs.join(" ") : words.sort(() => 0.5 - Math.random()).slice(0, Math.floor(Math.random() * words.length + 1)).join(" "),

View file

@ -4,7 +4,7 @@ exports.run = async (message) => {
message.channel.sendTyping();
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 magick({
const buffer = await magick.run({
cmd: "circle",
path: image.path,
type: image.type.toUpperCase(),

View file

@ -4,7 +4,7 @@ exports.run = async (message) => {
message.channel.sendTyping();
const image = await require("../utils/imagedetect.js")(message);
if (image === undefined) return `${message.author.mention}, you need to provide an image to crop!`;
const buffer = await magick({
const buffer = await magick.run({
cmd: "crop",
path: image.path,
type: image.type.toUpperCase(),

View file

@ -4,7 +4,7 @@ exports.run = async (message) => {
message.channel.sendTyping();
const image = await require("../utils/imagedetect.js")(message);
if (image === undefined) return `${message.author.mention}, you need to provide an image to add a DeviantArt watermark!`;
const buffer = await magick({
const buffer = await magick.run({
cmd: "watermark",
path: image.path,
water: "./assets/images/deviantart.png",

View file

@ -4,7 +4,7 @@ exports.run = async (message) => {
message.channel.sendTyping();
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 magick({
const buffer = await magick.run({
cmd: "explode",
path: image.path,
amount: -1,

View file

@ -19,7 +19,7 @@ exports.run = async (message, args) => {
} catch (e) {
return `${message.author.mention}, that isn't a flag!`;
}
const buffer = await magick({
const buffer = await magick.run({
cmd: "flag",
path: image.path,
overlay: path,

View file

@ -4,7 +4,7 @@ exports.run = async (message) => {
message.channel.sendTyping();
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 magick({
const buffer = await magick.run({
cmd: "flip",
path: image.path,
type: image.type.toUpperCase(),

View file

@ -4,7 +4,7 @@ exports.run = async (message) => {
message.channel.sendTyping();
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 magick({
const buffer = await magick.run({
cmd: "flip",
path: image.path,
flop: true,

View file

@ -5,7 +5,7 @@ exports.run = async (message) => {
const image = await require("../utils/imagedetect.js")(message);
if (image === undefined) return `${message.author.mention}, you need to provide a GIF to freeze!`;
if (image.type !== "gif") return `${message.author.mention}, that isn't a GIF!`;
const buffer = await magick({
const buffer = await magick.run({
cmd: "freeze",
path: image.path,
loop: false,

View file

@ -4,7 +4,7 @@ exports.run = async (message) => {
message.channel.sendTyping();
const image = await require("../utils/imagedetect.js")(message);
if (image === undefined) return `${message.author.mention}, you need to provide an image to add New Funky Mode!`;
const buffer = await magick({
const buffer = await magick.run({
cmd: "watermark",
path: image.path,
water: "./assets/images/funky.png",

View file

@ -4,7 +4,7 @@ exports.run = async (message) => {
message.channel.sendTyping();
const image = await require("../utils/imagedetect.js")(message);
if (image === undefined) return `${message.author.mention}, you need to provide an image to make a GameXplain thumbnail meme!`;
const buffer = await magick({
const buffer = await magick.run({
cmd: "gamexplain",
path: image.path,
type: image.type.toUpperCase(),

View file

@ -4,7 +4,7 @@ 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 spin!`;
const processMessage = await message.channel.createMessage("<a:processing:479351417102925854> Processing... This might take a while");
const buffer = await magick({
const buffer = await magick.run({
cmd: "globe",
path: image.path,
type: image.type.toUpperCase(),

View file

@ -4,7 +4,7 @@ exports.run = async (message) => {
message.channel.sendTyping();
const image = await require("../utils/imagedetect.js")(message);
if (image === undefined) return `${message.author.mention}, you need to provide an image to mirror!`;
const buffer = await magick({
const buffer = await magick.run({
cmd: "mirror",
path: image.path,
first: true,

View file

@ -3,7 +3,7 @@ const magick = require("../utils/image.js");
exports.run = async (message, args) => {
if (args.length === 0) return `${message.author.mention}, you need to provide some text to make a Homebrew Channel edit!`;
message.channel.sendTyping();
const buffer = await magick({
const buffer = await magick.run({
cmd: "homebrew",
caption: args.join(" ").toLowerCase().replace(/\n/g, " ")
});

View file

@ -4,7 +4,7 @@ exports.run = async (message) => {
message.channel.sendTyping();
const image = await require("../utils/imagedetect.js")(message);
if (image === undefined) return `${message.author.mention}, you need to provide an image to mirror!`;
const buffer = await magick({
const buffer = await magick.run({
cmd: "mirror",
path: image.path,
vertical: true,

View file

@ -4,7 +4,7 @@ exports.run = async (message) => {
message.channel.sendTyping();
const image = await require("../utils/imagedetect.js")(message);
if (image === undefined) return `${message.author.mention}, you need to provide an image to add a Hypercam watermark!`;
const buffer = await magick({
const buffer = await magick.run({
cmd: "watermark",
path: image.path,
water: "./assets/images/hypercam.png",

View file

@ -4,7 +4,7 @@ exports.run = async (message) => {
message.channel.sendTyping();
const image = await require("../utils/imagedetect.js")(message);
if (image === undefined) return `${message.author.mention}, you need to provide an image to add a iFunny watermark!`;
const buffer = await magick({
const buffer = await magick.run({
cmd: "watermark",
path: image.path,
water: "./assets/images/ifunny.png",

View file

@ -4,7 +4,7 @@ exports.run = async (message) => {
message.channel.sendTyping();
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 magick({
const buffer = await magick.run({
cmd: "explode",
path: image.path,
amount: 1,

View file

@ -4,7 +4,7 @@ exports.run = async (message) => {
message.channel.sendTyping();
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 magick({
const buffer = await magick.run({
cmd: "invert",
path: image.path,
type: image.type.toUpperCase(),

View file

@ -4,7 +4,7 @@ exports.run = async (message) => {
message.channel.sendTyping();
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 magick({
const buffer = await magick.run({
cmd: "jpeg",
path: image.path
});

View file

@ -4,7 +4,7 @@ exports.run = async (message) => {
message.channel.sendTyping();
const image = await require("../utils/imagedetect.js")(message);
if (image === undefined) return `${message.author.mention}, you need to provide an image to make a Super Smash Bros. leak meme!`;
const buffer = await magick({
const buffer = await magick.run({
cmd: "leak",
path: image.path,
type: image.type.toUpperCase(),

View file

@ -5,7 +5,7 @@ exports.run = async (message) => {
const image = await require("../utils/imagedetect.js")(message);
if (image === undefined) return `${message.author.mention}, you need to provide a GIF to loop!`;
if (image.type !== "gif") return `${message.author.mention}, that isn't a GIF!`;
const buffer = await magick({
const buffer = await magick.run({
cmd: "freeze",
path: image.path,
loop: true,

View file

@ -4,7 +4,7 @@ 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 some magik!`;
const processMessage = await message.channel.createMessage("<a:processing:479351417102925854> Processing... This might take a while");
const buffer = await magick({
const buffer = await magick.run({
cmd: "magik",
path: image.path,
type: image.type.toUpperCase(),

View file

@ -7,7 +7,7 @@ exports.run = async (message, args) => {
const newArgs = args.filter(item => !item.includes(image.url) );
if (args.length === 0) return `${message.author.mention}, you need to provide some text to generate a meme!`;
const [topText, bottomText] = newArgs.join(" ").split(/(?<!\\),/).map(elem => elem.trim());
const buffer = await magick({
const buffer = await magick.run({
cmd: "meme",
path: image.path,
top: topText.toUpperCase().replace(/&/g, "\\&amp;").replace(/>/g, "\\&gt;").replace(/</g, "\\&lt;").replace(/"/g, "\\&quot;").replace(/'/g, "\\&apos;"),

View file

@ -4,7 +4,7 @@ exports.run = async (message) => {
message.channel.sendTyping();
const image = await require("../utils/imagedetect.js")(message);
if (image === undefined) return `${message.author.mention}, you need to provide an image to add a MemeCenter watermark!`;
const buffer = await magick({
const buffer = await magick.run({
cmd: "watermark",
path: image.path,
water: "./assets/images/memecenter.png",

View file

@ -7,7 +7,7 @@ exports.run = async (message, args) => {
if (args.length === 0) return `${message.author.mention}, you need to provide some text to make a motivational poster!`;
const processMessage = await message.channel.createMessage("<a:processing:479351417102925854> Processing... This might take a while");
const [topText, bottomText] = newArgs.join(" ").split(/(?<!\\),/).map(elem => elem.trim());
const buffer = await magick({
const buffer = await magick.run({
cmd: "motivate",
path: image.path,
top: topText.replace(/&/g, "\\&amp;").replace(/>/g, "\\&gt;").replace(/</g, "\\&lt;").replace(/"/g, "\\&quot;").replace(/'/g, "\\&apos;"),

View file

@ -4,7 +4,7 @@ exports.run = async (message) => {
message.channel.sendTyping();
const image = await require("../utils/imagedetect.js")(message);
if (image === undefined) return `${message.author.mention}, you need to provide an image to pixelate!`;
const buffer = await magick({
const buffer = await magick.run({
cmd: "resize",
path: image.path,
type: image.type.toUpperCase(),

View file

@ -5,7 +5,7 @@ exports.run = async (message) => {
const image = await require("../utils/imagedetect.js")(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 magick({
const buffer = await magick.run({
cmd: "reverse",
path: image.path,
delay: image.delay ? (100 / image.delay.split("/")[0]) * image.delay.split("/")[1] : 0

View file

@ -4,7 +4,7 @@ exports.run = async (message) => {
message.channel.sendTyping();
const image = await require("../utils/imagedetect.js")(message);
if (image === undefined) return `${message.author.mention}, you need to provide an image to make a Scott the Woz TV meme!`;
const buffer = await magick({
const buffer = await magick.run({
cmd: "scott",
path: image.path,
type: image.type.toUpperCase(),

View file

@ -4,7 +4,7 @@ exports.run = async (message) => {
message.channel.sendTyping();
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 magick({
const buffer = await magick.run({
cmd: "sharpen",
path: image.path,
sharp: true,

View file

@ -4,7 +4,7 @@ exports.run = async (message) => {
message.channel.sendTyping();
const image = await require("../utils/imagedetect.js")(message);
if (image === undefined) return `${message.author.mention}, you need to provide an image to add a Shutterstock watermark!`;
const buffer = await magick({
const buffer = await magick.run({
cmd: "watermark",
path: image.path,
water: "./assets/images/shutterstock.png",

View file

@ -6,7 +6,7 @@ exports.run = async (message) => {
const image = await require("../utils/imagedetect.js")(message);
if (image === undefined) return `${message.author.mention}, you need to provide a GIF to slow down!`;
if (image.type !== "gif") return `${message.author.mention}, that isn't a GIF!`;
const buffer = await magick({
const buffer = await magick.run({
cmd: "speed",
path: image.path,
slow: true,

View file

@ -5,7 +5,7 @@ exports.run = async (message, args) => {
if (args.length === 0) return `${message.author.mention}, you need to provide some text to make a Sonic meme!`;
message.channel.sendTyping();
const cleanedMessage = args.join(" ").replace(/&/g, "\\&amp;").replace(/>/g, "\\&gt;").replace(/</g, "\\&lt;").replace(/"/g, "\\&quot;").replace(/'/g, "\\&apos;");
const buffer = await magick({
const buffer = await magick.run({
cmd: "sonic",
text: wrap(cleanedMessage, {width: 15, indent: ""})
});

View file

@ -5,7 +5,7 @@ exports.run = async (message) => {
const image = await require("../utils/imagedetect.js")(message);
if (image === undefined) return `${message.author.mention}, you need to provide a GIF to loop!`;
if (image.type !== "gif") return `${message.author.mention}, that isn't a GIF!`;
const buffer = await magick({
const buffer = await magick.run({
cmd: "reverse",
path: image.path,
soos: true,

View file

@ -5,7 +5,7 @@ exports.run = async (message) => {
const image = await require("../utils/imagedetect.js")(message);
if (image === undefined) return `${message.author.mention}, you need to provide a GIF to speed up!`;
if (image.type !== "gif") return `${message.author.mention}, that isn't a GIF!`;
const buffer = await magick({
const buffer = await magick.run({
cmd: "speed",
path: image.path,
type: image.type.toUpperCase(),

View file

@ -4,7 +4,7 @@ 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 spin!`;
const processMessage = await message.channel.createMessage("<a:processing:479351417102925854> Processing... This might take a while");
const buffer = await magick({
const buffer = await magick.run({
cmd: "spin",
path: image.path,
type: image.type.toUpperCase(),

View file

@ -4,7 +4,7 @@ exports.run = async (message) => {
message.channel.sendTyping();
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 magick({
const buffer = await magick.run({
cmd: "resize",
path: image.path,
stretch: true,

View file

@ -4,7 +4,7 @@ exports.run = async (message) => {
message.channel.sendTyping();
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 magick({
const buffer = await magick.run({
cmd: "swirl",
path: image.path,
type: image.type.toUpperCase(),

View file

@ -4,7 +4,7 @@ exports.run = async (message) => {
message.channel.sendTyping();
const image = await require("../utils/imagedetect.js")(message);
if (image === undefined) return `${message.author.mention}, you need to provide an image to tile!`;
const buffer = await magick({
const buffer = await magick.run({
cmd: "tile",
path: image.path,
type: image.type.toUpperCase(),

View file

@ -4,7 +4,7 @@ exports.run = async (message) => {
message.channel.sendTyping();
const image = await require("../utils/imagedetect.js")(message);
if (image === undefined) return `${message.author.mention}, you need to provide an image to make a Trump meme!`;
const buffer = await magick({
const buffer = await magick.run({
cmd: "trump",
path: image.path,
type: image.type.toUpperCase(),

View file

@ -4,7 +4,7 @@ exports.run = async (message) => {
message.channel.sendTyping();
const image = await require("../utils/imagedetect.js")(message);
if (image === undefined) return `${message.author.mention}, you need to provide an image to mirror!`;
const buffer = await magick({
const buffer = await magick.run({
cmd: "mirror",
path: image.path,
type: image.type.toUpperCase(),

View file

@ -4,7 +4,7 @@ exports.run = async (message) => {
message.channel.sendTyping();
const image = await require("../utils/imagedetect.js")(message);
if (image === undefined) return `${message.author.mention}, you need to provide an image to make a wall from!`;
const buffer = await magick({
const buffer = await magick.run({
cmd: "wall",
path: image.path,
type: image.type.toUpperCase(),

View file

@ -4,7 +4,7 @@ exports.run = async (message) => {
message.channel.sendTyping();
const image = await require("../utils/imagedetect.js")(message);
if (image === undefined) return `${message.author.mention}, you need to provide an image to make a "who did this" meme!`;
const buffer = await magick({
const buffer = await magick.run({
cmd: "wdt",
path: image.path,
type: image.type.toUpperCase(),

View file

@ -4,7 +4,7 @@ exports.run = async (message) => {
message.channel.sendTyping();
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 magick({
const buffer = await magick.run({
cmd: "resize",
path: image.path,
wide: true,

View file

@ -4,7 +4,7 @@ exports.run = async (message) => {
message.channel.sendTyping();
const image = await require("../utils/imagedetect.js")(message);
if (image === undefined) return `${message.author.mention}, you need to provide an image to mirror!`;
const buffer = await magick({
const buffer = await magick.run({
cmd: "mirror",
path: image.path,
vertical: true,