1
0
Fork 0

bind new util and new load functions func

refactor/models
Matthew 2019-10-26 00:02:44 -04:00
parent 38f48bb324
commit 70c7e3f698
No known key found for this signature in database
GPG Key ID: 766BE43AE75F7559
1 changed files with 15 additions and 2 deletions

View File

@ -3,10 +3,10 @@ import mongoose from 'mongoose';
import signale from 'signale'; import signale from 'signale';
import fs from 'fs-extra'; import fs from 'fs-extra';
import path from 'path'; import path from 'path';
import { config, Util } from '.'; import { config } from '.';
import { Account, AccountInterface, Moderation, ModerationInterface, Domain, DomainInterface } from './models'; import { Account, AccountInterface, Moderation, ModerationInterface, Domain, DomainInterface } from './models';
import { emojis } from './stores'; import { emojis } from './stores';
import { Command } from './class'; import { Command, Util } from './class';
export default class Client extends Eris.Client { export default class Client extends Eris.Client {
@ -39,6 +39,19 @@ export default class Client extends Eris.Client {
displayTimestamp: true, displayTimestamp: true,
displayFilename: true, displayFilename: true,
}); });
this.loadFunctions();
this.init();
}
private async loadFunctions() {
const functions = await fs.readdir('./functions');
functions.forEach(async (func) => {
try {
require(`./functions/${func}`).default(this);
} catch (error) {
await this.util.handleError(error);
}
});
} }
public loadCommand(commandPath: string) { public loadCommand(commandPath: string) {