UNPKG

1.74 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");
13/**
14 * Initializes the framework
15 */
16class Application {
17 constructor(options) {
18 this.options = options;
19 Constants_1.default.applyPatches({
20 COMMAND_PREFIX: options.commandPrefix,
21 ERROR_RENDER_FORMAT: options.errorFormat
22 });
23 }
24 /**
25 * Sets the Discord client up and loads the command system
26 */
27 async init() {
28 this.client = this.options.client || new discord_js_1.Client();
29 this.client.botkit = this;
30 if (!this.client.readyTimestamp) {
31 await this.client.login(this.options.token);
32 }
33 this.commandSystem = new commands_1.default({
34 directory: this.options.commandDirectory,
35 app: this,
36 preloadExclude: this.options.preloadExclude,
37 automaticCategoryNames: this.options.automaticCategoryNames,
38 globalGuards: this.options.globalGuards
39 });
40 await this.commandSystem.init();
41 }
42}
43exports.Application = Application;
44exports.default = Application;
45__export(require("./commands"));
46exports.Constants = Constants_1.default;
47__export(require("./db"));
48__export(require("./modules"));
49__export(require("./util"));
50//# sourceMappingURL=index.js.map
\No newline at end of file