diff --git a/src/middleware/BaseClient.js b/src/middleware/BaseClient.js index b5b3156..f958b17 100644 --- a/src/middleware/BaseClient.js +++ b/src/middleware/BaseClient.js @@ -38,7 +38,7 @@ class BaseClient extends EventEmitter { process.exit(); // Prevent a boot loop when shards die due to an error in the client }); - this.logger.status('Shards spawned'); + this.logger.status(`Shards spawned, spawned ${this.shardingManager.shards.size} shards`); const API = this._options.api.load ? await import('/Documents/My programs/GBot/api/index.js') .catch(() => this.logger.warn(`Error importing API files, continuing without`)) : null; diff --git a/src/structure/DiscordClient.js b/src/structure/DiscordClient.js index fb8db40..f9edfa5 100644 --- a/src/structure/DiscordClient.js +++ b/src/structure/DiscordClient.js @@ -158,11 +158,15 @@ class DiscordClient extends Client { async _setActivity() { const activities = { 0: async () => { - const guildCount = (await this.shard.broadcastEval((client) => client.guilds.cache.size)).reduce((p, v) => p+v, 0); + const result = await this.shard.broadcastEval((client) => client.guilds.cache.size).catch(() => null); + if (!result) return; + const guildCount = result.reduce((p, v) => p+v, 0); this.user.setActivity(`${guildCount} servers`, { type: 'WATCHING' }); }, 1: async () => { - const userCount = (await this.shard.broadcastEval((client) => client.users.cache.size)).reduce((p, v) => p+v, 0); + const result = await this.shard.broadcastEval((client) => client.users.cache.size).catch(() => null); + if (!result) return; + const userCount = result.reduce((p, v) => p+v, 0); this.user.setActivity(`to ${userCount} users`, { type: 'LISTENING' }); }, 2: async () => {