* Helper method to get display text for reactions (fallback without entities)
(msg: Api.Message, emojiText: string, reactions: (string | BigInteger)[])
| 581 | else if (!customEmojiIndices.has(fullMessageOffset) && AVAILABLE_REACTIONS.includes(char)) { |
| 582 | validReactions.push(char); |
| 583 | } |
| 584 | currentIndex += char.length; |
| 585 | } |
| 586 | return [...new Set(validReactions)]; |
| 587 | } |
| 588 | |
| 589 | private async sendReaction(peer: Api.TypePeer, msgId: number, reactions: (string | BigInteger)[], big: boolean) { |
| 590 | const client = await getGlobalClient(); |
| 591 | if (!client || reactions.length === 0) return; |
| 592 | |
| 593 | const reactionObjects = reactions.map(r => { |
| 594 | if (typeof r === 'string') { |
| 595 | if (AVAILABLE_REACTIONS.includes(r)) { |
| 596 | return new Api.ReactionEmoji({ emoticon: r }); |
| 597 | } |
| 598 | return new Api.ReactionCustomEmoji({ documentId: bigInt(r) }); |
| 599 | } else { |
| 600 | return new Api.ReactionCustomEmoji({ documentId: bigInt(r) }); |
| 601 | } |
| 602 | }); |
| 603 | |
| 604 | await client.invoke( |
| 605 | new Api.messages.SendReaction({ |
| 606 | peer, msgId, reaction: reactionObjects, big, |
| 607 | }) |
| 608 | ); |
| 609 | } |