(info: any)
| 165 | let displayName = info.firstName ? `${info.firstName}${info.lastName ? ' ' + info.lastName : ''}` : (info.username ? `@${info.username}` : `用户 ${userId}`); |
| 166 | let usernameInfo = info.username ? `@${info.username}` : "无用户名"; |
| 167 | |
| 168 | const statusTags = []; |
| 169 | if (info.isBot) statusTags.push("🤖 机器人"); |
| 170 | if (info.isVerified) statusTags.push("✅ 已验证"); |
| 171 | if (info.isPremium) statusTags.push("⭐ Premium"); |
| 172 | if (info.isScam) statusTags.push("⚠️ 诈骗"); |
| 173 | if (info.isFake) statusTags.push("❌ 虚假"); |
| 174 | |
| 175 | let bioText = info.bio || "无简介"; |
| 176 | if (bioText.length > 200) bioText = bioText.substring(0, 200) + "..."; |
| 177 | |
| 178 | const link1 = `tg://user?id=${userId}`, link2 = info.username ? `https://t.me/${info.username}` : `https://t.me/@id${userId}`, link3 = `tg://openmessage?user_id=${userId}`; |
| 179 | |
| 180 | let result = `👤 <b>${htmlEscape(displayName)}</b>\n\n`; |
| 181 | result += `<b>基本信息:</b>\n`; |
| 182 | result += `• 用户名:${codeTag(usernameInfo)}\n`; |
| 183 | result += `• 用户ID:${codeTag(userId)}\n`; |
| 184 | result += `• 注册时间:${codeTag(`${info.regDate} (±2月)`)}\n`; |
| 185 | if (info.joinedDate) result += `• 入群时间:${codeTag(info.joinedDate)}\n`; |
| 186 | result += `• DC:${codeTag(info.dc)}\n`; |
| 187 | result += `• 共同群:${codeTag(info.commonChats)} 个\n`; |
| 188 | if (statusTags.length > 0) result += `• 状态:${statusTags.join(" ")}\n`; |
| 189 | |
| 190 | result += `\n<b>简介:</b>\n${codeTag(bioText)}\n`; |
| 191 | result += `\n<b>跳转链接:</b>\n`; |
| 192 | result += `• <a href="${htmlEscape(link1)}">用户资料</a>\n• <a href="${htmlEscape(link2)}">聊天链接</a>\n• <a href="${htmlEscape(link3)}">打开消息</a>\n`; |
| 193 | result += `\n<b>链接文本:</b>\n`; |
| 194 | result += `• ${codeTag(link1)}\n• ${codeTag(link2)}\n• ${codeTag(link3)}`; |
| 195 | |
| 196 | return result; |
| 197 | } |
| 198 | |
| 199 | private async parseTarget(client: any, target: string) { |
| 200 | if (target.startsWith("@")) { |
| 201 | const e = await client.getEntity(target); |
| 202 | return { user: e, id: Number(e.id) }; |
| 203 | } |
| 204 | const id = parseInt(target); |
no test coverage detected