mirror of
https://github.com/nx-bat/synapse.git
synced 2026-09-23 11:29:05 -04:00
(tasks): added basic scheduled tasks system.
This commit is contained in:
@@ -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);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user