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

@ -6,7 +6,7 @@ import { Maybe } from '../interfaces'
import { logger } from '../logger'
import { Command } from '../structures/command'
import { RunOptions } from '../types/commandTypes'
import { messageIsInitialAnnouncement } from '../helper/messageIdentifiers'
import { isInitialAnnouncement } from '../helper/messageIdentifiers'
export default new Command({
name: 'announce',
@ -62,7 +62,7 @@ async function sendInitialAnnouncement(guildId: string, requestId: string): Prom
return
}
const currentPinnedAnnouncementMessages = (await announcementChannel.messages.fetchPinned()).filter(message => messageIsInitialAnnouncement(message))
const currentPinnedAnnouncementMessages = (await announcementChannel.messages.fetchPinned()).filter(message => isInitialAnnouncement(message))
currentPinnedAnnouncementMessages.forEach(async (message) => await message.unpin())
currentPinnedAnnouncementMessages.forEach(message => message.delete())