constructor(options) { super(options); // Loads the config.js file that contains the token and prefix values. this.config = require("./config.js"); // E.g. `client.config.token` = bot's token // Aliases and commands are put in collections where they can be read from, // catalogued, listed, etc. this.commands = new Discord.Collection(); this.aliases = new Discord.Collection(); // Integrates the use of the Enhanced Map module, which essentially // saves a collection to disk. This is used for per-server configs, // and makes things extremely easy for this purpose. this.settings = new Enmap({ name: "settings" }); // Requiring the Logger class for easy console logging this.logger = require("./util/Logger"); // An async shortcut for a setTimeout function this.wait = promisify(setTimeout); }
constructor() { super(); this.bot = new DiscordJS.Client({ apiRequestMethod: 'sequential', messageCacheMaxSize: 200, messageCacheLifetime: 0, messageSweepInterval: 0, fetchAllMembers: false, disableEveryone: false, sync: false, restWsBridgeTimeout: 5000, restTimeOffset: 500 }); this.discord = new BaseDiscord(this.bot); this.Game = new Game(); this.Crons = new Crons({ Discord: this }); this.CommandParser = new CommandParser({ Game: this.Game, Bot: this.bot }); this.onlinePlayers = new DiscordJS.Collection(); this.loadEventListeners(); this.bot.login(botLoginToken); this.minTimer = (minimalTimer * 1000) * 60; this.maxTimer = (maximumTimer * 1000) * 60; this.tickInMinutes = 2; this.counter = {}; }