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

Function buildUserDisplayFromCache

admin_board/admin_board.ts:267–290  ·  view source on GitHub ↗
(
  userId: string,
  cachedUser?: { name?: string; username?: string | null },
)

Source from the content-addressed store, hash-verified

265 const usernameText = cachedUser.username || "";
266
267 if (displayName && displayName !== userId && displayName !== usernameText) {
268 parts.push(htmlEscape(displayName));
269 }
270 if (cachedUser.username) {
271 parts.push(`<code>${htmlEscape(cachedUser.username)}</code>`);
272 }
273 parts.push(
274 `<a href="tg://user?id=${userId}">${htmlEscape(userId)}</a>`,
275 );
276
277 return parts.join(" ");
278}
279
280function normalizeErrorMessage(detail: string): string {
281 if (detail.includes("CHAT_ADMIN_REQUIRED")) {
282 return "需要管理员权限才能执行该操作";
283 }
284 if (detail.includes("CHANNEL_PRIVATE")) {
285 return "无法访问该私有频道/群组";
286 }
287 if (detail.includes("USERNAME_NOT_OCCUPIED")) {
288 return "指定的用户名不存在";
289 }
290 if (detail.includes("PEER_ID_INVALID")) {
291 return "目标对话或用户无效,或当前账号无法访问";
292 }
293 if (detail.includes("USER_ID_INVALID")) {

Callers 1

handleSeatActionFunction · 0.85

Calls 2

buildUserDisplayFromIdFunction · 0.85
htmlEscapeFunction · 0.70

Tested by

no test coverage detected