カスタマイズ可能なキャッシュ
js// Using a helper method that does reasonable stuff.
const client = new Client({
makeCache: Options.cacheWithLimits({
MessageManager: 200, // This is default.
PresenceManager: 0, // Add more class names here.
}),
});
// Just do whatever.
const client = new Client({
makeCache: (manager) => {
if (manager.name === 'MessageManager') return new LimitedCollection(0);
return new Collection();
}
});
マネージャーの持つキャッシュを制御することができる。
メモリ使用量の削減などが可能になるがキャッシュにエントリーがないときのdiscord.jsの挙動に注意
Managerのクラス名をキー、大きさの上限を値とするオブジェクトを渡す。
下の関数を使えば邪悪なことができそう

参考