From ee742018e99ea8285e8c5b23cb55c2e36e619f94 Mon Sep 17 00:00:00 2001 From: kenobi Date: Tue, 27 Jun 2023 20:08:39 +0200 Subject: [PATCH] adds comment to fetchAnnouncementChannelMessage --- server/structures/client.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/server/structures/client.ts b/server/structures/client.ts index 9e0c2d8..f445585 100644 --- a/server/structures/client.ts +++ b/server/structures/client.ts @@ -85,6 +85,16 @@ export class ExtendedClient extends Client { 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} channels - All channels which should be fecthed for reactionTracking + */ private async fetchAnnouncementChannelMessage(channels: Collection): Promise { channels.each(async ch => { ch.messages.fetch()