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

Function formatUserLine

lottery/lottery.ts:622–649  ·  view source on GitHub ↗
(uid: number, userObj?: any)

Source from the content-addressed store, hash-verified

620 } else if (userObj.firstName) {
621 displayName = userObj.firstName;
622 } else if (userObj.lastName) {
623 displayName = userObj.lastName;
624 }
625
626 if (userObj.username) {
627 username = `@${userObj.username}`;
628 }
629 }
630
631 if (displayName && username) {
632 return `• <a href="tg://user?id=${uid}">${htmlEscape(displayName)} ${htmlEscape(username)}</a>`;
633 } else if (displayName) {
634 return `• <a href="tg://user?id=${uid}">${htmlEscape(displayName)}</a>`;
635 } else if (username) {
636 return `• <a href="tg://user?id=${uid}">${htmlEscape(username)}</a>`;
637 }
638
639 return `• <a href="tg://user?id=${uid}">${uid}</a>`;
640}
641
642async function isUserAdmin(client: TelegramClient, chatId: string, userId: string): Promise<boolean> {
643 try {
644 const chatEntity = await client.getEntity(chatId);
645
646 // 检查是否为超级群或频道
647 if (chatEntity.className === 'Channel' || (chatEntity as any).megagroup) {
648 try {
649 const participant = await client.invoke(
650 new Api.channels.GetParticipant({
651 channel: chatEntity,
652 participant: userId,

Callers

nothing calls this directly

Calls 1

htmlEscapeFunction · 0.70

Tested by

no test coverage detected