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

Compare commits

...

2 Commits

Author SHA1 Message Date
dependabot[bot]
249750a592
Merge c9de586ba2 into 71b143d7da 2024-02-19 13:50:11 +11:00
toast-ts
71b143d7da Lock and archive the old threads 2024-02-19 13:38:17 +11:00
3 changed files with 18 additions and 3 deletions

View File

@ -85,7 +85,8 @@
"dcmod_chat": "742324777934520350",
"mpmod_chat": "516344221452599306",
"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
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
View File

@ -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
}
}
}