use branded types for messageType determination

This commit is contained in:
2023-07-05 22:54:43 +02:00
parent 1a13638ed9
commit 8c3cf7829b
4 changed files with 18 additions and 9 deletions

View File

@ -9,7 +9,7 @@ import { JellyfinHandler } from "../jellyfin/handler";
import { logger } from "../logger";
import { CommandType } from "../types/commandTypes";
import { checkForPollsToClose } from "../commands/closepoll";
import { messageIsInitialAnnouncement } from "../helper/messageIdentifiers";
import { isInitialAnnouncement } from "../helper/messageIdentifiers";
import VoteController from "../helper/vote.controller";
@ -155,7 +155,7 @@ export class ExtendedClient extends Client {
}
this.announcementRoleHandlerTask.set(guild.id, schedule("*/10 * * * * *", async () => {
const requestId = uuid()
const messages = (await textChannel.messages.fetchPinned()).filter(message => messageIsInitialAnnouncement(message))
const messages = (await textChannel.messages.fetchPinned()).filter(message => isInitialAnnouncement(message))
if (messages.size > 1) {
logger.error("More than one pinned announcement Messages found. Unable to know which one people react to. Please fix!", { guildId: guild.id, requestId })