Added donate, made blur and sharpen use ImageMagick

This commit is contained in:
TheEssem 2020-02-10 19:49:35 -06:00
parent 97f2f38d47
commit c745bd3ae2
4 changed files with 24 additions and 8 deletions

View file

@ -1,10 +1,14 @@
const sharp = require("sharp"); const gm = require("gm").subClass({
imageMagick: true
});
const gmToBuffer = require("../utils/gmbuffer.js");
exports.run = async (message) => { exports.run = async (message) => {
message.channel.sendTyping(); message.channel.sendTyping();
const image = await require("../utils/imagedetect.js")(message); const image = await require("../utils/imagedetect.js")(message);
if (image === undefined) return `${message.author.mention}, you need to provide an image to blur!`; if (image === undefined) return `${message.author.mention}, you need to provide an image to blur!`;
const resultBuffer = await sharp(image.data).blur(5).toBuffer(); const command = gm(image.data).blur(10);
const resultBuffer = await gmToBuffer(command);
return message.channel.createMessage("", { return message.channel.createMessage("", {
file: resultBuffer, file: resultBuffer,
name: `blur.${image.type}` name: `blur.${image.type}`

8
commands/donate.js Normal file
View file

@ -0,0 +1,8 @@
exports.run = async () => {
return "Like esmBot? Consider supporting the developer on Patreon to help keep it running! https://patreon.com/TheEssem";
};
exports.aliases = ["support", "patreon", "patrons"];
exports.category = 1;
exports.help = "Learn more about how you can support esmBot's development";

View file

@ -1,13 +1,17 @@
const sharp = require("sharp"); const gm = require("gm").subClass({
imageMagick: true
});
const gmToBuffer = require("../utils/gmbuffer.js");
exports.run = async (message) => { exports.run = async (message) => {
message.channel.sendTyping(); message.channel.sendTyping();
const image = await require("../utils/imagedetect.js")(message); const image = await require("../utils/imagedetect.js")(message);
if (image === undefined) return `${message.author.mention}, you need to provide an image to sharpen!`; if (image === undefined) return `${message.author.mention}, you need to provide an image to sharpen!`;
const resultBuffer = await sharp(image.data).sharpen(5).toBuffer(); const command = gm(image.data).sharpen(10);
const resultBuffer = await gmToBuffer(command);
return message.channel.createMessage("", { return message.channel.createMessage("", {
file: resultBuffer, file: resultBuffer,
name: "sharpen.png" name: `sharpen.${image.type}`
}); });
}; };

View file

@ -1,7 +1,9 @@
const collections = require("./collections.js"); const collections = require("./collections.js");
const logger = require("./logger.js"); const logger = require("./logger.js");
const fs = require("fs"); const fs = require("fs");
const template = `# <img src="https://raw.githubusercontent.com/TheEssem/esmBot/master/esmbot.png" width="64"> esmBot${process.env.NODE_ENV === "development" ? " Dev" : ""} Command List
module.exports = async (output) => {
const template = `# <img src="https://raw.githubusercontent.com/TheEssem/esmBot/master/esmbot.png" width="64"> esmBot${process.env.NODE_ENV === "development" ? " Dev" : ""} Command List
${process.env.NODE_ENV === "development" ? "\n**You are currently using esmBot Dev! Things may change at any time without warning and there will be bugs. Many bugs. If you find one, [report it here](https://github.com/TheEssem/esmBot/issues) or in the esmBot Support server.**\n" : ""} ${process.env.NODE_ENV === "development" ? "\n**You are currently using esmBot Dev! Things may change at any time without warning and there will be bugs. Many bugs. If you find one, [report it here](https://github.com/TheEssem/esmBot/issues) or in the esmBot Support server.**\n" : ""}
\`[]\` means an argument is required, \`{}\` means an argument is optional. \`[]\` means an argument is required, \`{}\` means an argument is optional.
@ -17,8 +19,6 @@ Default prefix is \`&\`.
+ [**Image Editing**](#🖼-image-editing) + [**Image Editing**](#🖼-image-editing)
+ [**Soundboard**](#🔊-soundboard) + [**Soundboard**](#🔊-soundboard)
`; `;
module.exports = async (output) => {
const commands = Array.from(collections.commands.keys()); const commands = Array.from(collections.commands.keys());
const categories = { const categories = {
general: ["## 💻 General"], general: ["## 💻 General"],