()
| 11 | } |
| 12 | |
| 13 | async run() { |
| 14 | // Triggering initialization of the control guild if it hasn't been initialized |
| 15 | if (this.client.options.controlGuild && !this.client.settings.get('guilds.controlGuild')) await this.setControlGuild(); |
| 16 | |
| 17 | // Check to see that the bot is in at least one guild |
| 18 | if (!this.client.guilds.cache.size) { |
| 19 | await this.client.emit('error', 'Please add the bot to at least one guild.\nShutting down...'); |
| 20 | await this.client.destroy(); |
| 21 | } |
| 22 | |
| 23 | // Check to see that there is a control guild specified |
| 24 | if (!this.client.settings.get('guilds.controlGuild')) { |
| 25 | await this.client.emit('error', 'Please specify the control guild in your client configs and ensure the bot has been added to it with Administrator permissions.\nShutting down...'); |
| 26 | await this.client.destroy(); |
| 27 | } |
| 28 | |
| 29 | await this.client.emit('verbose', 'Verifying that all guilds are initialized...'); |
| 30 | |
| 31 | await this.client.guilds.cache.forEach(async (guild) => { |
| 32 | if (!guild.available) return; |
| 33 | if (this.client.settings.get('guildBlacklist').includes(guild.id)) { |
| 34 | guild.leave(); |
| 35 | this.client.emit('warn', `Blacklisted guild detected: ${guild.name} (${guild.id})`); |
| 36 | } else { |
| 37 | // eslint-disable-next-line max-len |
| 38 | if ((!guild.settings.get('initialization.serverInitialized') || !guild.settings.get('channels.log')) && guild.id === this.client.settings.get('guilds.controlGuild')) await guild.rtbyteInit('control'); |
| 39 | if ((!guild.settings.get('initialization.serverInitialized') || !guild.settings.get('channels.log')) && guild.id !== this.client.settings.get('guilds.controlGuild')) await guild.rtbyteInit(); |
| 40 | await this.client.emit('verbose', `Verified initialization of guild: ${guild.name} (${guild.id})`); |
| 41 | } |
| 42 | }); |
| 43 | |
| 44 | await this.client.emit('verbose', 'All guilds verified!'); |
| 45 | if (this.client.settings.get('logs.botReady')) await this.botReadyLog(); |
| 46 | |
| 47 | return; |
| 48 | } |
| 49 | |
| 50 | async botReadyLog() { |
| 51 | const embed = new MessageEmbed() |
nothing calls this directly
no test coverage detected