adds comment to fetchAnnouncementChannelMessage
All checks were successful
Run unit tests / test (pull_request) Successful in 1m54s
Compile the repository / compile (pull_request) Successful in 57s

This commit is contained in:
kenobi 2023-06-27 20:08:39 +02:00
parent 8ad651c753
commit ee742018e9

View File

@ -85,6 +85,16 @@ export class ExtendedClient extends Client {
logger.info(`Error refreshing slash commands: ${error}`) logger.info(`Error refreshing slash commands: ${error}`)
} }
} }
/**
* Fetches all messages from the provided channel collection.
* This is necessary for announcementChannels, because 'old' messages don't receive
* messageReactionAdd Events, only messages that were sent while the bot is online are tracked
* automatically.
* To prevent the need for a dedicated 'Collector' implementation which would listen on specific
* it's easiest to just fetch all messages from the backlog, which automatically makes the bot track them
* again.
* @param {Collection<string, TextChannel>} channels - All channels which should be fecthed for reactionTracking
*/
private async fetchAnnouncementChannelMessage(channels: Collection<string, TextChannel>): Promise<void> { private async fetchAnnouncementChannelMessage(channels: Collection<string, TextChannel>): Promise<void> {
channels.each(async ch => { channels.each(async ch => {
ch.messages.fetch() ch.messages.fetch()