diff --git a/src/util/Options.js b/src/util/Options.js
index 23a0cfde5d09..ab46f5e7b4c4 100644
--- a/src/util/Options.js
+++ b/src/util/Options.js
@@ -102,21 +102,7 @@ class Options extends null {
static createDefault() {
return {
shardCount: 1,
- makeCache: this.cacheWithLimits({
- MessageManager: 200,
- ChannelManager: {
- sweepInterval: 3600,
- sweepFilter: require('./Util').archivedThreadSweepFilter(),
- },
- GuildChannelManager: {
- sweepInterval: 3600,
- sweepFilter: require('./Util').archivedThreadSweepFilter(),
- },
- ThreadManager: {
- sweepInterval: 3600,
- sweepFilter: require('./Util').archivedThreadSweepFilter(),
- },
- }),
+ makeCache: this.cacheWithLimits(this.defaultMakeCacheSettings),
messageCacheLifetime: 0,
messageSweepInterval: 0,
invalidRequestWarningInterval: 0,
@@ -173,6 +159,9 @@ class Options extends null {
* @example
* // Sweep messages every 5 minutes, removing messages that have not been edited or created in the last 30 minutes
* Options.cacheWithLimits({
+ * // Keep default thread sweeping behavior
+ * ...Options.defaultMakeCacheSettings,
+ * // Override MessageManager
* MessageManager: {
* sweepInterval: 300,
* sweepFilter: LimitedCollection.filterByLifetime({
@@ -221,6 +210,35 @@ class Options extends null {
const { Collection } = require('@discordjs/collection');
return () => new Collection();
}
+
+ /**
+ * The default settings passed to {@link Options.cacheWithLimits}.
+ * The caches that this changes are:
+ * * `MessageManager` - Limit to 200 messages
+ * * `ChannelManager` - Sweep archived threads
+ * * `GuildChannelManager` - Sweep archived threads
+ * * `ThreadManager` - Sweep archived threads
+ * If you want to keep default behavior and add on top of it you can use this object and add on to it, e.g.
+ * `makeCache: Options.cacheWithLimits({ ...Options.defaultmakeCacheSettings, ReactionManager: 0 })`
+ * @type {Object}
+ */
+ static get defaultMakeCacheSettings() {
+ return {
+ MessageManager: 200,
+ ChannelManager: {
+ sweepInterval: 3600,
+ sweepFilter: require('./Util').archivedThreadSweepFilter(),
+ },
+ GuildChannelManager: {
+ sweepInterval: 3600,
+ sweepFilter: require('./Util').archivedThreadSweepFilter(),
+ },
+ ThreadManager: {
+ sweepInterval: 3600,
+ sweepFilter: require('./Util').archivedThreadSweepFilter(),
+ },
+ };
+ }
}
module.exports = Options;
diff --git a/typings/index.d.ts b/typings/index.d.ts
index 3f1b43fb8945..82616b09dff1 100644
--- a/typings/index.d.ts
+++ b/typings/index.d.ts
@@ -449,6 +449,7 @@ export class ClientUser extends User {
export class Options extends null {
private constructor();
+ public static defaultMakeCacheSettings: CacheWithLimitsOptions;
public static createDefaultOptions(): ClientOptions;
public static cacheWithLimits(settings?: CacheWithLimitsOptions): CacheFactory;
public static cacheEverything(): CacheFactory;