(tasks): added basic scheduled tasks system.

This commit is contained in:
2026-08-28 01:00:44 +08:00
parent f353a73a9e
commit 42b67ef4da
6 changed files with 67 additions and 0 deletions
+6
View File
@@ -1,10 +1,16 @@
import { Event, CommandClient } from 'athena-prime';
import tasks from '../../tasks';
class ReadyEvent extends Event<CommandClient> {
event: string = 'ready' as const;
async handle(context: CommandClient<any, any>) {
await context.deployCommands();
tasks.forEach(async task => {
if (task.init) await task.handler(context);
setInterval(async () => await task.handler(context), task.interval);
});
}
}