@zhin.js/adapter-onebot12 4.0.3 → 4.0.5

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,33 @@
1
1
  # @zhin.js/adapter-onebot12
2
2
 
3
+ ## 4.0.5
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
+ ## 4.0.4
23
+
24
+ ### Patch Changes
25
+
26
+ - Updated dependencies [d8bf702]
27
+ - @zhin.js/host-http@1.0.4
28
+ - @zhin.js/core@1.4.3
29
+ - zhin.js@5.0.3
30
+
3
31
  ## 4.0.3
4
32
 
5
33
  ### Patch Changes
@@ -21,6 +21,7 @@ export declare class OneBot12WsEndpoint 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 management surface / callers. */
25
26
  callApi(action: string, params?: Record<string, unknown>): Promise<unknown>;
26
27
  /** Test / internal: admit a parsed event when the endpoint is open. */
@@ -89,6 +89,11 @@ export class OneBot12WsEndpoint {
89
89
  }));
90
90
  return messageId;
91
91
  }
92
+ async recallMessage(messageId) {
93
+ if (!messageId)
94
+ return;
95
+ await this.#callAction('delete_message', { message_id: messageId });
96
+ }
92
97
  /** Public API for management surface / callers. */
93
98
  callApi(action, params = {}) {
94
99
  return this.#callAction(action, params);
@@ -21,6 +21,7 @@ export declare class OneBot12WssEndpoint 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 management surface / callers. */
25
26
  callApi(action: string, params?: Record<string, unknown>): Promise<unknown>;
26
27
  admit(ev: OneBot12Event): void;
@@ -88,6 +88,11 @@ export class OneBot12WssEndpoint {
88
88
  const data = await this.#callAction('send_message', params);
89
89
  return data?.message_id ?? '';
90
90
  }
91
+ async recallMessage(messageId) {
92
+ if (!messageId)
93
+ return;
94
+ await this.#callAction('delete_message', { message_id: messageId });
95
+ }
91
96
  /** Public API for management surface / callers. */
92
97
  callApi(action, params = {}) {
93
98
  return this.#callAction(action, params);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zhin.js/adapter-onebot12",
3
- "version": "4.0.3",
3
+ "version": "4.0.5",
4
4
  "description": "Zhin.js OneBot 12 adapter for Plugin Runtime (WebSocket client)",
5
5
  "type": "module",
6
6
  "main": "./lib/index.js",
@@ -39,20 +39,20 @@
39
39
  "directory": "plugins/adapters/onebot12"
40
40
  },
41
41
  "dependencies": {
42
- "ws": "^8.21.0",
42
+ "ws": "^8.21.1",
43
43
  "@zhin.js/adapter": "1.1.2",
44
44
  "@zhin.js/command": "1.0.4",
45
45
  "@zhin.js/core": "1.4.3",
46
- "@zhin.js/host-http": "1.0.3",
46
+ "@zhin.js/host-http": "1.0.4",
47
47
  "@zhin.js/logger": "1.0.75",
48
48
  "@zhin.js/plugin-runtime": "1.1.1"
49
49
  },
50
50
  "devDependencies": {
51
- "@types/node": "^26.1.0",
51
+ "@types/node": "^26.1.2",
52
52
  "@types/ws": "^8.18.1",
53
53
  "typescript": "^6.0.3",
54
54
  "vitest": "^4.1.10",
55
- "@zhin.js/host-http": "1.0.3"
55
+ "@zhin.js/host-http": "1.0.4"
56
56
  },
57
57
  "peerDependencies": {
58
58
  "@zhin.js/adapter": "1.1.2",
@@ -140,6 +140,11 @@ export class OneBot12WsEndpoint implements EndpointInstance {
140
140
  return messageId;
141
141
  }
142
142
 
143
+ async recallMessage(messageId: string): Promise<void> {
144
+ if (!messageId) return;
145
+ await this.#callAction('delete_message', { message_id: messageId });
146
+ }
147
+
143
148
  /** Public API for management surface / callers. */
144
149
  callApi(action: string, params: Record<string, unknown> = {}): Promise<unknown> {
145
150
  return this.#callAction(action, params);
@@ -128,6 +128,11 @@ export class OneBot12WssEndpoint implements EndpointInstance {
128
128
  return data?.message_id ?? '';
129
129
  }
130
130
 
131
+ async recallMessage(messageId: string): Promise<void> {
132
+ if (!messageId) return;
133
+ await this.#callAction('delete_message', { message_id: messageId });
134
+ }
135
+
131
136
  /** Public API for management surface / callers. */
132
137
  callApi(action: string, params: Record<string, unknown> = {}): Promise<unknown> {
133
138
  return this.#callAction(action, params);