Fixed compatibility with Eris 0.13, get patron list dynamically
This commit is contained in:
		
							parent
							
								
									8393f599b0
								
							
						
					
					
						commit
						f1404a8393
					
				
					 2 changed files with 16 additions and 4 deletions
				
			
		| 
						 | 
					@ -1,6 +1,18 @@
 | 
				
			||||||
 | 
					const client = require("../utils/client.js");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
exports.run = async () => {
 | 
					exports.run = async () => {
 | 
				
			||||||
  return "Like esmBot? Consider supporting the developer on Patreon to help keep it running! https://patreon.com/TheEssem";
 | 
					  let prefix = "";
 | 
				
			||||||
 | 
					  if (client.guilds.has("592399417676529688")) {
 | 
				
			||||||
 | 
					    const patrons = client.guilds.get("592399417676529688").members.filter((i) => {
 | 
				
			||||||
 | 
					      return i.roles.includes("741386733047906475");
 | 
				
			||||||
 | 
					    });
 | 
				
			||||||
 | 
					    prefix = "Thanks to the following patrons for their support:\n";
 | 
				
			||||||
 | 
					    for (const patron of patrons) {
 | 
				
			||||||
 | 
					      prefix += `**- ${patron.username}**\n`;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    prefix += "\n";
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					  return `${prefix}Like esmBot? Consider supporting the developer on Patreon to help keep it running! https://patreon.com/TheEssem`;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
exports.aliases = ["support", "patreon", "patrons"];
 | 
					exports.aliases = ["support", "patreon", "patrons"];
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -11,16 +11,16 @@ class ReactionCollector extends EventEmitter {
 | 
				
			||||||
    this.ended = false;
 | 
					    this.ended = false;
 | 
				
			||||||
    this.collected = [];
 | 
					    this.collected = [];
 | 
				
			||||||
    this.bot = client;
 | 
					    this.bot = client;
 | 
				
			||||||
    this.listener = (message, emoji, userID) => this.verify(message, emoji, userID);
 | 
					    this.listener = async (message, emoji, userID) => await this.verify(message, emoji, userID);
 | 
				
			||||||
    this.bot.on("messageReactionAdd", this.listener);
 | 
					    this.bot.on("messageReactionAdd", this.listener);
 | 
				
			||||||
    if (options.time) setTimeout(() => this.stop("time"), options.time);
 | 
					    if (options.time) setTimeout(() => this.stop("time"), options.time);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  verify(message, emoji, userID) {
 | 
					  async verify(message, emoji, userID) {
 | 
				
			||||||
    if (this.message.id !== message.id) return false;
 | 
					    if (this.message.id !== message.id) return false;
 | 
				
			||||||
    if (this.filter(message, emoji, userID)) {
 | 
					    if (this.filter(message, emoji, userID)) {
 | 
				
			||||||
      this.collected.push({ message: message, emoji: emoji, userID: userID });
 | 
					      this.collected.push({ message: message, emoji: emoji, userID: userID });
 | 
				
			||||||
      this.emit("reaction", message, emoji, userID);
 | 
					      this.emit("reaction", await client.getMessage(message.channel.id, message.id), emoji, userID);
 | 
				
			||||||
      if (this.collected.length >= this.options.maxMatches) this.stop("maxMatches");
 | 
					      if (this.collected.length >= this.options.maxMatches) this.stop("maxMatches");
 | 
				
			||||||
      return true;
 | 
					      return true;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue