2018-07-01 03:35:51 +03:00
|
|
|
require("dotenv").config();
|
|
|
|
|
|
|
|
process.on("unhandledRejection", (reason, p) => {
|
|
|
|
// tslint:disable-next-line
|
|
|
|
console.error(reason);
|
|
|
|
process.exit();
|
|
|
|
});
|
|
|
|
|
|
|
|
import { Client } from "eris";
|
2018-07-01 04:31:24 +03:00
|
|
|
import { Knub, logger } from "knub";
|
2018-07-01 03:35:51 +03:00
|
|
|
import { BotControlPlugin } from "./plugins/BotControl";
|
|
|
|
import { ModActionsPlugin } from "./plugins/ModActions";
|
|
|
|
import { UtilityPlugin } from "./plugins/Utility";
|
|
|
|
import knex from "./knex";
|
|
|
|
|
|
|
|
// Run latest database migrations
|
2018-07-01 04:31:24 +03:00
|
|
|
logger.info("Running database migrations");
|
2018-07-01 03:35:51 +03:00
|
|
|
knex.migrate.latest().then(() => {
|
|
|
|
const client = new Client(process.env.TOKEN);
|
|
|
|
|
|
|
|
const bot = new Knub(client, {
|
|
|
|
plugins: {
|
|
|
|
utility: UtilityPlugin,
|
|
|
|
mod_notes: ModActionsPlugin
|
|
|
|
},
|
|
|
|
globalPlugins: {
|
|
|
|
bot_control: BotControlPlugin
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2018-07-01 04:31:24 +03:00
|
|
|
logger.info("Starting the bot");
|
2018-07-01 03:35:51 +03:00
|
|
|
bot.run();
|
|
|
|
});
|