forked from engineering/cloudservices
client changes
parent
688e243839
commit
9f2fdc6a17
|
@ -5,7 +5,7 @@ import signale from 'signale';
|
|||
import fs from 'fs-extra';
|
||||
import config from './config.json';
|
||||
import { Server } from './api';
|
||||
import { Account, AccountInterface, Moderation, ModerationInterface, Domain, DomainInterface } from './models';
|
||||
import { Account, AccountInterface, Moderation, ModerationInterface, Domain, DomainInterface, Tier, TierInterface } from './models';
|
||||
import { emojis } from './stores';
|
||||
import { Command, Util, Collection } from './class';
|
||||
import * as commands from './commands';
|
||||
|
@ -18,12 +18,14 @@ export default class Client extends Eris.Client {
|
|||
|
||||
public commands: Collection<Command>;
|
||||
|
||||
public db: { Account: mongoose.Model<AccountInterface>; Domain: mongoose.Model<DomainInterface>; Moderation: mongoose.Model<ModerationInterface>; };
|
||||
public db: { Account: mongoose.Model<AccountInterface>; Domain: mongoose.Model<DomainInterface>; Moderation: mongoose.Model<ModerationInterface>; Tier: mongoose.Model<TierInterface>; };
|
||||
|
||||
public redis: Redis.Redis;
|
||||
|
||||
public stores: { emojis: { success: string, loading: string, error: string }; };
|
||||
|
||||
public functions: Collection<Function>;
|
||||
|
||||
public signale: signale.Signale;
|
||||
|
||||
public server: Server;
|
||||
|
@ -39,7 +41,8 @@ export default class Client extends Eris.Client {
|
|||
this.config = config;
|
||||
this.util = new Util(this);
|
||||
this.commands = new Collection<Command>();
|
||||
this.db = { Account, Domain, Moderation };
|
||||
this.functions = new Collection<Function>();
|
||||
this.db = { Account, Domain, Moderation, Tier };
|
||||
this.redis = new Redis();
|
||||
this.stores = { emojis };
|
||||
this.signale = signale;
|
||||
|
@ -64,9 +67,10 @@ export default class Client extends Eris.Client {
|
|||
private async loadFunctions() {
|
||||
const functions = await fs.readdir('./functions');
|
||||
functions.forEach(async (func) => {
|
||||
if (func === 'index.ts' || func === 'index.js' || func === 'dataConversion.js') return;
|
||||
if (func === 'index.ts' || func === 'index.js') return;
|
||||
try {
|
||||
(require(`./functions/${func}`).default)(this);
|
||||
const funcRequire: Function = require(`./functions/${func}`).default;
|
||||
this.functions.set(func.split('.')[0], funcRequire);
|
||||
} catch (error) {
|
||||
this.signale.error(`Error occured loading ${func}`);
|
||||
await this.util.handleError(error);
|
||||
|
|
Loading…
Reference in New Issue