From 099f9943356de397936ea6fa7e13b8383cb7c102 Mon Sep 17 00:00:00 2001 From: "Navy.gif" Date: Fri, 13 May 2022 11:07:27 +0300 Subject: [PATCH] misc fixes n shit --- src/middleware/BaseClient.js | 7 ++++--- src/structure/DiscordClient.js | 15 +++++++++++++-- src/structure/interfaces/Observer.js | 2 +- 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/src/middleware/BaseClient.js b/src/middleware/BaseClient.js index 4986c56..bcbad8a 100644 --- a/src/middleware/BaseClient.js +++ b/src/middleware/BaseClient.js @@ -41,9 +41,10 @@ class BaseClient extends EventEmitter { this.logger.status(`Shards spawned, spawned ${this.shardingManager.shards.size} shards. Took ${Date.now() - start} ms`); - 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; - // const API = await import('./api/index.js').catch(() => this.logger.warn(`Error importing API files, continuing without`)); + // 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; + let API = null; + if(this._options.api.load) API = await import('../../api/index.js').catch(() => this.logger.warn(`Error importing API files, continuing without`)); if (API) { this.logger.info('Booting up API'); const { default: APIManager } = API; diff --git a/src/structure/DiscordClient.js b/src/structure/DiscordClient.js index a4fdcfd..908be2c 100644 --- a/src/structure/DiscordClient.js +++ b/src/structure/DiscordClient.js @@ -196,7 +196,7 @@ class DiscordClient extends Client { 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' }); + this.user.setActivity(`${userCount} users`, { type: 'LISTENING' }); }, 2: async () => { this.user.setActivity("for /help", { type: 'LISTENING' }); @@ -215,6 +215,10 @@ class DiscordClient extends Client { return this.shard.count === 1; } + get shardId() { + return this.shard.ids[0]; + } + /** * @private */ @@ -312,8 +316,15 @@ class DiscordClient extends Client { }); } - + resolveUsers(...opts) { + return this.resolver.resolveUsers(...opts); + } + + resolveUser(...opts) { + return this.resolver.resolveUser(...opts); + } + get prefix() { return this._options.discord.prefix; } diff --git a/src/structure/interfaces/Observer.js b/src/structure/interfaces/Observer.js index 8a98e6e..d9e79d7 100644 --- a/src/structure/interfaces/Observer.js +++ b/src/structure/interfaces/Observer.js @@ -14,7 +14,7 @@ class Observer extends Component { }); this.name = options.name; - this.priority = options.priority || 1; // Lower is higher + this.priority = options.priority || 10; // Lower is higher this.hooks = options.hooks || []; this.logger = new Logger(this);