1
0
mirror of https://github.com/toast-ts/Daggerbot-TS.git synced 2024-11-17 00:10:58 -05:00

Lock and archive the old threads

This commit is contained in:
toast-ts 2024-02-19 13:38:17 +11:00
parent fd3c1bdfff
commit 6dc4b278a8
3 changed files with 18 additions and 3 deletions

View File

@ -85,7 +85,8 @@
"dcmod_chat": "742324777934520350", "dcmod_chat": "742324777934520350",
"mpmod_chat": "516344221452599306", "mpmod_chat": "516344221452599306",
"multifarm_chat": "1149238561934151690", "multifarm_chat": "1149238561934151690",
"pw_list": "1193424588554645505" "pw_list": "1193424588554645505",
"help_forum": "1022236553562558464"
} }
} }
} }

View File

@ -25,6 +25,19 @@ client.on('error', (error: Error)=>_(error, 'clientError'));
// Interval timers for modules // Interval timers for modules
setInterval(async()=>await MPModule(client), refreshTimerSecs); setInterval(async()=>await MPModule(client), refreshTimerSecs);
setInterval(()=>YTModule(client), 180000); // 3 minutes 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 // Event loop for punishments and daily msgs
setInterval(async()=>{ setInterval(async()=>{

5
src/interfaces.d.ts vendored
View File

@ -159,8 +159,9 @@ export interface Config {
punishment_log: string, punishment_log: string,
dcmod_chat: string, dcmod_chat: string,
mpmod_chat: string, mpmod_chat: string,
multifarm_chat: string multifarm_chat: string,
pw_list: string pw_list: string,
help_forum: string
} }
} }
} }