( target: TargetChat, userIds: string[], locked: boolean, )
| 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 | |
| 537 | async 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 |
no test coverage detected