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

Method getChatCount

annualreport/annualreport.ts:72–96  ·  view source on GitHub ↗
(client: any)

Source from the content-addressed store, hash-verified

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,

Callers 1

handleAnnualReportMethod · 0.95

Calls 2

getAllDialogsFunction · 0.85
errorMethod · 0.80

Tested by

no test coverage detected