3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-03-15 05:41:51 +00:00
zeppelin/src/index.ts

45 lines
1.2 KiB
TypeScript
Raw Normal View History

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();
});
// Always use UTC
// This is also set for the database in knexfile
2018-07-08 13:58:45 +03:00
import * as moment from "moment-timezone";
moment.tz.setDefault("UTC");
2018-07-01 03:35:51 +03:00
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 { LogsPlugin } from "./plugins/Logs";
import { PostPlugin } from "./plugins/Post";
2018-07-29 15:18:26 +03:00
import { ReactionRolesPlugin } from "./plugins/ReactionRoles";
2018-07-01 03:35:51 +03:00
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_actions: ModActionsPlugin,
logs: LogsPlugin,
2018-07-29 15:18:26 +03:00
post: PostPlugin,
reaction_roles: ReactionRolesPlugin
2018-07-01 03:35:51 +03:00
},
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();
});