Added support for multiple processing emojis, fixed issue with local image processing

This commit is contained in:
TheEssem 2021-04-23 15:03:48 -05:00
parent 4e4ae3613f
commit ebfab817d7
4 changed files with 146 additions and 134 deletions

View file

@ -2,6 +2,8 @@ const Command = require("./command.js");
const magick = require("../utils/image.js");
const imageDetect = require("../utils/imagedetect.js");
const collections = require("../utils/collections.js");
const { emotes } = require("../messages.json");
const { random } = require("../utils/misc.js");
class ImageCommand extends Command {
/*this.embed = {
@ -58,7 +60,7 @@ class ImageCommand extends Command {
magickParams.path = image.path;
magickParams.type = image.type;
magickParams.url = image.url; // technically not required but can be useful for text filtering
magickParams.delay = image.delay;
magickParams.delay = image.delay ? image.delay : 0;
if (this.constructor.requiresGIF) magickParams.onlyGIF = true;
} catch (e) {
collections.runningCommands.delete(this.message.author.id);
@ -111,7 +113,7 @@ class ImageCommand extends Command {
}
processMessage(message) {
return message.channel.createMessage(`${process.env.PROCESSING_EMOJI || "<a:processing:479351417102925854>"} Processing... This might take a while`);
return message.channel.createMessage(`${random(emotes) || process.env.PROCESSING_EMOJI || "<a:processing:479351417102925854>"} Processing... This might take a while`);
}
static requiresImage = true;

View file

@ -1,4 +1,10 @@
[
{
"emotes": [
"<a:processing:818243325891051581>",
"<a:glxgears:802272302082293770>",
"<a:spunchbob:834829415661568000>"
],
"messages": [
"with your sanity",
"h",
"Club Penguin",
@ -127,5 +133,8 @@
"YouTube ads",
"there are federal agents outside my house",
"less goo",
"WhatsApp"
"WhatsApp",
"Half Life 3",
"Tower Defense Simulator"
]
}

View file

@ -15,7 +15,7 @@ const database = require("./utils/database.js");
// command collections
const collections = require("./utils/collections.js");
// playing messages
const messages = require("./messages.json");
const { messages } = require("./messages.json");
// other stuff
const misc = require("./utils/misc.js");
// generate help page

View file

@ -2,6 +2,7 @@ const util = require("util");
// random(array) to select a random entry in array
exports.random = (array) => {
if (!array || array.length < 1) return null;
return array[Math.floor(Math.random() * array.length)];
};