diff --git a/packages/discord.js/src/util/LimitedCollection.js b/packages/discord.js/src/util/LimitedCollection.js index a5874c8aae45..12a8360a1934 100644 --- a/packages/discord.js/src/util/LimitedCollection.js +++ b/packages/discord.js/src/util/LimitedCollection.js @@ -47,7 +47,7 @@ class LimitedCollection extends Collection { } set(key, value) { - if (this.maxSize === 0) return this; + if (this.maxSize === 0 && !this.keepOverLimit?.(value, key, this)) return this; if (this.size >= this.maxSize && !this.has(key)) { for (const [k, v] of this.entries()) { const keep = this.keepOverLimit?.(v, k, this) ?? false;