mirror of
https://github.com/toast-ts/Daggerbot-TS.git
synced 2024-11-16 20:00:59 -05:00
Lock and archive the old threads
This commit is contained in:
parent
fd3c1bdfff
commit
6dc4b278a8
@ -85,7 +85,8 @@
|
||||
"dcmod_chat": "742324777934520350",
|
||||
"mpmod_chat": "516344221452599306",
|
||||
"multifarm_chat": "1149238561934151690",
|
||||
"pw_list": "1193424588554645505"
|
||||
"pw_list": "1193424588554645505",
|
||||
"help_forum": "1022236553562558464"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
13
src/index.ts
13
src/index.ts
@ -25,6 +25,19 @@ client.on('error', (error: Error)=>_(error, 'clientError'));
|
||||
// Interval timers for modules
|
||||
setInterval(async()=>await MPModule(client), refreshTimerSecs);
|
||||
setInterval(()=>YTModule(client), 180000); // 3 minutes
|
||||
setInterval(async()=>{
|
||||
const forum = client.guilds.cache.get(client.config.dcServer.id).channels.cache.get(client.config.dcServer.channels.help_forum) as Discord.ForumChannel;
|
||||
await forum.threads.fetch();
|
||||
|
||||
for await (const thread of forum.threads.cache.values()) {
|
||||
await thread.messages.fetch();
|
||||
if (thread.lastMessage.createdTimestamp <= Date.now() - 1555200000) {// check if thread is inactive for over 18 days
|
||||
await thread.setLocked(true).catch(()=>null);
|
||||
await thread.setArchived(true, 'Inactive for over 18 days').catch(()=>null);
|
||||
Logger.console('log', 'ThreadTimer', `${thread.name} has been archived and locked due to inactivity`);
|
||||
}
|
||||
}
|
||||
}, 1200000); // 20 minutes
|
||||
|
||||
// Event loop for punishments and daily msgs
|
||||
setInterval(async()=>{
|
||||
|
5
src/interfaces.d.ts
vendored
5
src/interfaces.d.ts
vendored
@ -159,8 +159,9 @@ export interface Config {
|
||||
punishment_log: string,
|
||||
dcmod_chat: string,
|
||||
mpmod_chat: string,
|
||||
multifarm_chat: string
|
||||
pw_list: string
|
||||
multifarm_chat: string,
|
||||
pw_list: string,
|
||||
help_forum: string
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user