1
0
Fork 0

Bind server to client

refactor/models
Matthew 2019-11-16 19:23:50 -05:00
parent 9fac157482
commit 76a1ccba1c
No known key found for this signature in database
GPG Key ID: 766BE43AE75F7559
1 changed files with 5 additions and 1 deletions

View File

@ -4,6 +4,7 @@ import mongoose from 'mongoose';
import signale from 'signale'; import signale from 'signale';
import fs from 'fs-extra'; import fs from 'fs-extra';
import config from './config.json'; 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 } from './models';
import { emojis } from './stores'; import { emojis } from './stores';
import { Command, Util, Collection } from './class'; import { Command, Util, Collection } from './class';
@ -11,7 +12,7 @@ import * as commands from './commands';
export default class Client extends Eris.Client { export default class Client extends Eris.Client {
public config: { 'token': string; 'cloudflare': string; 'prefix': string; 'emailPass': string; }; public config: { 'token': string; 'cloudflare': string; 'prefix': string; 'emailPass': string; 'port': number, 'keyPair': { 'publicKey': string, 'privateKey': string }; };
public util: Util; public util: Util;
@ -25,6 +26,8 @@ export default class Client extends Eris.Client {
public signale: signale.Signale; public signale: signale.Signale;
public server: Server;
constructor() { constructor() {
super(config.token, { getAllUsers: true, restMode: true, defaultImageFormat: 'png' }); super(config.token, { getAllUsers: true, restMode: true, defaultImageFormat: 'png' });
@ -108,6 +111,7 @@ export default class Client extends Eris.Client {
require(`./intervals/${interval}`).default(this); require(`./intervals/${interval}`).default(this);
this.signale.complete(`Loaded interval ${interval.split('.')[0]}`); this.signale.complete(`Loaded interval ${interval.split('.')[0]}`);
}); });
this.server = new Server(this, { port: this.config.port });
} }
} }