transfer many poll functions to VoteController

This commit is contained in:
2023-07-05 22:55:24 +02:00
parent 8c3cf7829b
commit 4cd9c771f0
5 changed files with 215 additions and 199 deletions

View File

@ -8,7 +8,6 @@ import { Maybe } from "../interfaces";
import { JellyfinHandler } from "../jellyfin/handler";
import { logger } from "../logger";
import { CommandType } from "../types/commandTypes";
import { checkForPollsToClose } from "../commands/closepoll";
import { isInitialAnnouncement } from "../helper/messageIdentifiers";
import VoteController from "../helper/vote.controller";
@ -18,7 +17,7 @@ export class ExtendedClient extends Client {
private eventFilePath = `${__dirname}/../events`
private commandFilePath = `${__dirname}/../commands`
private jellyfin: JellyfinHandler
public VoteController: VoteController = new VoteController()
public voteController: VoteController = new VoteController()
public commands: Collection<string, CommandType> = new Collection()
private announcementChannels: Collection<string, TextChannel> = new Collection() //guildId to TextChannel
private announcementRoleHandlerTask: Collection<string, ScheduledTask> = new Collection() //one task per guild
@ -194,7 +193,7 @@ export class ExtendedClient extends Client {
private async startPollCloseBackgroundTasks() {
for (const guild of this.guilds.cache) {
this.pollCloseBackgroundTasks.set(guild[1].id, schedule("0 * * * * *", () => checkForPollsToClose(guild[1])))
this.pollCloseBackgroundTasks.set(guild[1].id, schedule("0 * * * * *", () => this.voteController.checkForPollsToClose(guild[1])))
}
}
}