Catch image load warnings, set message limit to 50, don't crash the bot if .git is missing

This commit is contained in:
Essem 2021-10-23 13:58:19 -05:00
parent ab3ae7b9c6
commit f5a0fa5f7c
No known key found for this signature in database
GPG key ID: 7D497397CC3A2A8C
39 changed files with 305 additions and 50 deletions

View file

@ -2,10 +2,10 @@
import { EventEmitter } from "events";
class InteractionCollector extends EventEmitter {
constructor(client, message, options = {}) {
constructor(client, message, timeout = 120000) {
super();
this.message = message;
this.options = options;
//this.time = timeout;
this.ended = false;
this.bot = client;
this.listener = async (packet) => {
@ -13,7 +13,7 @@ class InteractionCollector extends EventEmitter {
await this.verify(packet.d.message, packet.d.data.custom_id, packet.d.id, packet.d.token, packet.d.member ? packet.d.member.user.id : packet.d.user.id);
};
this.bot.on("rawWS", this.listener);
if (options.time) setTimeout(() => this.stop("time"), options.time);
setTimeout(() => this.stop("time"), timeout);
}
async verify(message, interaction, id, token, member) {

View file

@ -72,7 +72,7 @@ export default async (client, message, pages, timeout = 120000) => {
};
let currentPage = await client.createMessage(message.channel.id, Object.assign(pages[page], options, pages.length > 1 ? components : {}));
if (pages.length > 1) {
const interactionCollector = new InteractionCollector(client, currentPage, { time: timeout });
const interactionCollector = new InteractionCollector(client, currentPage, timeout);
interactionCollector.on("interaction", async (interaction, id, token, member) => {
if (member === message.author.id) {
switch (interaction) {