(client: any)
| 70 | |
| 71 | try { |
| 72 | const dialogs = await getAllDialogs(client); |
| 73 | |
| 74 | for (const dialog of dialogs) { |
| 75 | if (dialog.isUser) { |
| 76 | if (dialog.entity && dialog.entity.bot) { |
| 77 | botsCount++; |
| 78 | } else { |
| 79 | privateCount++; |
| 80 | } |
| 81 | } else if (dialog.isGroup) { |
| 82 | groupCount++; |
| 83 | } else if (dialog.isChannel) { |
| 84 | channelCount++; |
| 85 | } |
| 86 | } |
| 87 | } catch (error) { |
| 88 | console.error("[AnnualReport] 获取对话统计失败:", error); |
| 89 | } |
| 90 | |
| 91 | return { private: privateCount, group: groupCount, bots: botsCount, channel: channelCount }; |
| 92 | } |
| 93 | |
| 94 | private async getBlockedCount(client: any): Promise<number> { |
| 95 | try { |
| 96 | // 使用原始API获取黑名单数量 |
| 97 | const result = await client.invoke( |
| 98 | new Api.contacts.GetBlocked({ |
| 99 | offset: 0, |
no test coverage detected