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

Function getAllDialogs

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

Source from the content-addressed store, hash-verified

15
16 const collectDialogs = async (params: Record<string, any>) => {
17 try {
18 const dialogs = await client.getDialogs(params);
19 for (const dialog of dialogs || []) {
20 const key = `${dialog.id}`;
21 if (!dialogMap.has(key)) {
22 dialogMap.set(key, dialog);
23 }
24 }
25 } catch (error) {
26 console.error("[AnnualReport] 获取对话列表失败:", error);
27 }
28 };
29
30 await collectDialogs({});
31 await collectDialogs({ folderId: 1 });
32
33 return Array.from(dialogMap.values());
34}
35
36class AnnualReportPlugin extends Plugin {
37 cleanup(): void {
38 // 引用重置:清空实例级 db / cache / manager 引用,便于 reload 后重新初始化。
39 this.db = null;
40 }
41

Callers 1

getChatCountMethod · 0.85

Calls 1

collectDialogsFunction · 0.70

Tested by

no test coverage detected