UNPKG

1.65 kBJavaScriptView Raw
1"use strict";
2function __export(m) {
3 for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
4}
5var __importDefault = (this && this.__importDefault) || function (mod) {
6 return (mod && mod.__esModule) ? mod : { "default": mod };
7};
8Object.defineProperty(exports, "__esModule", { value: true });
9const discord_js_1 = require("discord.js");
10const commands_1 = __importDefault(require("./commands"));
11const Constants_1 = __importDefault(require("./Constants"));
12require("./node-additions");
13require("./override");
14/**
15 * Initializes the framework
16 */
17class Application {
18 constructor(options) {
19 this.options = options;
20 Constants_1.default.applyPatches({
21 COMMAND_PREFIX: options.commandPrefix,
22 ERROR_RENDER_FORMAT: options.errorFormat
23 });
24 }
25 /**
26 * Sets the Discord client up and loads the command system
27 */
28 async init() {
29 this.client = this.options.client || new discord_js_1.Client();
30 this.client.botkit = this;
31 if (!this.client.readyTimestamp) {
32 await this.client.login(this.options.token);
33 }
34 this.commandSystem = new commands_1.default({ directory: this.options.commandDirectory, app: this, preloadExclude: this.options.preloadExclude, automaticCategoryNames: this.options.automaticCategoryNames });
35 await this.commandSystem.init();
36 }
37}
38exports.Application = Application;
39exports.default = Application;
40__export(require("./commands"));
41exports.Constants = Constants_1.default;
42__export(require("./db"));
43__export(require("./modules"));
44__export(require("./util"));
45//# sourceMappingURL=index.js.map
\No newline at end of file