small fixes

This commit is contained in:
Erik 2024-03-23 19:42:07 +02:00
parent 6f69f9c01a
commit dff73f0a40
3 changed files with 13 additions and 10 deletions

View File

@ -561,12 +561,12 @@ class DiscordClient extends Client
return fetched; return fetched;
} }
resolveUsers (...opts: [user: UserResolveable[], foce?: boolean]) resolveUsers (...opts: [user: UserResolveable[], force?: boolean])
{ {
return this.#resolver.resolveUsers(...opts); return this.#resolver.resolveUsers(...opts);
} }
resolveUser (...opts: [user: UserResolveable, foce?: boolean]) resolveUser (...opts: [user: UserResolveable, force?: boolean])
{ {
return this.#resolver.resolveUser(...opts); return this.#resolver.resolveUser(...opts);
} }

View File

@ -142,7 +142,7 @@ class RateLimiter
* @returns {Promise<Message>} Resolves when the message is sent, rejects if sending fails * @returns {Promise<Message>} Resolves when the message is sent, rejects if sending fails
* @memberof RateLimiter * @memberof RateLimiter
*/ */
queueSend (channel: GuildTextBasedChannel, message: string) queueSend (channel: GuildTextBasedChannel, message: string): Promise<Message | boolean>
{ {
return new Promise((resolve, reject) => return new Promise((resolve, reject) =>
{ {
@ -186,12 +186,15 @@ class RateLimiter
temp = `\n${message}`; temp = `\n${message}`;
if (sendThis.length + temp.length > 2000) 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 // Max length message, send the remaining messages at the next send
this.#sendTimeouts[channel.id] = setTimeout( this.#sendTimeouts[channel.id] = setTimeout(
this.#send.bind(this), this.#send.bind(this),
this.#sendInterval * 1000, this.#sendInterval * 1000,
channel channel
); );
break; break;
} }
else else

View File

@ -263,8 +263,8 @@ class GuildWrapper
const keys = Object.keys(settings); const keys = Object.keys(settings);
for (const key of keys) for (const key of keys)
{ {
if (!(key in defaultConfig)) // if (!(key in defaultConfig))
continue; // continue;
defaultConfig[key] = { ...defaultConfig[key], ...settings[key] }; defaultConfig[key] = { ...defaultConfig[key], ...settings[key] };
} }
} }