From afd677b270ee1a51ce930acf27d047f6ff6e0a21 Mon Sep 17 00:00:00 2001 From: Dragory <2606411+Dragory@users.noreply.github.com> Date: Sat, 10 Aug 2019 00:43:58 +0300 Subject: [PATCH] ChannelArchiver: include message reactions in archive --- src/plugins/ChannelArchiver.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/plugins/ChannelArchiver.ts b/src/plugins/ChannelArchiver.ts index 4704630b..3ce48be9 100644 --- a/src/plugins/ChannelArchiver.ts +++ b/src/plugins/ChannelArchiver.ts @@ -106,6 +106,7 @@ export class ChannelArchiverPlugin extends ZeppelinPlugin { let content = `[${ts}] [${message.author.id}] [${message.author.username}#${ message.author.discriminator }]: ${message.content || ""}`; + if (message.attachments.length) { if (args["attachment-channel"]) { const rehostedAttachmentUrl = await this.rehostAttachment( @@ -118,6 +119,14 @@ export class ChannelArchiverPlugin extends ZeppelinPlugin { } } + if (message.reactions && Object.keys(message.reactions).length > 0) { + const reactionCounts = []; + for (const [emoji, info] of Object.entries(message.reactions)) { + reactionCounts.push(`${info.count}x ${emoji}`); + } + content += `\n-- Reactions: ${reactionCounts.join(", ")}`; + } + archiveLines.push(content); previousId = message.id; archivedMessages++;