Ported more commands to Magick++, cleaned up a bit
This commit is contained in:
parent
bdb15aee3f
commit
bf14371b52
22 changed files with 217 additions and 99 deletions
|
@ -5,7 +5,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 promisify(magick.nineGag)(image.path, image.type.toUpperCase(), image.delay ? (100 / image.delay.split("/")[0]) * image.delay.split("/")[1] : 0);
|
||||
const buffer = await promisify(magick.watermark)(image.path, "./assets/images/9gag.png", 6, false, image.type.toUpperCase(), image.delay ? (100 / image.delay.split("/")[0]) * image.delay.split("/")[1] : 0);
|
||||
return {
|
||||
file: buffer,
|
||||
name: `9gag.${image.type}`
|
||||
|
|
|
@ -5,7 +5,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 promisify(magick.bandicam)(image.path, image.type.toUpperCase(), image.delay ? (100 / image.delay.split("/")[0]) * image.delay.split("/")[1] : 0);
|
||||
const buffer = await promisify(magick.watermark)(image.path, "./assets/images/bandicam.png", 2, true, image.type.toUpperCase(), image.delay ? (100 / image.delay.split("/")[0]) * image.delay.split("/")[1] : 0);
|
||||
return {
|
||||
file: buffer,
|
||||
name: `bandicam.${image.type}`
|
||||
|
|
|
@ -5,7 +5,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 promisify(magick.deviantart)(image.path, image.type.toUpperCase(), image.delay ? (100 / image.delay.split("/")[0]) * image.delay.split("/")[1] : 0);
|
||||
const buffer = await promisify(magick.watermark)(image.path, "./assets/images/deviantart.png", 5, true, image.type.toUpperCase(), image.delay ? (100 / image.delay.split("/")[0]) * image.delay.split("/")[1] : 0);
|
||||
return {
|
||||
file: buffer,
|
||||
name: `deviantart.${image.type}`
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
const gm = require("gm").subClass({
|
||||
imageMagick: true
|
||||
});
|
||||
const magick = require("../build/Release/image.node");
|
||||
const { promisify } = require("util");
|
||||
const emojiRegex = require("emoji-regex");
|
||||
const emoji = require("node-emoji");
|
||||
|
||||
|
@ -12,7 +11,7 @@ exports.run = async (message, args) => {
|
|||
const flag = emoji.unemojify(args[0]).replace(/:/g, "").replace("flag-", "");
|
||||
let path = `./assets/images/region-flags/png/${flag.toUpperCase()}.png`;
|
||||
if (flag === "🏴☠️") path = "./assets/images/pirateflag.png";
|
||||
const buffer = await gm(image.path).coalesce().out("null:").out("(", path, "-alpha", "set", "-channel", "A", "-evaluate", "multiply", "0.5", "+channel", ")").gravity("North").scale("%[fx:u.w]x%[fx:u.h]!").out("-layers", "composite").bufferPromise(image.type, image.delay);
|
||||
const buffer = await promisify(magick.flag)(image.path, path, image.type.toUpperCase(), image.delay ? (100 / image.delay.split("/")[0]) * image.delay.split("/")[1] : 0);
|
||||
return {
|
||||
file: buffer,
|
||||
name: `flag.${image.type}`
|
||||
|
|
|
@ -1,12 +1,11 @@
|
|||
const gm = require("gm").subClass({
|
||||
imageMagick: true
|
||||
});
|
||||
const magick = require("../build/Release/image.node");
|
||||
const { promisify } = require("util");
|
||||
|
||||
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 gm(image.path).flip().bufferPromise(image.type, image.delay);
|
||||
const buffer = await promisify(magick.flip)(image.path, image.type.toUpperCase(), image.delay ? (100 / image.delay.split("/")[0]) * image.delay.split("/")[1] : 0);
|
||||
return {
|
||||
file: buffer,
|
||||
name: `flip.${image.type}`
|
||||
|
|
|
@ -1,12 +1,11 @@
|
|||
const gm = require("gm").subClass({
|
||||
imageMagick: true
|
||||
});
|
||||
const magick = require("../build/Release/image.node");
|
||||
const { promisify } = require("util");
|
||||
|
||||
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 gm(image.path).flop().bufferPromise(image.type, image.delay);
|
||||
const buffer = await promisify(magick.flop)(image.path, image.type.toUpperCase(), image.delay ? (100 / image.delay.split("/")[0]) * image.delay.split("/")[1] : 0);
|
||||
return {
|
||||
file: buffer,
|
||||
name: `flop.${image.type}`
|
||||
|
|
|
@ -1,13 +1,12 @@
|
|||
const gm = require("gm").subClass({
|
||||
imageMagick: true
|
||||
});
|
||||
const magick = require("../build/Release/image.node");
|
||||
const { promisify } = require("util");
|
||||
|
||||
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 a GIF to freeze!`;
|
||||
if (image.type !== "gif") return `${message.author.mention}, that isn't a GIF!`;
|
||||
const buffer = await gm(image.path).loop(1).bufferPromise(image.type, image.delay);
|
||||
const buffer = await promisify(magick.freeze)(image.path, image.type.toUpperCase(), image.delay ? (100 / image.delay.split("/")[0]) * image.delay.split("/")[1] : 0);
|
||||
return {
|
||||
file: buffer,
|
||||
name: `freeze.${image.type}`
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue