galactic-bot/middleware/client/DiscordClient.js
2020-04-09 08:30:52 -06:00

59 lines
1.2 KiB
JavaScript

const { Client } = require('discord.js');
const options = require('../../options.json');
const EventHooker = require('./EventHooker.js');
const Dispatcher = require('./Dispatcher.js')
const Resolver = require('./Resolver.js');
const Transporter = require('./Transporter.js');
const { Guild, User, Message } = require('../../structure/extensions/');
class DiscordClient extends Client {
constructor(options) {
super(options.bot.clientOptions);
this.eventHooker = new EventHooker(this);
this.dispatcher = new Dispatcher(this);
this.resolver = new Resolver(this);
this.transporter = new Transporter(this);
this._options = options;
this._built = false;
process.send({
});
process.on('message', (message) => {
});
}
async build() {
await super.login(this._options.bot.token);
this.on('message', (message) => {
console.log(message);
if(message.content === "kms") {
message.reply("ok");
}
});
this._built = true;
}
}
module.exports = DiscordClient;
const client = new DiscordClient(options);
client.build();