koishi-plugin-chat-patch 2.1.2 → 2.3.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.
@@ -9,13 +9,15 @@ export declare class MessageHandler {
9
9
  private utils;
10
10
  private correctChannelIds;
11
11
  constructor(ctx: Context, config: Config, fileManager: FileManager);
12
+ recordUserMessage(session: Session, timestamp: number): void;
13
+ recordBotMessage(session: Session, timestamp: number): void;
12
14
  setCorrectChannelId(selfId: string, channelId: string): void;
13
15
  getCorrectChannelId(selfId: string): string | undefined;
14
- updateBotInfoToFile(session: Session): Promise<void>;
15
- updateChannelInfoToFile(session: Session): Promise<string>;
16
+ updateBotInfoToFile(session: Session): void;
17
+ updateChannelInfoToFile(session: Session): string;
16
18
  downloadAndCacheMedia(url: string, type: 'image' | 'media' | 'avatar'): Promise<any>;
17
- private processMediaElements;
18
- broadcastMessageEvent(session: Session): Promise<void>;
19
- broadcastBotMessageEvent(session: Session): Promise<void>;
19
+ private processMediaElementsAsync;
20
+ private processUserMessage;
21
+ private processBotMessage;
20
22
  private logInfo;
21
23
  }
package/lib/utils.d.ts ADDED
@@ -0,0 +1,13 @@
1
+ import { Config } from './config';
2
+ import { Context } from 'koishi';
3
+ export declare class Utils {
4
+ private config;
5
+ private ctx?;
6
+ constructor(config: Config, ctx?: Context);
7
+ isPlatformBlocked(platform: string): boolean;
8
+ extractTextContent(elements: any[]): string;
9
+ private isBase64;
10
+ persistBase64Image(base64Data: string): string;
11
+ private cleanupPersistImages;
12
+ cleanBase64Content(obj: any, isBotMessage?: boolean): any;
13
+ }
package/package.json CHANGED
@@ -1,52 +1,52 @@
1
- {
2
- "name": "koishi-plugin-chat-patch",
3
- "description": "[<ruby>chat-patch<rp>(</rp><rt>点我预览效果</rt><rp>)</rp></ruby>](https://i0.hdslb.com/bfs/openplatform/71074dfc9e5256fc3333d8bd8478bec1af874046.png) 视奸小插件((bushi( (低性能警告)。手机端适配。灵感来自 chat 插件。",
4
- "version": "2.1.2",
5
- "main": "lib/index.js",
6
- "typings": "lib/index.d.ts",
7
- "files": [
8
- "client",
9
- "dist",
10
- "lib",
11
- "src"
12
- ],
13
- "license": "MIT",
14
- "homepage": "https://github.com/koishi-shangxue-plugins/koishi-shangxue-apps/",
15
- "bugs": {
16
- "url": "https://github.com/koishi-shangxue-plugins/koishi-shangxue-apps/issues"
17
- },
18
- "contributors": [
19
- "shangxueink <1919892171@qq.com>"
20
- ],
21
- "keywords": [
22
- "koishi",
23
- "plugin",
24
- "chat",
25
- "聊天室",
26
- "console"
27
- ],
28
- "koishi": {
29
- "service": {
30
- "required": [
31
- "console"
32
- ]
33
- }
34
- },
35
- "peerDependencies": {
36
- "@koishijs/plugin-console": "^5.11.0",
37
- "koishi": "^4.16.0"
38
- },
39
- "devDependencies": {
40
- "@koishijs/client": "^5.11.0",
41
- "@types/mime-types": "^3.0.1",
42
- "autoprefixer": "^10.4.23",
43
- "koishi": "^4.16.0",
44
- "postcss": "^8.5.6",
45
- "tailwindcss": "^3.4.17"
46
- },
47
- "dependencies": {
48
- "@element-plus/icons-vue": "^2.3.2",
49
- "element-plus": "^2.13.0",
50
- "mime-types": "^3.0.2"
51
- }
52
- }
1
+ {
2
+ "name": "koishi-plugin-chat-patch",
3
+ "description": "[<ruby>chat-patch<rp>(</rp><rt>点我预览效果</rt><rp>)</rp></ruby>](https://i0.hdslb.com/bfs/openplatform/71074dfc9e5256fc3333d8bd8478bec1af874046.png) 视奸小插件((bushi( (低性能警告)。手机端适配。灵感来自 chat 插件。",
4
+ "version": "2.3.0",
5
+ "main": "lib/index.js",
6
+ "typings": "lib/index.d.ts",
7
+ "files": [
8
+ "client",
9
+ "dist",
10
+ "lib",
11
+ "src"
12
+ ],
13
+ "license": "MIT",
14
+ "homepage": "https://github.com/koishi-shangxue-plugins/koishi-shangxue-apps/",
15
+ "bugs": {
16
+ "url": "https://github.com/koishi-shangxue-plugins/koishi-shangxue-apps/issues"
17
+ },
18
+ "contributors": [
19
+ "shangxueink <1919892171@qq.com>"
20
+ ],
21
+ "keywords": [
22
+ "koishi",
23
+ "plugin",
24
+ "chat",
25
+ "聊天室",
26
+ "console"
27
+ ],
28
+ "koishi": {
29
+ "service": {
30
+ "required": [
31
+ "console"
32
+ ]
33
+ }
34
+ },
35
+ "peerDependencies": {
36
+ "@koishijs/plugin-console": "^5.11.0",
37
+ "koishi": "^4.16.0"
38
+ },
39
+ "devDependencies": {
40
+ "@koishijs/client": "^5.11.0",
41
+ "@types/mime-types": "^3.0.1",
42
+ "autoprefixer": "^10.4.23",
43
+ "koishi": "^4.16.0",
44
+ "postcss": "^8.5.6",
45
+ "tailwindcss": "^3.4.17"
46
+ },
47
+ "dependencies": {
48
+ "@element-plus/icons-vue": "^2.3.2",
49
+ "element-plus": "^2.13.0",
50
+ "mime-types": "^3.0.2"
51
+ }
52
+ }
package/readme.md CHANGED
@@ -1,25 +1,25 @@
1
- # koishi-plugin-chat-patch
2
-
3
- [![npm](https://img.shields.io/npm/v/koishi-plugin-chat-patch?style=flat-square)](https://www.npmjs.com/package/koishi-plugin-chat-patch) [![npm downloads](https://img.shields.io/npm/dm/koishi-plugin-chat-patch)](https://www.npmjs.com/package/koishi-plugin-chat-patch)
4
-
5
- Koishi 控制台聊天插件,允许用户直接在控制台中管理机器人、频道和消息。
6
-
7
- 支持消息的收发、图片缓存、频道置顶等。
8
-
9
- ## ✨ 功能特性
10
-
11
- - **聊天界面**:在 Koishi 控制台内直接查看机器人的聊天记录。
12
- - **消息收发**:支持接收文本、图片等多种类型的消息。
13
- - **图片缓存**:通过 IndexedDB 缓存图片,优化加载速度并减少网络请求。
14
- - **手机端优化**:针对手机端进行适配,提供滑动返回等手势操作,并可配置聊天容器高度以防止输入框被遮挡。
15
- - **平台屏蔽**:可配置屏蔽特定平台的消息,避免不必要的干扰。
16
-
17
- ## 🛠️ 开发与贡献
18
-
19
- 欢迎 PR ~
20
-
21
- PR 方式请参考 -> <https://github.com/koishi-shangxue-plugins/koishi-shangxue-apps/tree/main?tab=readme-ov-file#%E5%A6%82%E4%BD%95%E5%9C%A8%E9%A1%B9%E7%9B%AE%E6%A8%A1%E6%9D%BF%E4%B8%AD%E5%BC%80%E5%8F%91%E6%AD%A4%E4%BB%93%E5%BA%93>
22
-
23
- ## 许可证
24
-
25
- 本项目采用 [MIT 许可证](LICENSE) 开源。
1
+ # koishi-plugin-chat-patch
2
+
3
+ [![npm](https://img.shields.io/npm/v/koishi-plugin-chat-patch?style=flat-square)](https://www.npmjs.com/package/koishi-plugin-chat-patch) [![npm downloads](https://img.shields.io/npm/dm/koishi-plugin-chat-patch)](https://www.npmjs.com/package/koishi-plugin-chat-patch)
4
+
5
+ Koishi 控制台聊天插件,允许用户直接在控制台中管理机器人、频道和消息。
6
+
7
+ 支持消息的收发、图片缓存、频道置顶等。
8
+
9
+ ## ✨ 功能特性
10
+
11
+ - **聊天界面**:在 Koishi 控制台内直接查看机器人的聊天记录。
12
+ - **消息收发**:支持接收文本、图片等多种类型的消息。
13
+ - **图片缓存**:通过 IndexedDB 缓存图片,优化加载速度并减少网络请求。
14
+ - **手机端优化**:针对手机端进行适配,提供滑动返回等手势操作,并可配置聊天容器高度以防止输入框被遮挡。
15
+ - **平台屏蔽**:可配置屏蔽特定平台的消息,避免不必要的干扰。
16
+
17
+ ## 🛠️ 开发与贡献
18
+
19
+ 欢迎 PR ~
20
+
21
+ PR 方式请参考 -> <https://github.com/koishi-shangxue-plugins/koishi-shangxue-apps/tree/main?tab=readme-ov-file#%E5%A6%82%E4%BD%95%E5%9C%A8%E9%A1%B9%E7%9B%AE%E6%A8%A1%E6%9D%BF%E4%B8%AD%E5%BC%80%E5%8F%91%E6%AD%A4%E4%BB%93%E5%BA%93>
22
+
23
+ ## 许可证
24
+
25
+ 本项目采用 [MIT 许可证](LICENSE) 开源。