@zhin.js/adapter-onebot11 5.0.4 → 5.0.6

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/CHANGELOG.md CHANGED
@@ -1,5 +1,34 @@
1
1
  # @zhin.js/adapter-onebot11
2
2
 
3
+ ## 5.0.6
4
+
5
+ ### Patch Changes
6
+
7
+ - d52f3c5: fix: QQ 适配器群聊误识别为私聊、game-kit 启动崩溃、全面补齐 recallMessage
8
+
9
+ - fix(cli): `resolveChannelType` 增加 `metadata.channelKind` 检查,修复 QQ/Discord/KOOK 群聊消息被误分类为私聊
10
+ - fix(game-kit): `createHostGameDb` 改用延迟代理模型,避免数据库启动前解析模型导致崩溃
11
+ - feat(qq): 实现 `recallMessage`,解析复合 messageId 路由到对应 SDK 撤回方法;`normalizeQqMessage` 增加 `message_type` 缺失时的回退检测
12
+ - feat(slack): 实现 `recallMessage`,利用已有 compound ref 和 `chat.delete` API
13
+ - feat(onebot11): 两个 endpoint 类实现 `recallMessage`(`delete_msg`)
14
+ - feat(onebot12): 两个 endpoint 类实现 `recallMessage`(`delete_message`)
15
+ - feat(napcat): 三个 endpoint 类实现 `recallMessage`(`delete_msg`)
16
+ - feat(discord): 两个 endpoint 类实现 `recallMessage`;`send()` 改为返回 `channelId:snowflake` 复合 ID
17
+ - feat(telegram): 实现 `recallMessage`(`deleteMessage`);`send()` 改为返回 `chatId:messageId` 复合 ID
18
+ - feat(kook): 两个 endpoint 类实现 `recallMessage`,利用 kook-client `recallMsg` API
19
+ - feat(lark): 实现 `recallMessage`(`DELETE /im/v1/messages/{id}`)
20
+ - feat(wecom): 实现 `recallMessage`(`POST /cgi-bin/message/recall`)
21
+
22
+ ## 5.0.5
23
+
24
+ ### Patch Changes
25
+
26
+ - Updated dependencies [d8bf702]
27
+ - @zhin.js/host-http@1.0.4
28
+ - @zhin.js/agent@1.0.10
29
+ - @zhin.js/core@1.4.3
30
+ - zhin.js@5.0.3
31
+
3
32
  ## 5.0.4
4
33
 
5
34
  ### Patch Changes
@@ -21,6 +21,7 @@ export declare class OneBot11WsEndpoint implements EndpointInstance {
21
21
  readonly target: string;
22
22
  readonly payload: unknown;
23
23
  }): Promise<string>;
24
+ recallMessage(messageId: string): Promise<void>;
24
25
  /** Public API for agent tools / callers. */
25
26
  callApi(action: string, params?: Record<string, unknown>): Promise<unknown>;
26
27
  setTitle(groupId: number, userId: number, title: string, duration?: number): Promise<boolean>;
@@ -85,6 +85,11 @@ export class OneBot11WsEndpoint {
85
85
  }));
86
86
  return messageId;
87
87
  }
88
+ async recallMessage(messageId) {
89
+ if (!messageId)
90
+ return;
91
+ await this.callApi('delete_msg', { message_id: Number(messageId) });
92
+ }
88
93
  /** Public API for agent tools / callers. */
89
94
  callApi(action, params = {}) {
90
95
  return callOneBot11WsAction(this.#ws, this.#pending, this.#requestId, action, params);
@@ -21,6 +21,7 @@ export declare class OneBot11WssEndpoint implements EndpointInstance {
21
21
  readonly target: string;
22
22
  readonly payload: unknown;
23
23
  }): Promise<string>;
24
+ recallMessage(messageId: string): Promise<void>;
24
25
  callApi(action: string, params?: Record<string, unknown>): Promise<unknown>;
25
26
  setTitle(groupId: number, userId: number, title: string, duration?: number): Promise<boolean>;
26
27
  admit(ev: OneBot11Event): void;
@@ -82,6 +82,11 @@ export class OneBot11WssEndpoint {
82
82
  const data = await this.callApi(action, params);
83
83
  return data?.message_id != null ? String(data.message_id) : '';
84
84
  }
85
+ async recallMessage(messageId) {
86
+ if (!messageId)
87
+ return;
88
+ await this.callApi('delete_msg', { message_id: Number(messageId) });
89
+ }
85
90
  callApi(action, params = {}) {
86
91
  return callOneBot11WsAction(this.#ws, this.#pending, this.#requestId, action, params);
87
92
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zhin.js/adapter-onebot11",
3
- "version": "5.0.4",
3
+ "version": "5.0.6",
4
4
  "description": "Zhin.js OneBot 11 adapter for Plugin Runtime (WebSocket client)",
5
5
  "type": "module",
6
6
  "main": "./lib/index.js",
@@ -40,30 +40,30 @@
40
40
  "directory": "plugins/adapters/onebot11"
41
41
  },
42
42
  "dependencies": {
43
- "ws": "^8.21.0",
43
+ "ws": "^8.21.1",
44
44
  "@zhin.js/adapter": "1.1.2",
45
45
  "@zhin.js/command": "1.0.4",
46
46
  "@zhin.js/core": "1.4.3",
47
- "@zhin.js/host-http": "1.0.3",
47
+ "@zhin.js/host-http": "1.0.4",
48
48
  "@zhin.js/logger": "1.0.75",
49
49
  "@zhin.js/plugin-runtime": "1.1.1"
50
50
  },
51
51
  "devDependencies": {
52
- "@types/node": "^26.1.0",
52
+ "@types/node": "^26.1.2",
53
53
  "@types/ws": "^8.18.1",
54
54
  "typescript": "^6.0.3",
55
55
  "vitest": "^4.1.10",
56
56
  "zod": "^4.4.3",
57
- "@zhin.js/agent": "1.0.9",
58
- "@zhin.js/host-http": "1.0.3"
57
+ "@zhin.js/agent": "1.0.10",
58
+ "@zhin.js/host-http": "1.0.4"
59
59
  },
60
60
  "peerDependencies": {
61
61
  "zod": "^4.0.0",
62
62
  "@zhin.js/adapter": "1.1.2",
63
+ "@zhin.js/agent": "1.0.10",
63
64
  "@zhin.js/core": "1.4.3",
64
- "zhin.js": "5.0.3",
65
65
  "@zhin.js/plugin-runtime": "1.1.1",
66
- "@zhin.js/agent": "1.0.9"
66
+ "zhin.js": "5.0.3"
67
67
  },
68
68
  "peerDependenciesMeta": {
69
69
  "zhin.js": {
@@ -129,6 +129,11 @@ export class OneBot11WsEndpoint implements EndpointInstance {
129
129
  return messageId;
130
130
  }
131
131
 
132
+ async recallMessage(messageId: string): Promise<void> {
133
+ if (!messageId) return;
134
+ await this.callApi('delete_msg', { message_id: Number(messageId) });
135
+ }
136
+
132
137
  /** Public API for agent tools / callers. */
133
138
  callApi(action: string, params: Record<string, unknown> = {}): Promise<unknown> {
134
139
  return callOneBot11WsAction(this.#ws, this.#pending, this.#requestId, action, params);
@@ -123,6 +123,11 @@ export class OneBot11WssEndpoint implements EndpointInstance {
123
123
  return data?.message_id != null ? String(data.message_id) : '';
124
124
  }
125
125
 
126
+ async recallMessage(messageId: string): Promise<void> {
127
+ if (!messageId) return;
128
+ await this.callApi('delete_msg', { message_id: Number(messageId) });
129
+ }
130
+
126
131
  callApi(action: string, params: Record<string, unknown> = {}): Promise<unknown> {
127
132
  return callOneBot11WsAction(this.#ws, this.#pending, this.#requestId, action, params);
128
133
  }