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

Function updateLockedSeats

admin_board/admin_board.ts:525–547  ·  view source on GitHub ↗
(
  target: TargetChat,
  userIds: string[],
  locked: boolean,
)

Source from the content-addressed store, hash-verified

523 else current.delete(userId);
524 }
525
526 if (current.size > 0) {
527 db.data.lockedSeats[target.storageKey] = Array.from(current).sort((a, b) =>
528 a.localeCompare(b, "zh-CN"),
529 );
530 } else {
531 delete db.data.lockedSeats[target.storageKey];
532 }
533
534 await db.write();
535}
536
537async function collectAdminStat(
538 target: TargetChat,
539 user: Api.User,
540 lockedSeatSet: Set<string>,
541): Promise<AdminStat> {
542 const client = await getGlobalClient();
543 if (!client) throw new Error("Telegram 客户端未初始化");
544
545 const userId = getUserIdString(user);
546 const lockedSeat = lockedSeatSet.has(userId);
547 const name = getUserDisplayName(user);
548 const onlineDays = getLastOnlineDays(user);
549 const participant = (user as any).participant as
550 | Api.ChatParticipantAdmin

Callers 1

handleSeatActionFunction · 0.85

Calls 4

getSeatLockDbFunction · 0.85
writeMethod · 0.80
addMethod · 0.45
deleteMethod · 0.45

Tested by

no test coverage detected