From 496c9bb67db67bcf7259360fa193a5567541ee3d Mon Sep 17 00:00:00 2001 From: Bsian Date: Thu, 21 May 2020 12:40:53 +0100 Subject: [PATCH] Fix various issues --- src/class/Client.ts | 4 ++-- src/class/Event.ts | 1 + src/intervals/fetchMembers.ts | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/class/Client.ts b/src/class/Client.ts index f226f5f..886c53c 100644 --- a/src/class/Client.ts +++ b/src/class/Client.ts @@ -48,7 +48,7 @@ export default class Client extends eris.Client { } public async loadEvents(eventFiles: { [s: string]: typeof Event; } | ArrayLike) { - const evtFiles = Object.entries Event>(eventFiles); + const evtFiles = Object.entries(eventFiles); for (const [name, Ev] of evtFiles) { const event = new Ev(this); this.events.add(event.event, event); @@ -59,7 +59,7 @@ export default class Client extends eris.Client { } public async loadCommands(commandFiles: { [s: string]: typeof Command; } | ArrayLike) { - const cmdFiles = Object.values Command>(commandFiles); + const cmdFiles = Object.values(commandFiles); for (const Cmd of cmdFiles) { const command = new Cmd(this); this.commands.add(command.name, command); diff --git a/src/class/Event.ts b/src/class/Event.ts index 5214c24..658f18c 100644 --- a/src/class/Event.ts +++ b/src/class/Event.ts @@ -8,6 +8,7 @@ export default class Event { constructor(client: Client) { this.client = client; this.event = ''; + this.run = this.run.bind(this); } public async run(...args: any[]): Promise { return Promise.resolve(); } diff --git a/src/intervals/fetchMembers.ts b/src/intervals/fetchMembers.ts index 82a8f9d..fdfd1f1 100644 --- a/src/intervals/fetchMembers.ts +++ b/src/intervals/fetchMembers.ts @@ -3,7 +3,7 @@ import { Client } from '../class'; let interval: NodeJS.Timeout; export default async function fetchMembers(client: Client): Promise { - await client.guilds.get(client.config.guildID).fetchAllMembers(); + await client.guilds.get(client.config.guildID)?.fetchAllMembers(); interval = setInterval(async () => { await client.guilds.get(client.config.guildID).fetchAllMembers(); }, 1800000);