@zhin.js/adapter-napcat 5.0.5 → 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 +19 -0
- package/lib/http-endpoint.d.ts +1 -0
- package/lib/http-endpoint.js +5 -0
- package/lib/ws-endpoint.d.ts +1 -0
- package/lib/ws-endpoint.js +5 -0
- package/lib/wss-endpoint.d.ts +1 -0
- package/lib/wss-endpoint.js +5 -0
- package/package.json +1 -1
- package/src/http-endpoint.ts +5 -0
- package/src/ws-endpoint.ts +5 -0
- package/src/wss-endpoint.ts +5 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# @zhin.js/adapter-napcat
|
|
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
|
+
|
|
3
22
|
## 5.0.5
|
|
4
23
|
|
|
5
24
|
### Patch Changes
|
package/lib/http-endpoint.d.ts
CHANGED
|
@@ -22,6 +22,7 @@ export declare class NapCatHttpEndpoint implements EndpointInstance {
|
|
|
22
22
|
readonly target: string;
|
|
23
23
|
readonly payload: unknown;
|
|
24
24
|
}): Promise<string>;
|
|
25
|
+
recallMessage(messageId: string): Promise<void>;
|
|
25
26
|
callApi(action: string, params?: Record<string, unknown>): Promise<unknown>;
|
|
26
27
|
admit(ev: NapCatEvent): void;
|
|
27
28
|
}
|
package/lib/http-endpoint.js
CHANGED
|
@@ -65,6 +65,11 @@ export class NapCatHttpEndpoint {
|
|
|
65
65
|
}));
|
|
66
66
|
return messageId;
|
|
67
67
|
}
|
|
68
|
+
async recallMessage(messageId) {
|
|
69
|
+
if (!messageId)
|
|
70
|
+
return;
|
|
71
|
+
await this.callApi('delete_msg', { message_id: Number(messageId) });
|
|
72
|
+
}
|
|
68
73
|
callApi(action, params = {}) {
|
|
69
74
|
return this.#callHttpAction({
|
|
70
75
|
http_url: this.#options.config.http_url,
|
package/lib/ws-endpoint.d.ts
CHANGED
|
@@ -21,6 +21,7 @@ export declare class NapCatWsEndpoint 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
|
sendLike(userId: number, times?: number): Promise<unknown>;
|
package/lib/ws-endpoint.js
CHANGED
|
@@ -83,6 +83,11 @@ export class NapCatWsEndpoint {
|
|
|
83
83
|
}));
|
|
84
84
|
return messageId;
|
|
85
85
|
}
|
|
86
|
+
async recallMessage(messageId) {
|
|
87
|
+
if (!messageId)
|
|
88
|
+
return;
|
|
89
|
+
await this.callApi('delete_msg', { message_id: Number(messageId) });
|
|
90
|
+
}
|
|
86
91
|
callApi(action, params = {}) {
|
|
87
92
|
return callNapCatWsAction(this.#ws, this.#pending, this.#requestId, action, params);
|
|
88
93
|
}
|
package/lib/wss-endpoint.d.ts
CHANGED
|
@@ -21,6 +21,7 @@ export declare class NapCatWssEndpoint 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
|
admit(ev: NapCatEvent): void;
|
|
26
27
|
}
|
package/lib/wss-endpoint.js
CHANGED
|
@@ -76,6 +76,11 @@ export class NapCatWssEndpoint {
|
|
|
76
76
|
const data = await this.callApi(action, params);
|
|
77
77
|
return data?.message_id != null ? String(data.message_id) : '';
|
|
78
78
|
}
|
|
79
|
+
async recallMessage(messageId) {
|
|
80
|
+
if (!messageId)
|
|
81
|
+
return;
|
|
82
|
+
await this.callApi('delete_msg', { message_id: Number(messageId) });
|
|
83
|
+
}
|
|
79
84
|
callApi(action, params = {}) {
|
|
80
85
|
return callNapCatWsAction(this.#ws, this.#pending, this.#requestId, action, params);
|
|
81
86
|
}
|
package/package.json
CHANGED
package/src/http-endpoint.ts
CHANGED
|
@@ -112,6 +112,11 @@ export class NapCatHttpEndpoint implements EndpointInstance {
|
|
|
112
112
|
return messageId;
|
|
113
113
|
}
|
|
114
114
|
|
|
115
|
+
async recallMessage(messageId: string): Promise<void> {
|
|
116
|
+
if (!messageId) return;
|
|
117
|
+
await this.callApi('delete_msg', { message_id: Number(messageId) });
|
|
118
|
+
}
|
|
119
|
+
|
|
115
120
|
callApi(action: string, params: Record<string, unknown> = {}): Promise<unknown> {
|
|
116
121
|
return this.#callHttpAction(
|
|
117
122
|
{
|
package/src/ws-endpoint.ts
CHANGED
|
@@ -132,6 +132,11 @@ export class NapCatWsEndpoint implements EndpointInstance {
|
|
|
132
132
|
return messageId;
|
|
133
133
|
}
|
|
134
134
|
|
|
135
|
+
async recallMessage(messageId: string): Promise<void> {
|
|
136
|
+
if (!messageId) return;
|
|
137
|
+
await this.callApi('delete_msg', { message_id: Number(messageId) });
|
|
138
|
+
}
|
|
139
|
+
|
|
135
140
|
callApi(action: string, params: Record<string, unknown> = {}): Promise<unknown> {
|
|
136
141
|
return callNapCatWsAction(this.#ws, this.#pending, this.#requestId, action, params);
|
|
137
142
|
}
|
package/src/wss-endpoint.ts
CHANGED
|
@@ -122,6 +122,11 @@ export class NapCatWssEndpoint implements EndpointInstance {
|
|
|
122
122
|
return data?.message_id != null ? String(data.message_id) : '';
|
|
123
123
|
}
|
|
124
124
|
|
|
125
|
+
async recallMessage(messageId: string): Promise<void> {
|
|
126
|
+
if (!messageId) return;
|
|
127
|
+
await this.callApi('delete_msg', { message_id: Number(messageId) });
|
|
128
|
+
}
|
|
129
|
+
|
|
125
130
|
callApi(action: string, params: Record<string, unknown> = {}): Promise<unknown> {
|
|
126
131
|
return callNapCatWsAction(this.#ws, this.#pending, this.#requestId, action, params);
|
|
127
132
|
}
|