Render reaction multiplier counts (#494)

This commit is contained in:
l5y
2025-11-22 18:51:19 +01:00
committed by GitHub
parent 0bb237c4ab
commit d60d774e73
2 changed files with 5 additions and 1 deletions
@@ -100,5 +100,5 @@ test('buildMessageBody suppresses reaction slot markers and formats counts', ()
renderEmojiHtml: value => `EMOJI(${value})`
});
assert.equal(countedBody, 'EMOJI(✨)');
assert.equal(countedBody, 'EMOJI(✨) ESC(×2)');
});
@@ -360,6 +360,7 @@ export function buildMessageBody({ message, escapeHtml, renderEmojiHtml }) {
const segments = [];
const reaction = isReactionMessage(message);
const textSegment = resolveMessageTextSegment(message, reaction);
const reactionCount = reaction && textSegment && /^×\d+$/.test(textSegment) ? textSegment : null;
if (textSegment && !reaction) {
segments.push(escapeHtml(textSegment));
}
@@ -367,6 +368,9 @@ export function buildMessageBody({ message, escapeHtml, renderEmojiHtml }) {
if (emoji) {
segments.push(renderEmojiHtml(emoji));
}
if (reactionCount) {
segments.push(escapeHtml(reactionCount));
}
if (segments.length === 0) {
return '';