Fix various issues

merge-requests/12/merge
Bsian 2020-05-21 12:40:53 +01:00
parent 64b97ff9ba
commit 496c9bb67d
No known key found for this signature in database
GPG Key ID: 097FB9A291026091
3 changed files with 4 additions and 3 deletions

View File

@ -48,7 +48,7 @@ export default class Client extends eris.Client {
} }
public async loadEvents(eventFiles: { [s: string]: typeof Event; } | ArrayLike<typeof Event>) { public async loadEvents(eventFiles: { [s: string]: typeof Event; } | ArrayLike<typeof Event>) {
const evtFiles = Object.entries<new(client: Client) => Event>(eventFiles); const evtFiles = Object.entries<typeof Event>(eventFiles);
for (const [name, Ev] of evtFiles) { for (const [name, Ev] of evtFiles) {
const event = new Ev(this); const event = new Ev(this);
this.events.add(event.event, event); 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<typeof Command>) { public async loadCommands(commandFiles: { [s: string]: typeof Command; } | ArrayLike<typeof Command>) {
const cmdFiles = Object.values<new(client: Client) => Command>(commandFiles); const cmdFiles = Object.values<typeof Command>(commandFiles);
for (const Cmd of cmdFiles) { for (const Cmd of cmdFiles) {
const command = new Cmd(this); const command = new Cmd(this);
this.commands.add(command.name, command); this.commands.add(command.name, command);

View File

@ -8,6 +8,7 @@ export default class Event {
constructor(client: Client) { constructor(client: Client) {
this.client = client; this.client = client;
this.event = ''; this.event = '';
this.run = this.run.bind(this);
} }
public async run(...args: any[]): Promise<void> { return Promise.resolve(); } public async run(...args: any[]): Promise<void> { return Promise.resolve(); }

View File

@ -3,7 +3,7 @@ import { Client } from '../class';
let interval: NodeJS.Timeout; let interval: NodeJS.Timeout;
export default async function fetchMembers(client: Client): Promise<NodeJS.Timeout> { export default async function fetchMembers(client: Client): Promise<NodeJS.Timeout> {
await client.guilds.get(client.config.guildID).fetchAllMembers(); await client.guilds.get(client.config.guildID)?.fetchAllMembers();
interval = setInterval(async () => { interval = setInterval(async () => {
await client.guilds.get(client.config.guildID).fetchAllMembers(); await client.guilds.get(client.config.guildID).fetchAllMembers();
}, 1800000); }, 1800000);