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

Method parseReactions

trace/trace.ts:524–554  ·  view source on GitHub ↗
(msg: Api.Message, text: string)

Source from the content-addressed store, hash-verified

522 `├ ${icon} 项目: ${configName}\n` +
523 `├ 🔄 旧值: ${previousValue ? '✅ 启用' : '❌ 禁用'}\n` +
524 `├ ✨ 新值: ${boolValue ? '✅ 启用' : '❌ 禁用'}\n` +
525 `└ 💾 配置已保存`;
526 await this.editAndDelete(msg, configMsg, 10);
527 }
528
529 private async formatEntity(target: string | Api.TypePeer, mention?: boolean, throwErrorIfFailed?: boolean) {
530 const client = await getGlobalClient();
531 if (!client) throw new Error("客户端未初始化");
532 let id: any, entity: any;
533 try {
534 entity = (typeof target !== 'string' && target?.className) ? target : await client?.getEntity(target);
535 if (!entity) throw new Error("无法获取entity");
536 id = entity.id;
537 } catch (e: any) {
538 if (throwErrorIfFailed) throw new Error(`无法获取 ${target}: ${e?.message}`);
539 }
540 const displayParts: string[] = [];
541 if (entity?.title) displayParts.push(htmlEscape(entity.title));
542 if (entity?.firstName) displayParts.push(htmlEscape(entity.firstName));
543 if (entity?.lastName) displayParts.push(htmlEscape(entity.lastName));
544 if (entity?.username) {
545 displayParts.push(mention ? `@${entity.username}` : `<code>@${entity.username}</code>`);
546 }
547 if (id) {
548 displayParts.push(
549 entity instanceof Api.User
550 ? `<a href="tg://user?id=${id}">${id}</a>`
551 : `<a href="https://t.me/c/${id}">${id}</a>`
552 );
553 }
554 return { id, entity, display: displayParts.join(" ").trim() };
555 }
556
557 private async parseReactions(msg: Api.Message, text: string): Promise<(string | BigInteger)[]> {

Callers 2

traceUserMethod · 0.95
traceKeywordMethod · 0.95

Calls 4

initializeSelfMethod · 0.95
setMethod · 0.45
addMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected