Virtual-Royaume / Royaume-Discord-Bot

It is the bot of our Discord community, it offers various utility features. It is written in TypeScript and uses DiscordJS to interact with the Discord API.
9 stars 1 forks source link

Task system #11

Closed Bluzzi closed 3 years ago

Bluzzi commented 3 years ago

A clean and more organized system for managing tasks. This is what a task looks like now :

import Task from "../Task";

export default class Test extends Task {

    private execCount = 0;

    constructor(){
        super(1000);
    }

    public async run(timeout: NodeJS.Timeout) : void {
        console.log(this.execCount);

        if(this.execCount === 5) clearInterval(timeout);

        this.execCount++;
    }
}

Test.ts in the src/tasks/list folder