77 Intents ,
88 Options ,
99 Sweepers ,
10+ ThreadChannel ,
1011} from "discord.js" ;
1112
1213export const discord : ClientOptions = {
@@ -17,44 +18,24 @@ export const discord: ClientOptions = {
1718 roles : [ ] ,
1819 } ,
1920 makeCache : Options . cacheWithLimits ( {
21+ // only keep non-archived threads
2022 ThreadManager : {
21- sweepFilter : ( ) => {
22- return ( thread ) => thread . archived ;
23- } ,
24- sweepInterval : 60 ,
25- maxSize : 1000 ,
23+ maxSize : 1 ,
24+ keepOverLimit : ( value ) => ! value . archived ,
2625 } ,
2726 // @ts -ignore
27+ // same here
2828 GuildTextThreadManager : {
29- sweepFilter : ( ) => {
30- return ( thread ) => thread . archived ;
31- } ,
32- sweepInterval : 60 ,
33- maxSize : 1000 ,
29+ maxSize : 1 ,
30+ keepOverLimit : ( value : ThreadChannel ) => ! value . archived ,
3431 } ,
32+ // same here (though idk why this doesn't need ts-ignore)
3533 GuildForumThreadManager : {
36- sweepFilter : ( ) => {
37- return ( thread ) => thread . archived ;
38- } ,
39- sweepInterval : 60 ,
40- maxSize : 1000 ,
34+ maxSize : 1 ,
35+ keepOverLimit : ( value : ThreadChannel ) => ! value . archived ,
4136 } ,
42- // GuildChannelManager: {
43- // sweepFilter: () => {
44- // return (channel) => channel.isThread() && channel.archived;
45- // },
46- // sweepInterval: 60,
47- // maxSize: 1500, // 500 channels + 1000 active threads
48- // keepOverLimit: (channel) => !channel.isThread(), // keep normal channels over limit
49- // },
50- // ChannelManager: {
51- // sweepFilter: () => {
52- // return (channel) => channel.isThread() && channel.archived;
53- // },
54- // sweepInterval: 60,
55- // maxSize: 1, // needs to be any number > 0 for keepOverLimit to work
56- // keepOverLimit: (channel) => !channel.isThread(), // only keep non-threads in global channel cache
57- // },
37+ // 50 messages max per channel for non-plus guilds
38+ // 250 for plus guilds
5839 MessageManager : {
5940 maxSize : 50 ,
6041 keepOverLimit : ( value : FireMessage , _ , cache ) => {
@@ -63,7 +44,21 @@ export const discord: ClientOptions = {
6344 return false ;
6445 } ,
6546 } ,
66- // @ts -ignore
47+ GuildMemberManager : {
48+ // maxSize of 1 means we may have a single member
49+ // that isn't the bot or running a command
50+ maxSize : 1 ,
51+ keepOverLimit : ( value : FireMember ) =>
52+ value . id == value . client . user ?. id ||
53+ value . client . isRunningCommand ( value ) ,
54+ } ,
55+ UserManager : {
56+ // same here
57+ maxSize : 1 ,
58+ keepOverLimit : ( value : FireUser ) =>
59+ value . id == value . client . user ?. id ||
60+ value . client . isRunningCommand ( value ) ,
61+ } ,
6762 GuildApplicationCommandManager : 0 ,
6863 ApplicationCommandManager : 0 ,
6964 BaseGuildEmojiManager : 0 ,
@@ -82,7 +77,8 @@ export const discord: ClientOptions = {
8277 lifetime : 150 ,
8378 getComparisonTimestamp : ( message : FireMessage ) =>
8479 message . editedTimestamp ?? message . createdTimestamp ,
85- excludeFromSweep : ( message : FireMessage ) => ! ! message . paginator ,
80+ excludeFromSweep : ( message : FireMessage ) =>
81+ ! ! message . paginator && ! message . paginator . closed ,
8682 } ) ,
8783 } ,
8884 users : {
@@ -105,7 +101,7 @@ export const discord: ClientOptions = {
105101 filter : ( ) => ( state ) => state . channelId == null ,
106102 } ,
107103 } ,
108- restRequestTimeout : 15000 ,
104+ restRequestTimeout : 30000 ,
109105 restSweepInterval : 60 ,
110106 partials : [
111107 Constants . PartialTypes . GUILD_MEMBER ,
0 commit comments