MCPcopy Create free account
hub / github.com/TeleBoxOrg/TeleBox_Plugins / sendReaction

Method sendReaction

trace/trace.ts:556–576  ·  view source on GitHub ↗
(peer: Api.TypePeer, msgId: number, reactions: (string | BigInteger)[], big: boolean)

Source from the content-addressed store, hash-verified

554 return { id, entity, display: displayParts.join(" ").trim() };
555 }
556
557 private async parseReactions(msg: Api.Message, text: string): Promise<(string | BigInteger)[]> {
558 await this.initializeSelf(); // Ensures isPremium is set
559 const validReactions: (string | BigInteger)[] = [];
560 const customEmojiMap = new Map<number, BigInteger>();
561 const customEmojiIndices = new Set<number>();
562 if (this.isPremium) {
563 const customEmojiEntities = (msg.entities || []).filter(
564 (e): e is Api.MessageEntityCustomEmoji => e instanceof Api.MessageEntityCustomEmoji
565 );
566 for (const entity of customEmojiEntities) {
567 customEmojiMap.set(entity.offset, entity.documentId);
568 for (let i = 0; i < entity.length; i++) {
569 customEmojiIndices.add(entity.offset + i);
570 }
571 }
572 }
573 const textOffsetInMessage = msg.message.indexOf(text);
574 if (textOffsetInMessage === -1) return [];
575 let currentIndex = 0;
576 for (const char of text) {
577 const fullMessageOffset = textOffsetInMessage + currentIndex;
578 if (customEmojiMap.has(fullMessageOffset)) {
579 validReactions.push(customEmojiMap.get(fullMessageOffset)!);

Callers 2

handleMessageMethod · 0.95
traceUserMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected