Added support for multiple processing emojis, fixed issue with local image processing
This commit is contained in:
		
							parent
							
								
									4e4ae3613f
								
							
						
					
					
						commit
						ebfab817d7
					
				
					 4 changed files with 146 additions and 134 deletions
				
			
		| 
						 | 
					@ -2,6 +2,8 @@ const Command = require("./command.js");
 | 
				
			||||||
const magick = require("../utils/image.js");
 | 
					const magick = require("../utils/image.js");
 | 
				
			||||||
const imageDetect = require("../utils/imagedetect.js");
 | 
					const imageDetect = require("../utils/imagedetect.js");
 | 
				
			||||||
const collections = require("../utils/collections.js");
 | 
					const collections = require("../utils/collections.js");
 | 
				
			||||||
 | 
					const { emotes } = require("../messages.json");
 | 
				
			||||||
 | 
					const { random } = require("../utils/misc.js");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class ImageCommand extends Command {
 | 
					class ImageCommand extends Command {
 | 
				
			||||||
  /*this.embed = {
 | 
					  /*this.embed = {
 | 
				
			||||||
| 
						 | 
					@ -58,7 +60,7 @@ class ImageCommand extends Command {
 | 
				
			||||||
        magickParams.path = image.path;
 | 
					        magickParams.path = image.path;
 | 
				
			||||||
        magickParams.type = image.type;
 | 
					        magickParams.type = image.type;
 | 
				
			||||||
        magickParams.url = image.url; // technically not required but can be useful for text filtering
 | 
					        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;
 | 
					        if (this.constructor.requiresGIF) magickParams.onlyGIF = true;
 | 
				
			||||||
      } catch (e) {
 | 
					      } catch (e) {
 | 
				
			||||||
        collections.runningCommands.delete(this.message.author.id);
 | 
					        collections.runningCommands.delete(this.message.author.id);
 | 
				
			||||||
| 
						 | 
					@ -111,7 +113,7 @@ class ImageCommand extends Command {
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  processMessage(message) {
 | 
					  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;
 | 
					  static requiresImage = true;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,4 +1,10 @@
 | 
				
			||||||
[
 | 
					{
 | 
				
			||||||
 | 
					  "emotes": [
 | 
				
			||||||
 | 
					    "<a:processing:818243325891051581>",
 | 
				
			||||||
 | 
					    "<a:glxgears:802272302082293770>",
 | 
				
			||||||
 | 
					    "<a:spunchbob:834829415661568000>"
 | 
				
			||||||
 | 
					  ],
 | 
				
			||||||
 | 
					  "messages": [
 | 
				
			||||||
    "with your sanity",
 | 
					    "with your sanity",
 | 
				
			||||||
    "h",
 | 
					    "h",
 | 
				
			||||||
    "Club Penguin",
 | 
					    "Club Penguin",
 | 
				
			||||||
| 
						 | 
					@ -127,5 +133,8 @@
 | 
				
			||||||
    "YouTube ads",
 | 
					    "YouTube ads",
 | 
				
			||||||
    "there are federal agents outside my house",
 | 
					    "there are federal agents outside my house",
 | 
				
			||||||
    "less goo",
 | 
					    "less goo",
 | 
				
			||||||
  "WhatsApp"
 | 
					    "WhatsApp",
 | 
				
			||||||
]
 | 
					    "Half Life 3",
 | 
				
			||||||
 | 
					    "Tower Defense Simulator"
 | 
				
			||||||
 | 
					  ]
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										2
									
								
								shard.js
									
										
									
									
									
								
							
							
						
						
									
										2
									
								
								shard.js
									
										
									
									
									
								
							| 
						 | 
					@ -15,7 +15,7 @@ const database = require("./utils/database.js");
 | 
				
			||||||
// command collections
 | 
					// command collections
 | 
				
			||||||
const collections = require("./utils/collections.js");
 | 
					const collections = require("./utils/collections.js");
 | 
				
			||||||
// playing messages
 | 
					// playing messages
 | 
				
			||||||
const messages = require("./messages.json");
 | 
					const { messages } = require("./messages.json");
 | 
				
			||||||
// other stuff
 | 
					// other stuff
 | 
				
			||||||
const misc = require("./utils/misc.js");
 | 
					const misc = require("./utils/misc.js");
 | 
				
			||||||
// generate help page
 | 
					// generate help page
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -2,6 +2,7 @@ const util = require("util");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// random(array) to select a random entry in array
 | 
					// random(array) to select a random entry in array
 | 
				
			||||||
exports.random = (array) => {
 | 
					exports.random = (array) => {
 | 
				
			||||||
 | 
					  if (!array || array.length < 1) return null;
 | 
				
			||||||
  return array[Math.floor(Math.random() * array.length)];
 | 
					  return array[Math.floor(Math.random() * array.length)];
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue