koishi-plugin-chat-patch 2.2.0 → 2.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/client/icons/activity.vue +9 -9
- package/client/icons/index.ts +4 -4
- package/client/index.scss +90 -90
- package/client/index.ts +25 -25
- package/client/vue/composables/useChatActions.ts +1 -1
- package/client/vue/composables/useChatData.ts +1 -1
- package/client/vue/composables/useImageCache.ts +1 -1
- package/client/vue/types.ts +1 -1
- package/dist/index.js +2 -2
- package/lib/file-manager.d.ts +32 -0
- package/lib/index.js +417 -197
- package/lib/message-handler.d.ts +7 -5
- package/package.json +1 -1
- package/readme.md +25 -25
- package/src/api-handlers.ts +19 -65
- package/src/config.ts +45 -46
- package/src/file-manager.ts +367 -169
- package/src/index.ts +58 -31
- package/src/message-handler.ts +161 -134
- package/src/types.ts +62 -62
- package/src/utils.ts +4 -16
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { ChatData, MessageInfo } from './types';
|
|
2
|
+
import { Context } from 'koishi';
|
|
3
|
+
import { Config } from './config';
|
|
4
|
+
export declare class FileManager {
|
|
5
|
+
private ctx;
|
|
6
|
+
private config;
|
|
7
|
+
private chatHistoryDir;
|
|
8
|
+
private metadataFilePath;
|
|
9
|
+
private logger;
|
|
10
|
+
private utils;
|
|
11
|
+
private memoryCache;
|
|
12
|
+
private pendingMessages;
|
|
13
|
+
private writeTimers;
|
|
14
|
+
private readonly WRITE_DEBOUNCE_MS;
|
|
15
|
+
constructor(ctx: Context, config: Config);
|
|
16
|
+
private cleanupOldDataFiles;
|
|
17
|
+
private ensureDir;
|
|
18
|
+
private getChannelFilePath;
|
|
19
|
+
private readChannelMessages;
|
|
20
|
+
private writeChannelMessages;
|
|
21
|
+
private readMetadata;
|
|
22
|
+
private writeMetadata;
|
|
23
|
+
private loadAllChannelMessages;
|
|
24
|
+
readChatDataFromFile(): ChatData;
|
|
25
|
+
writeChatDataToFile(data: ChatData): void;
|
|
26
|
+
private scheduleWrite;
|
|
27
|
+
private flushPendingMessages;
|
|
28
|
+
cleanExcessMessages(data: ChatData): ChatData;
|
|
29
|
+
addMessageToFile(messageInfo: MessageInfo): Promise<void>;
|
|
30
|
+
dispose(): void;
|
|
31
|
+
private logInfo;
|
|
32
|
+
}
|