Disabling threads sweeper

Trying to disable the threads sweeper but having trouble telling whether it was done correctly. Client constructor:
const client = new Client({ intents, sweepers: { threads: { interval: 0 }, }, })
const client = new Client({ intents, sweepers: { threads: { interval: 0 }, }, })
Logging client.sweepers gives:
Sweepers {
options: { threads: { interval: 0, lifetime: 14400 } },
intervals: {
autoModerationRules: null,
applicationCommands: null,
bans: null,
emojis: null,
invites: null,
guildMembers: null,
messages: null,
presences: null,
reactions: null,
stageInstances: null,
stickers: null,
threadMembers: null,
threads: null,
users: null,
voiceStates: null
}
}
Sweepers {
options: { threads: { interval: 0, lifetime: 14400 } },
intervals: {
autoModerationRules: null,
applicationCommands: null,
bans: null,
emojis: null,
invites: null,
guildMembers: null,
messages: null,
presences: null,
reactions: null,
stageInstances: null,
stickers: null,
threadMembers: null,
threads: null,
users: null,
voiceStates: null
}
}
Was this the correct way to do it? intervals.threads is null like the intervals for sweepers of other types, but does that mean "never sweep"? I still see a lifetime in the options but unclear if interval being null makes that moot. Also tried:
const client = new Client({ intents, sweepers: { threads: null, }, }) // TypeError
const client = new Client({ intents, sweepers: { threads: {}, }, }) // fell back to default settings
const client = new Client({ intents, sweepers: { threads: null, }, }) // TypeError
const client = new Client({ intents, sweepers: { threads: {}, }, }) // fell back to default settings
2 Replies
d.js toolkit
d.js toolkit2y ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - Consider reading #how-to-get-help to improve your question! - Explain what exactly your issue is. - Post the full error stack trace, not just the top part! - Show your code! - Issue solved? Press the button!
edocsil
edocsilOP2y ago
My use case is that I have a function that relies on all threads in a forum being cached. The only way I can think of to make sure that the list is always there is to fetch them each time, but that means some redundant API requests if the function is called again too soon and while the threads are still cached. Hoping that disabling the sweeper would let me fetch the threads once the first time the function is called and then never again for the rest of the session Okay cool, thank you for confirming
Want results from more Discord servers?
Add your server