From dff73f0a400b931ed97fc6f30932cfaa5d82919f Mon Sep 17 00:00:00 2001 From: "Navy.gif" Date: Sat, 23 Mar 2024 19:42:07 +0200 Subject: [PATCH] small fixes --- src/client/DiscordClient.ts | 4 ++-- src/client/components/RateLimiter.ts | 15 +++++++++------ src/client/components/wrappers/GuildWrapper.ts | 4 ++-- 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/src/client/DiscordClient.ts b/src/client/DiscordClient.ts index 82e4ffd..28897a6 100644 --- a/src/client/DiscordClient.ts +++ b/src/client/DiscordClient.ts @@ -561,12 +561,12 @@ class DiscordClient extends Client return fetched; } - resolveUsers (...opts: [user: UserResolveable[], foce?: boolean]) + resolveUsers (...opts: [user: UserResolveable[], force?: boolean]) { return this.#resolver.resolveUsers(...opts); } - resolveUser (...opts: [user: UserResolveable, foce?: boolean]) + resolveUser (...opts: [user: UserResolveable, force?: boolean]) { return this.#resolver.resolveUser(...opts); } diff --git a/src/client/components/RateLimiter.ts b/src/client/components/RateLimiter.ts index f3fadb3..6c705bd 100644 --- a/src/client/components/RateLimiter.ts +++ b/src/client/components/RateLimiter.ts @@ -142,7 +142,7 @@ class RateLimiter * @returns {Promise} Resolves when the message is sent, rejects if sending fails * @memberof RateLimiter */ - queueSend (channel: GuildTextBasedChannel, message: string) + queueSend (channel: GuildTextBasedChannel, message: string): Promise { return new Promise((resolve, reject) => { @@ -186,12 +186,15 @@ class RateLimiter temp = `\n${message}`; if (sendThis.length + temp.length > 2000) { + const timeout = this.#sendTimeouts[channel.id]; + // Not sure if this guard fixes the multi-send issue join logs is having, but it's worth a shot + if (!timeout || ('_destroyed' in timeout && timeout._destroyed)) // Max length message, send the remaining messages at the next send - this.#sendTimeouts[channel.id] = setTimeout( - this.#send.bind(this), - this.#sendInterval * 1000, - channel - ); + this.#sendTimeouts[channel.id] = setTimeout( + this.#send.bind(this), + this.#sendInterval * 1000, + channel + ); break; } else diff --git a/src/client/components/wrappers/GuildWrapper.ts b/src/client/components/wrappers/GuildWrapper.ts index b114820..e653858 100644 --- a/src/client/components/wrappers/GuildWrapper.ts +++ b/src/client/components/wrappers/GuildWrapper.ts @@ -263,8 +263,8 @@ class GuildWrapper const keys = Object.keys(settings); for (const key of keys) { - if (!(key in defaultConfig)) - continue; + // if (!(key in defaultConfig)) + // continue; defaultConfig[key] = { ...defaultConfig[key], ...settings[key] }; } }