Ported homebrew, fixed explode

This commit is contained in:
TheEssem 2020-07-21 09:03:08 -05:00
parent 264bcf5425
commit bf19e24063
5 changed files with 64 additions and 7 deletions

View file

@ -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 explode!`;
const buffer = await promisify(magick.explode)(image.path, image.type.toUpperCase(), image.delay ? (100 / image.delay.split("/")[0]) * image.delay.split("/")[1] : 0);
const buffer = await promisify(magick.explode)(image.path, -1, image.type.toUpperCase(), image.delay ? (100 / image.delay.split("/")[0]) * image.delay.split("/")[1] : 0);
return {
file: buffer,
name: `explode.${image.type}`

View file

@ -1,13 +1,11 @@
const gm = require("gm").subClass({
imageMagick: true
});
const magick = require("../build/Release/image.node");
const { promisify } = require("util");
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 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");
//const buffer = await gm(template).gravity("Center").font("./assets/hbc.ttf").out("-kerning", "-5").fill("white").pointSize(96).drawText(0, 0, cleanedMessage).bufferPromise("png");
const buffer = await promisify(magick.homebrew)(args.join(" ").toLowerCase().replace(/\n/g, " "));
return {
file: buffer,
name: "homebrew.png"