@zhin.js/adapter-icqq 6.0.1 → 6.0.3
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 +59 -0
- package/README.md +32 -437
- package/adapters/icqq.ts +30 -0
- package/agent/tools/announce.ts +21 -0
- package/agent/tools/essence.ts +22 -0
- package/agent/tools/friend_list.ts +19 -0
- package/agent/tools/group_files.ts +27 -0
- package/agent/tools/group_invite.ts +20 -0
- package/agent/tools/group_list.ts +20 -0
- package/agent/tools/group_sign.ts +19 -0
- package/agent/tools/list_muted.ts +22 -0
- package/agent/tools/poke.ts +20 -0
- package/agent/tools/send_user_like.ts +22 -0
- package/agent/tools/set_anonymous.ts +22 -0
- package/agent/tools/set_title.ts +25 -0
- package/lib/agent-prompt.d.ts +0 -1
- package/lib/agent-prompt.js +0 -1
- package/lib/cq-message.d.ts +0 -1
- package/lib/cq-message.js +0 -1
- package/lib/endpoint.d.ts +45 -97
- package/lib/endpoint.js +357 -628
- package/lib/forward-msg.d.ts +1 -2
- package/lib/forward-msg.js +4 -2
- package/lib/icqq-agent-deps.d.ts +25 -0
- package/lib/icqq-agent-deps.js +32 -0
- package/lib/icqq-guild.d.ts +1 -2
- package/lib/icqq-guild.js +4 -2
- package/lib/icqq-inbound.d.ts +10 -1
- package/lib/icqq-inbound.js +27 -3
- package/lib/index.d.ts +6 -18
- package/lib/index.js +6 -50
- package/lib/ipc-client.d.ts +0 -1
- package/lib/ipc-client.js +0 -1
- package/lib/outbound-media.d.ts +0 -1
- package/lib/outbound-media.js +0 -1
- package/lib/protocol.d.ts +73 -2
- package/lib/protocol.js +124 -2
- package/lib/types.d.ts +0 -1
- package/lib/types.js +0 -1
- package/package.json +51 -43
- package/plugin.ts +32 -0
- package/schema.json +35 -0
- package/src/agent-prompt.ts +1 -2
- package/src/endpoint.ts +399 -800
- package/src/forward-msg.ts +2 -2
- package/src/icqq-agent-deps.ts +57 -0
- package/src/icqq-guild.ts +1 -2
- package/src/icqq-inbound.ts +31 -2
- package/src/index.ts +35 -69
- package/src/protocol.ts +191 -1
- package/client/ICQQManagement.tsx +0 -147
- package/client/LoginAssistPanel.tsx +0 -300
- package/client/index.tsx +0 -11
- package/client/tsconfig.json +0 -7
- package/client/utils/api.ts +0 -30
- package/dist/index.js +0 -34
- package/lib/adapter.d.ts +0 -46
- package/lib/adapter.d.ts.map +0 -1
- package/lib/adapter.js +0 -128
- package/lib/adapter.js.map +0 -1
- package/lib/agent-prompt.d.ts.map +0 -1
- package/lib/agent-prompt.js.map +0 -1
- package/lib/cq-message.d.ts.map +0 -1
- package/lib/cq-message.js.map +0 -1
- package/lib/endpoint.d.ts.map +0 -1
- package/lib/endpoint.js.map +0 -1
- package/lib/forward-msg.d.ts.map +0 -1
- package/lib/forward-msg.js.map +0 -1
- package/lib/get-msg.d.ts +0 -3
- package/lib/get-msg.d.ts.map +0 -1
- package/lib/get-msg.js +0 -46
- package/lib/get-msg.js.map +0 -1
- package/lib/icqq-guild.d.ts.map +0 -1
- package/lib/icqq-guild.js.map +0 -1
- package/lib/icqq-inbound.d.ts.map +0 -1
- package/lib/icqq-inbound.js.map +0 -1
- package/lib/icqq-login-assist-bridge.d.ts +0 -5
- package/lib/icqq-login-assist-bridge.d.ts.map +0 -1
- package/lib/icqq-login-assist-bridge.js +0 -148
- package/lib/icqq-login-assist-bridge.js.map +0 -1
- package/lib/icqq-side-events.d.ts +0 -34
- package/lib/icqq-side-events.d.ts.map +0 -1
- package/lib/icqq-side-events.js +0 -194
- package/lib/icqq-side-events.js.map +0 -1
- package/lib/index.d.ts.map +0 -1
- package/lib/index.js.map +0 -1
- package/lib/ipc-client.d.ts.map +0 -1
- package/lib/ipc-client.js.map +0 -1
- package/lib/login-assist-routes.d.ts +0 -7
- package/lib/login-assist-routes.d.ts.map +0 -1
- package/lib/login-assist-routes.js +0 -29
- package/lib/login-assist-routes.js.map +0 -1
- package/lib/login-ipc-contract.d.ts +0 -44
- package/lib/login-ipc-contract.d.ts.map +0 -1
- package/lib/login-ipc-contract.js +0 -35
- package/lib/login-ipc-contract.js.map +0 -1
- package/lib/outbound-media.d.ts.map +0 -1
- package/lib/outbound-media.js.map +0 -1
- package/lib/protocol.d.ts.map +0 -1
- package/lib/protocol.js.map +0 -1
- package/lib/routes.d.ts +0 -8
- package/lib/routes.d.ts.map +0 -1
- package/lib/routes.js +0 -67
- package/lib/routes.js.map +0 -1
- package/lib/segment-mapper.d.ts +0 -2
- package/lib/segment-mapper.d.ts.map +0 -1
- package/lib/segment-mapper.js +0 -2
- package/lib/segment-mapper.js.map +0 -1
- package/lib/tools/index.d.ts +0 -10
- package/lib/tools/index.d.ts.map +0 -1
- package/lib/tools/index.js +0 -341
- package/lib/tools/index.js.map +0 -1
- package/lib/types.d.ts.map +0 -1
- package/lib/types.js.map +0 -1
- package/plugin.yml +0 -3
- package/src/adapter.ts +0 -151
- package/src/get-msg.ts +0 -56
- package/src/icqq-login-assist-bridge.ts +0 -196
- package/src/icqq-side-events.ts +0 -228
- package/src/login-assist-routes.ts +0 -39
- package/src/login-ipc-contract.ts +0 -52
- package/src/routes.ts +0 -83
- package/src/segment-mapper.ts +0 -1
- package/src/tools/index.ts +0 -412
- /package/{skills/icqq → agent}/PERMITS.md +0 -0
package/lib/tools/index.js
DELETED
|
@@ -1,341 +0,0 @@
|
|
|
1
|
-
import { createSceneManagementTools } from "zhin.js";
|
|
2
|
-
import { Actions } from "../protocol.js";
|
|
3
|
-
export function registerTools(toolService, icqq, pluginName) {
|
|
4
|
-
const disposers = [];
|
|
5
|
-
// ── 通用群管工具 ───────────────────────────────────────────────────
|
|
6
|
-
const sceneTools = createSceneManagementTools(icqq, "icqq");
|
|
7
|
-
disposers.push(...sceneTools.map((t) => toolService.addTool(t, pluginName)));
|
|
8
|
-
// ── 设置头衔 ───────────────────────────────────────────────────────
|
|
9
|
-
disposers.push(toolService.addTool({
|
|
10
|
-
name: "icqq_set_title",
|
|
11
|
-
description: "设置 QQ 群成员的专属头衔",
|
|
12
|
-
parameters: {
|
|
13
|
-
type: "object",
|
|
14
|
-
properties: {
|
|
15
|
-
endpoint_id: { type: "string", description: "Endpoint QQ号", contextKey: 'endpointId' },
|
|
16
|
-
group_id: { type: "number", description: "目标群号" },
|
|
17
|
-
user_id: { type: "number", description: "目标成员 QQ号" },
|
|
18
|
-
title: { type: "string", description: "头衔文字" },
|
|
19
|
-
duration: { type: "number", description: "持续时间(秒),-1永久" },
|
|
20
|
-
},
|
|
21
|
-
required: ["endpoint_id", "group_id", "user_id", "title"],
|
|
22
|
-
},
|
|
23
|
-
platforms: ["icqq"],
|
|
24
|
-
tags: ["icqq"],
|
|
25
|
-
permissions: ["platform(icqq,scene_owner)"],
|
|
26
|
-
execute: async (args) => {
|
|
27
|
-
const endpoint = icqq.endpoints.get(args.endpoint_id);
|
|
28
|
-
if (!endpoint)
|
|
29
|
-
throw new Error(`Endpoint ${args.endpoint_id} 不存在`);
|
|
30
|
-
const resp = await endpoint.ipc.request(Actions.SET_GROUP_TITLE, {
|
|
31
|
-
group_id: args.group_id,
|
|
32
|
-
user_id: args.user_id,
|
|
33
|
-
title: args.title,
|
|
34
|
-
duration: args.duration ?? -1,
|
|
35
|
-
});
|
|
36
|
-
return { success: resp.ok, message: resp.ok ? `已将 ${args.user_id} 的头衔设为 "${args.title}"` : (resp.error ?? "设置失败") };
|
|
37
|
-
},
|
|
38
|
-
}, pluginName));
|
|
39
|
-
// ── 发送群公告 ─────────────────────────────────────────────────────
|
|
40
|
-
disposers.push(toolService.addTool({
|
|
41
|
-
name: "icqq_announce",
|
|
42
|
-
description: "发送 QQ 群公告(需要管理员权限)",
|
|
43
|
-
parameters: {
|
|
44
|
-
type: "object",
|
|
45
|
-
properties: {
|
|
46
|
-
endpoint_id: { type: "string", description: "Endpoint QQ号", contextKey: 'endpointId' },
|
|
47
|
-
group_id: { type: "number", description: "目标群号" },
|
|
48
|
-
content: { type: "string", description: "公告内容" },
|
|
49
|
-
},
|
|
50
|
-
required: ["endpoint_id", "group_id", "content"],
|
|
51
|
-
},
|
|
52
|
-
platforms: ["icqq"],
|
|
53
|
-
tags: ["icqq"],
|
|
54
|
-
permissions: ["platform(icqq,scene_admin)"],
|
|
55
|
-
execute: async (args) => {
|
|
56
|
-
const endpoint = icqq.endpoints.get(args.endpoint_id);
|
|
57
|
-
if (!endpoint)
|
|
58
|
-
throw new Error(`Endpoint ${args.endpoint_id} 不存在`);
|
|
59
|
-
const resp = await endpoint.ipc.request(Actions.GROUP_ANNOUNCE, {
|
|
60
|
-
group_id: args.group_id,
|
|
61
|
-
content: args.content,
|
|
62
|
-
});
|
|
63
|
-
return { success: resp.ok, message: resp.ok ? "群公告已发送" : (resp.error ?? "发送失败") };
|
|
64
|
-
},
|
|
65
|
-
}, pluginName));
|
|
66
|
-
// ── 戳一戳 ─────────────────────────────────────────────────────────
|
|
67
|
-
disposers.push(toolService.addTool({
|
|
68
|
-
name: "icqq_poke",
|
|
69
|
-
description: "在 QQ 群中对某个成员执行戳一戳互动操作",
|
|
70
|
-
parameters: {
|
|
71
|
-
type: "object",
|
|
72
|
-
properties: {
|
|
73
|
-
endpoint_id: { type: "string", description: "Endpoint QQ号", contextKey: 'endpointId' },
|
|
74
|
-
group_id: { type: "number", description: "目标群号" },
|
|
75
|
-
user_id: { type: "number", description: "要戳的目标成员 QQ号" },
|
|
76
|
-
},
|
|
77
|
-
required: ["endpoint_id", "group_id", "user_id"],
|
|
78
|
-
},
|
|
79
|
-
platforms: ["icqq"],
|
|
80
|
-
tags: ["icqq"],
|
|
81
|
-
execute: async (args) => {
|
|
82
|
-
const endpoint = icqq.endpoints.get(args.endpoint_id);
|
|
83
|
-
if (!endpoint)
|
|
84
|
-
throw new Error(`Endpoint ${args.endpoint_id} 不存在`);
|
|
85
|
-
const resp = await endpoint.ipc.request(Actions.GROUP_POKE, {
|
|
86
|
-
group_id: args.group_id,
|
|
87
|
-
user_id: args.user_id,
|
|
88
|
-
});
|
|
89
|
-
return { success: resp.ok, message: resp.ok ? `已戳了戳 ${args.user_id}` : (resp.error ?? "戳一戳失败") };
|
|
90
|
-
},
|
|
91
|
-
}, pluginName));
|
|
92
|
-
// ── 获取被禁言列表 ─────────────────────────────────────────────────
|
|
93
|
-
disposers.push(toolService.addTool({
|
|
94
|
-
name: "icqq_list_muted",
|
|
95
|
-
description: "查询 QQ 群中当前被禁言的成员列表",
|
|
96
|
-
parameters: {
|
|
97
|
-
type: "object",
|
|
98
|
-
properties: {
|
|
99
|
-
endpoint_id: { type: "string", description: "Endpoint QQ号", contextKey: 'endpointId' },
|
|
100
|
-
group_id: { type: "number", description: "目标群号" },
|
|
101
|
-
},
|
|
102
|
-
required: ["endpoint_id", "group_id"],
|
|
103
|
-
},
|
|
104
|
-
platforms: ["icqq"],
|
|
105
|
-
tags: ["icqq"],
|
|
106
|
-
permissions: ["platform(icqq,scene_admin)"],
|
|
107
|
-
execute: async (args) => {
|
|
108
|
-
const endpoint = icqq.endpoints.get(args.endpoint_id);
|
|
109
|
-
if (!endpoint)
|
|
110
|
-
throw new Error(`Endpoint ${args.endpoint_id} 不存在`);
|
|
111
|
-
const resp = await endpoint.ipc.request(Actions.GROUP_MUTED_LIST, {
|
|
112
|
-
group_id: args.group_id,
|
|
113
|
-
});
|
|
114
|
-
if (!resp.ok)
|
|
115
|
-
throw new Error(resp.error ?? "获取禁言列表失败");
|
|
116
|
-
const list = Array.isArray(resp.data) ? resp.data : [];
|
|
117
|
-
return { muted_members: list, count: list.length };
|
|
118
|
-
},
|
|
119
|
-
}, pluginName));
|
|
120
|
-
// ── 给用户点赞 ─────────────────────────────────────────────────────
|
|
121
|
-
disposers.push(toolService.addTool({
|
|
122
|
-
name: "icqq_send_user_like",
|
|
123
|
-
description: "给用户点赞(竖大拇指),每人每天最多 20 次",
|
|
124
|
-
parameters: {
|
|
125
|
-
type: "object",
|
|
126
|
-
properties: {
|
|
127
|
-
endpoint_id: { type: "string", description: "Endpoint QQ号", contextKey: 'endpointId' },
|
|
128
|
-
user_id: { type: "number", description: "要点赞的目标用户 QQ号" },
|
|
129
|
-
times: { type: "number", description: "点赞次数(1-20),默认 1" },
|
|
130
|
-
},
|
|
131
|
-
required: ["endpoint_id", "user_id"],
|
|
132
|
-
},
|
|
133
|
-
platforms: ["icqq"],
|
|
134
|
-
tags: ["icqq"],
|
|
135
|
-
execute: async (args) => {
|
|
136
|
-
const endpoint = icqq.endpoints.get(args.endpoint_id);
|
|
137
|
-
if (!endpoint)
|
|
138
|
-
throw new Error(`Endpoint ${args.endpoint_id} 不存在`);
|
|
139
|
-
const resp = await endpoint.ipc.request(Actions.FRIEND_LIKE, {
|
|
140
|
-
user_id: args.user_id,
|
|
141
|
-
times: Math.min(args.times ?? 1, 20),
|
|
142
|
-
});
|
|
143
|
-
return { success: resp.ok, message: resp.ok ? `已给 ${args.user_id} 点赞` : (resp.error ?? "点赞失败") };
|
|
144
|
-
},
|
|
145
|
-
}, pluginName));
|
|
146
|
-
// ── 设置匿名聊天 ───────────────────────────────────────────────────
|
|
147
|
-
disposers.push(toolService.addTool({
|
|
148
|
-
name: "icqq_set_anonymous",
|
|
149
|
-
description: "开启或关闭 QQ 群的匿名聊天功能",
|
|
150
|
-
parameters: {
|
|
151
|
-
type: "object",
|
|
152
|
-
properties: {
|
|
153
|
-
endpoint_id: { type: "string", description: "Endpoint QQ号", contextKey: 'endpointId' },
|
|
154
|
-
group_id: { type: "number", description: "目标群号" },
|
|
155
|
-
enable: { type: "boolean", description: "true=开启,false=关闭,默认 true" },
|
|
156
|
-
},
|
|
157
|
-
required: ["endpoint_id", "group_id"],
|
|
158
|
-
},
|
|
159
|
-
platforms: ["icqq"],
|
|
160
|
-
tags: ["icqq"],
|
|
161
|
-
permissions: ["platform(icqq,scene_owner)"],
|
|
162
|
-
execute: async (args) => {
|
|
163
|
-
const endpoint = icqq.endpoints.get(args.endpoint_id);
|
|
164
|
-
if (!endpoint)
|
|
165
|
-
throw new Error(`Endpoint ${args.endpoint_id} 不存在`);
|
|
166
|
-
const enable = args.enable ?? true;
|
|
167
|
-
const resp = await endpoint.ipc.request(Actions.GROUP_ALLOW_ANONY, {
|
|
168
|
-
group_id: args.group_id,
|
|
169
|
-
enable,
|
|
170
|
-
});
|
|
171
|
-
return { success: resp.ok, message: resp.ok ? (enable ? "已开启匿名聊天" : "已关闭匿名聊天") : (resp.error ?? "操作失败") };
|
|
172
|
-
},
|
|
173
|
-
}, pluginName));
|
|
174
|
-
// ── 群文件列表 ─────────────────────────────────────────────────────
|
|
175
|
-
disposers.push(toolService.addTool({
|
|
176
|
-
name: "icqq_group_files",
|
|
177
|
-
description: "获取 QQ 群的群文件列表",
|
|
178
|
-
parameters: {
|
|
179
|
-
type: "object",
|
|
180
|
-
properties: {
|
|
181
|
-
endpoint_id: { type: "string", description: "Endpoint 名称", contextKey: 'endpointId' },
|
|
182
|
-
group_id: { type: "number", description: "群号" },
|
|
183
|
-
},
|
|
184
|
-
required: ["endpoint_id", "group_id"],
|
|
185
|
-
},
|
|
186
|
-
platforms: ["icqq"],
|
|
187
|
-
tags: ["icqq"],
|
|
188
|
-
execute: async (args) => {
|
|
189
|
-
const endpoint = icqq.endpoints.get(args.endpoint_id);
|
|
190
|
-
if (!endpoint)
|
|
191
|
-
throw new Error(`Endpoint ${args.endpoint_id} 不存在`);
|
|
192
|
-
const resp = await endpoint.ipc.request(Actions.GFS_LIST, {
|
|
193
|
-
group_id: args.group_id,
|
|
194
|
-
});
|
|
195
|
-
if (!resp.ok)
|
|
196
|
-
throw new Error(resp.error ?? "获取群文件失败");
|
|
197
|
-
const files = Array.isArray(resp.data) ? resp.data : [];
|
|
198
|
-
if (!files.length)
|
|
199
|
-
return { files: [], message: "群文件为空" };
|
|
200
|
-
return {
|
|
201
|
-
files: files.slice(0, 30).map((f) => ({
|
|
202
|
-
name: f.name,
|
|
203
|
-
size: f.size,
|
|
204
|
-
uploader: f.uploader_uin,
|
|
205
|
-
upload_time: f.upload_time,
|
|
206
|
-
})),
|
|
207
|
-
count: files.length,
|
|
208
|
-
};
|
|
209
|
-
},
|
|
210
|
-
}, pluginName));
|
|
211
|
-
// ── 好友列表 ───────────────────────────────────────────────────────
|
|
212
|
-
disposers.push(toolService.addTool({
|
|
213
|
-
name: "icqq_friend_list",
|
|
214
|
-
description: "获取 QQ 好友列表",
|
|
215
|
-
parameters: {
|
|
216
|
-
type: "object",
|
|
217
|
-
properties: {
|
|
218
|
-
endpoint_id: { type: "string", description: "Endpoint 名称", contextKey: 'endpointId' },
|
|
219
|
-
},
|
|
220
|
-
required: ["endpoint_id"],
|
|
221
|
-
},
|
|
222
|
-
platforms: ["icqq"],
|
|
223
|
-
tags: ["icqq"],
|
|
224
|
-
execute: async (args) => {
|
|
225
|
-
const endpoint = icqq.endpoints.get(args.endpoint_id);
|
|
226
|
-
if (!endpoint)
|
|
227
|
-
throw new Error(`Endpoint ${args.endpoint_id} 不存在`);
|
|
228
|
-
const friends = Array.from(endpoint.friends.values()).map((f) => ({
|
|
229
|
-
user_id: f.user_id,
|
|
230
|
-
nickname: f.nickname,
|
|
231
|
-
remark: f.remark,
|
|
232
|
-
}));
|
|
233
|
-
return { friends: friends.slice(0, 50), count: endpoint.friends.size };
|
|
234
|
-
},
|
|
235
|
-
}, pluginName));
|
|
236
|
-
// ── 群列表 ─────────────────────────────────────────────────────────
|
|
237
|
-
disposers.push(toolService.addTool({
|
|
238
|
-
name: "icqq_group_list",
|
|
239
|
-
description: "获取 Endpoint 的 QQ 群列表",
|
|
240
|
-
parameters: {
|
|
241
|
-
type: "object",
|
|
242
|
-
properties: {
|
|
243
|
-
endpoint_id: { type: "string", description: "Endpoint 名称", contextKey: 'endpointId' },
|
|
244
|
-
},
|
|
245
|
-
required: ["endpoint_id"],
|
|
246
|
-
},
|
|
247
|
-
platforms: ["icqq"],
|
|
248
|
-
tags: ["icqq"],
|
|
249
|
-
execute: async (args) => {
|
|
250
|
-
const endpoint = icqq.endpoints.get(args.endpoint_id);
|
|
251
|
-
if (!endpoint)
|
|
252
|
-
throw new Error(`Endpoint ${args.endpoint_id} 不存在`);
|
|
253
|
-
const groups = Array.from(endpoint.groups.values()).map((g) => ({
|
|
254
|
-
group_id: g.group_id,
|
|
255
|
-
group_name: g.group_name,
|
|
256
|
-
member_count: g.member_count,
|
|
257
|
-
max_member_count: g.max_member_count,
|
|
258
|
-
}));
|
|
259
|
-
return { groups: groups.slice(0, 50), count: endpoint.groups.size };
|
|
260
|
-
},
|
|
261
|
-
}, pluginName));
|
|
262
|
-
// ── 群签到 ─────────────────────────────────────────────────────────
|
|
263
|
-
disposers.push(toolService.addTool({
|
|
264
|
-
name: "icqq_group_sign",
|
|
265
|
-
description: "QQ 群签到打卡",
|
|
266
|
-
parameters: {
|
|
267
|
-
type: "object",
|
|
268
|
-
properties: {
|
|
269
|
-
endpoint_id: { type: "string", description: "Endpoint QQ号", contextKey: 'endpointId' },
|
|
270
|
-
group_id: { type: "number", description: "目标群号" },
|
|
271
|
-
},
|
|
272
|
-
required: ["endpoint_id", "group_id"],
|
|
273
|
-
},
|
|
274
|
-
platforms: ["icqq"],
|
|
275
|
-
tags: ["icqq"],
|
|
276
|
-
execute: async (args) => {
|
|
277
|
-
const endpoint = icqq.endpoints.get(args.endpoint_id);
|
|
278
|
-
if (!endpoint)
|
|
279
|
-
throw new Error(`Endpoint ${args.endpoint_id} 不存在`);
|
|
280
|
-
const resp = await endpoint.ipc.request(Actions.GROUP_SIGN, {
|
|
281
|
-
group_id: args.group_id,
|
|
282
|
-
});
|
|
283
|
-
return { success: resp.ok, message: resp.ok ? "群签到成功" : (resp.error ?? "签到失败") };
|
|
284
|
-
},
|
|
285
|
-
}, pluginName));
|
|
286
|
-
// ── 邀请入群 ───────────────────────────────────────────────────────
|
|
287
|
-
disposers.push(toolService.addTool({
|
|
288
|
-
name: "icqq_group_invite",
|
|
289
|
-
description: "邀请好友加入 QQ 群",
|
|
290
|
-
parameters: {
|
|
291
|
-
type: "object",
|
|
292
|
-
properties: {
|
|
293
|
-
endpoint_id: { type: "string", description: "Endpoint QQ号", contextKey: 'endpointId' },
|
|
294
|
-
group_id: { type: "number", description: "目标群号" },
|
|
295
|
-
user_id: { type: "number", description: "要邀请的 QQ号" },
|
|
296
|
-
},
|
|
297
|
-
required: ["endpoint_id", "group_id", "user_id"],
|
|
298
|
-
},
|
|
299
|
-
platforms: ["icqq"],
|
|
300
|
-
tags: ["icqq"],
|
|
301
|
-
execute: async (args) => {
|
|
302
|
-
const endpoint = icqq.endpoints.get(args.endpoint_id);
|
|
303
|
-
if (!endpoint)
|
|
304
|
-
throw new Error(`Endpoint ${args.endpoint_id} 不存在`);
|
|
305
|
-
const resp = await endpoint.ipc.request(Actions.GROUP_INVITE, {
|
|
306
|
-
group_id: args.group_id,
|
|
307
|
-
user_id: args.user_id,
|
|
308
|
-
});
|
|
309
|
-
return { success: resp.ok, message: resp.ok ? `已邀请 ${args.user_id} 加入群` : (resp.error ?? "邀请失败") };
|
|
310
|
-
},
|
|
311
|
-
}, pluginName));
|
|
312
|
-
// ── 设为/移除精华消息 ──────────────────────────────────────────────
|
|
313
|
-
disposers.push(toolService.addTool({
|
|
314
|
-
name: "icqq_essence",
|
|
315
|
-
description: "设置或移除 QQ 群精华消息",
|
|
316
|
-
parameters: {
|
|
317
|
-
type: "object",
|
|
318
|
-
properties: {
|
|
319
|
-
endpoint_id: { type: "string", description: "Endpoint QQ号", contextKey: 'endpointId' },
|
|
320
|
-
message_id: { type: "string", description: "消息 ID" },
|
|
321
|
-
action: { type: "string", description: "add=设为精华, remove=移除精华" },
|
|
322
|
-
},
|
|
323
|
-
required: ["endpoint_id", "message_id", "action"],
|
|
324
|
-
},
|
|
325
|
-
platforms: ["icqq"],
|
|
326
|
-
tags: ["icqq"],
|
|
327
|
-
permissions: ["platform(icqq,scene_admin)"],
|
|
328
|
-
execute: async (args) => {
|
|
329
|
-
const endpoint = icqq.endpoints.get(args.endpoint_id);
|
|
330
|
-
if (!endpoint)
|
|
331
|
-
throw new Error(`Endpoint ${args.endpoint_id} 不存在`);
|
|
332
|
-
const action = args.action === "add" ? Actions.GROUP_ESSENCE_ADD : Actions.GROUP_ESSENCE_REMOVE;
|
|
333
|
-
const resp = await endpoint.ipc.request(action, {
|
|
334
|
-
message_id: args.message_id,
|
|
335
|
-
});
|
|
336
|
-
return { success: resp.ok, message: resp.ok ? (args.action === "add" ? "已设为精华" : "已移除精华") : (resp.error ?? "操作失败") };
|
|
337
|
-
},
|
|
338
|
-
}, pluginName));
|
|
339
|
-
return () => disposers.forEach((d) => d());
|
|
340
|
-
}
|
|
341
|
-
//# sourceMappingURL=index.js.map
|
package/lib/tools/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,0BAA0B,EAAE,MAAM,SAAS,CAAC;AAErD,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAEzC,MAAM,UAAU,aAAa,CAC3B,WAAwB,EACxB,IAAiB,EACjB,UAAkB;IAElB,MAAM,SAAS,GAAmB,EAAE,CAAC;IAErC,gEAAgE;IAChE,MAAM,UAAU,GAAG,0BAA0B,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IAC5D,SAAS,CAAC,IAAI,CAAC,GAAG,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC;IAE7E,kEAAkE;IAClE,SAAS,CAAC,IAAI,CACZ,WAAW,CAAC,OAAO,CACjB;QACE,IAAI,EAAE,gBAAgB;QACtB,WAAW,EAAE,gBAAgB;QAC7B,UAAU,EAAE;YACV,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE;gBACV,WAAW,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,cAAc,EAAE,UAAU,EAAE,YAAY,EAAE;gBACtF,QAAQ,EAAE,EAAE,IAAI,EAAE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AE,MAAM,CAAC;IAChB,eAAe;IACf,IAAI,EAAE,GAAG,MAAM,EAAE,CAAC;IAClB,+BAA+B;IAC/B,GAAG,CAAC,EAAE;QACJ,aAAa;QACb,IAAI,EAAE,MAAM,CAAC;QACb,WAAW;QACX,IAAI,EAAE,MAAM,CAAC;QACb,4CAA4C;QAC5C,KAAK,EAAE,MAAM,CAAC;KACf,CAAC;IACF;;;OAGG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,GAAG,QAAQ,CAAC;CACnC;AAED,kBAAkB;AAClB,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,iBAAiB;AACjB,MAAM,WAAW,YAAY;IAC3B,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,gBAAgB,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,mBAAmB;AACnB,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,SAAS,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB"}
|
package/lib/types.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG"}
|
package/plugin.yml
DELETED
package/src/adapter.ts
DELETED
|
@@ -1,151 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* ICQQ 适配器 — 通过 @icqqjs/cli 守护进程 IPC 管理 Endpoint 实例
|
|
3
|
-
*/
|
|
4
|
-
import { formatCompact, Adapter, Plugin, OUTBOUND_RICH_SEGMENT_POLICY_IM_FULL, ONEBOT_KEYBOARD_AI_OUTBOUND_EXTENSION } from 'zhin.js';
|
|
5
|
-
import { IcqqEndpoint } from "./endpoint.js";
|
|
6
|
-
import type { IcqqEndpointConfig, IpcMemberInfo } from "./types.js";
|
|
7
|
-
import { Actions } from "./protocol.js";
|
|
8
|
-
|
|
9
|
-
export class IcqqAdapter extends Adapter<IcqqEndpoint> {
|
|
10
|
-
static override readonly capabilities = ['inbound', 'outbound'] as const;
|
|
11
|
-
static override outboundRichSegmentPolicy = OUTBOUND_RICH_SEGMENT_POLICY_IM_FULL;
|
|
12
|
-
static override interactivePolicy = 'text' as const;
|
|
13
|
-
static override aiOutboundCapabilities = {
|
|
14
|
-
mentions: true,
|
|
15
|
-
richSegments: ['qrcode', 'html', 'markdown', 'tts'],
|
|
16
|
-
interactive: 'text' as const,
|
|
17
|
-
};
|
|
18
|
-
static override aiOutboundExtensions = [ONEBOT_KEYBOARD_AI_OUTBOUND_EXTENSION];
|
|
19
|
-
|
|
20
|
-
constructor(plugin: Plugin) {
|
|
21
|
-
super(plugin, "icqq", []);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
getOutboundMediaCapabilities() {
|
|
25
|
-
return {
|
|
26
|
-
image: true,
|
|
27
|
-
audio: true,
|
|
28
|
-
video: true,
|
|
29
|
-
file: true,
|
|
30
|
-
maxAttachmentBytes: 20 * 1024 * 1024,
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
createEndpoint(config: IcqqEndpointConfig): IcqqEndpoint {
|
|
35
|
-
return new IcqqEndpoint(this, config);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
async start(): Promise<void> {
|
|
39
|
-
await super.start();
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
async stop(): Promise<void> {
|
|
43
|
-
await super.stop();
|
|
44
|
-
this.logger.debug(formatCompact({ stop: true }));
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
// ── ISceneManagement 标准群管方法(通过 IPC) ─────────────────────
|
|
48
|
-
|
|
49
|
-
private getEndpoint(endpointId: string): IcqqEndpoint {
|
|
50
|
-
const endpoint = this.endpoints.get(endpointId);
|
|
51
|
-
if (!endpoint) throw new Error(`Endpoint ${endpointId} 不存在`);
|
|
52
|
-
return endpoint;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
async removeMember(endpointId: string, sceneId: string, userId: string) {
|
|
56
|
-
const endpoint = this.getEndpoint(endpointId);
|
|
57
|
-
const resp = await endpoint.ipc.request(Actions.GROUP_KICK, {
|
|
58
|
-
group_id: Number(sceneId),
|
|
59
|
-
user_id: Number(userId),
|
|
60
|
-
reject_add_request: false,
|
|
61
|
-
});
|
|
62
|
-
if (!resp.ok) throw new Error(resp.error ?? "踢人失败");
|
|
63
|
-
return true;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
async muteMember(
|
|
67
|
-
endpointId: string,
|
|
68
|
-
sceneId: string,
|
|
69
|
-
userId: string,
|
|
70
|
-
duration = 600,
|
|
71
|
-
) {
|
|
72
|
-
const endpoint = this.getEndpoint(endpointId);
|
|
73
|
-
const resp = await endpoint.ipc.request(Actions.GROUP_MUTE, {
|
|
74
|
-
group_id: Number(sceneId),
|
|
75
|
-
user_id: Number(userId),
|
|
76
|
-
duration,
|
|
77
|
-
});
|
|
78
|
-
if (!resp.ok) throw new Error(resp.error ?? "禁言失败");
|
|
79
|
-
return true;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
async setSceneMuted(endpointId: string, sceneId: string, enable = true) {
|
|
83
|
-
const endpoint = this.getEndpoint(endpointId);
|
|
84
|
-
const resp = await endpoint.ipc.request(Actions.GROUP_MUTE_ALL, {
|
|
85
|
-
group_id: Number(sceneId),
|
|
86
|
-
enable,
|
|
87
|
-
});
|
|
88
|
-
if (!resp.ok) throw new Error(resp.error ?? "全员禁言失败");
|
|
89
|
-
return true;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
async setModerator(
|
|
93
|
-
endpointId: string,
|
|
94
|
-
sceneId: string,
|
|
95
|
-
userId: string,
|
|
96
|
-
enable = true,
|
|
97
|
-
) {
|
|
98
|
-
const endpoint = this.getEndpoint(endpointId);
|
|
99
|
-
const resp = await endpoint.ipc.request(Actions.SET_GROUP_ADMIN, {
|
|
100
|
-
group_id: Number(sceneId),
|
|
101
|
-
user_id: Number(userId),
|
|
102
|
-
enable,
|
|
103
|
-
});
|
|
104
|
-
if (!resp.ok) throw new Error(resp.error ?? "设置管理员失败");
|
|
105
|
-
return true;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
async setMemberNickname(
|
|
109
|
-
endpointId: string,
|
|
110
|
-
sceneId: string,
|
|
111
|
-
userId: string,
|
|
112
|
-
nickname: string,
|
|
113
|
-
) {
|
|
114
|
-
const endpoint = this.getEndpoint(endpointId);
|
|
115
|
-
const resp = await endpoint.ipc.request(Actions.SET_GROUP_CARD, {
|
|
116
|
-
group_id: Number(sceneId),
|
|
117
|
-
user_id: Number(userId),
|
|
118
|
-
card: nickname,
|
|
119
|
-
});
|
|
120
|
-
if (!resp.ok) throw new Error(resp.error ?? "设置群名片失败");
|
|
121
|
-
return true;
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
async renameScene(endpointId: string, sceneId: string, name: string) {
|
|
125
|
-
const endpoint = this.getEndpoint(endpointId);
|
|
126
|
-
const resp = await endpoint.ipc.request(Actions.SET_GROUP_NAME, {
|
|
127
|
-
group_id: Number(sceneId),
|
|
128
|
-
name,
|
|
129
|
-
});
|
|
130
|
-
if (!resp.ok) throw new Error(resp.error ?? "设置群名失败");
|
|
131
|
-
return true;
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
async listMembers(endpointId: string, sceneId: string) {
|
|
135
|
-
const endpoint = this.getEndpoint(endpointId);
|
|
136
|
-
const resp = await endpoint.ipc.request(Actions.LIST_GROUP_MEMBERS, {
|
|
137
|
-
group_id: Number(sceneId),
|
|
138
|
-
});
|
|
139
|
-
if (!resp.ok) throw new Error(resp.error ?? "获取成员列表失败");
|
|
140
|
-
const raw = resp.data as IpcMemberInfo[];
|
|
141
|
-
const members = raw.map((m) => ({
|
|
142
|
-
user_id: m.user_id,
|
|
143
|
-
nickname: m.nickname,
|
|
144
|
-
card: m.card,
|
|
145
|
-
role: m.role,
|
|
146
|
-
title: m.title,
|
|
147
|
-
}));
|
|
148
|
-
return { members, count: members.length };
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
}
|
package/src/get-msg.ts
DELETED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import type { QuotedMessagePayload } from "zhin.js";
|
|
2
|
-
import { parseCqMessage } from "./cq-message.js";
|
|
3
|
-
import { extractForwardResidFromGetMsg } from "./forward-msg.js";
|
|
4
|
-
import {
|
|
5
|
-
icqqElementsToSegments,
|
|
6
|
-
type IcqqMessageElement,
|
|
7
|
-
} from "./icqq-inbound.js";
|
|
8
|
-
|
|
9
|
-
export function parseIcqqGetMsgResponse(
|
|
10
|
-
messageId: string,
|
|
11
|
-
data: unknown,
|
|
12
|
-
): QuotedMessagePayload {
|
|
13
|
-
const record =
|
|
14
|
-
data && typeof data === "object"
|
|
15
|
-
? (data as Record<string, unknown>)
|
|
16
|
-
: {};
|
|
17
|
-
let content: QuotedMessagePayload["content"] = [];
|
|
18
|
-
if (Array.isArray(record.message)) {
|
|
19
|
-
content =
|
|
20
|
-
icqqElementsToSegments(record.message as IcqqMessageElement[]) ?? [];
|
|
21
|
-
} else if (typeof record.raw_message === "string" && record.raw_message) {
|
|
22
|
-
content = parseCqMessage(record.raw_message);
|
|
23
|
-
} else if (typeof record.message === "string" && record.message) {
|
|
24
|
-
content = parseCqMessage(record.message);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
const forwardResid = extractForwardResidFromGetMsg(record);
|
|
28
|
-
if (forwardResid && Array.isArray(content)) {
|
|
29
|
-
const hasForward = content.some((s) => s.type === "forward");
|
|
30
|
-
if (!hasForward) {
|
|
31
|
-
content = [
|
|
32
|
-
{ type: "forward", data: { id: forwardResid, resid: forwardResid } },
|
|
33
|
-
...content,
|
|
34
|
-
];
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
const senderRaw = record.sender;
|
|
39
|
-
let sender: QuotedMessagePayload["sender"];
|
|
40
|
-
if (senderRaw && typeof senderRaw === "object") {
|
|
41
|
-
const s = senderRaw as Record<string, unknown>;
|
|
42
|
-
sender = {
|
|
43
|
-
id: String(s.user_id ?? s.uid ?? s.uin ?? ""),
|
|
44
|
-
name: String(s.nickname ?? s.name ?? ""),
|
|
45
|
-
};
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
return {
|
|
49
|
-
messageId,
|
|
50
|
-
sender,
|
|
51
|
-
content,
|
|
52
|
-
raw:
|
|
53
|
-
typeof record.raw_message === "string" ? record.raw_message : undefined,
|
|
54
|
-
time: typeof record.time === "number" ? record.time : undefined,
|
|
55
|
-
};
|
|
56
|
-
}
|