use message identifiers

This commit is contained in:
2023-06-25 02:20:45 +02:00
parent ca0a9e3cb8
commit b6034d4fb7
4 changed files with 8 additions and 4 deletions

View File

@ -9,6 +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";
@ -136,7 +137,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 => message.cleanContent.includes("[initial]"))
const messages = (await textChannel.messages.fetchPinned()).filter(message => messageIsInitialAnnouncement(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 })