@zhin.js/adapter-icqq 3.0.12 → 4.0.1
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 +24 -7
- package/README.md +30 -30
- package/client/ICQQManagement.tsx +15 -15
- package/client/LoginAssistPanel.tsx +2 -2
- package/dist/index.js +1 -2
- package/lib/adapter.d.ts +14 -13
- package/lib/adapter.d.ts.map +1 -1
- package/lib/adapter.js +31 -30
- package/lib/adapter.js.map +1 -1
- package/lib/{bot.d.ts → endpoint.d.ts} +9 -9
- package/lib/endpoint.d.ts.map +1 -0
- package/lib/{bot.js → endpoint.js} +30 -41
- package/lib/endpoint.js.map +1 -0
- package/lib/icqq-side-events.d.ts +2 -2
- package/lib/icqq-side-events.d.ts.map +1 -1
- package/lib/icqq-side-events.js +4 -4
- package/lib/icqq-side-events.js.map +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -6
- package/lib/index.js.map +1 -1
- package/lib/ipc-client.js +2 -2
- package/lib/ipc-client.js.map +1 -1
- package/lib/outbound-media.d.ts +2 -2
- package/lib/outbound-media.d.ts.map +1 -1
- package/lib/outbound-media.js.map +1 -1
- package/lib/routes.js +14 -14
- package/lib/routes.js.map +1 -1
- package/lib/tools/index.d.ts.map +1 -1
- package/lib/tools/index.js +80 -75
- package/lib/tools/index.js.map +1 -1
- package/lib/types.d.ts +2 -2
- package/lib/types.d.ts.map +1 -1
- package/lib/typing-indicator-example.d.ts +10 -10
- package/lib/typing-indicator-example.d.ts.map +1 -1
- package/lib/typing-indicator-example.js +24 -24
- package/lib/typing-indicator-example.js.map +1 -1
- package/lib/typing-indicator.d.ts +10 -10
- package/lib/typing-indicator.d.ts.map +1 -1
- package/lib/typing-indicator.js +37 -37
- package/lib/typing-indicator.js.map +1 -1
- package/package.json +15 -11
- package/skills/icqq/PERMITS.md +22 -0
- package/src/adapter.ts +33 -31
- package/src/{bot.ts → endpoint.ts} +30 -40
- package/src/icqq-side-events.ts +4 -4
- package/src/index.ts +1 -7
- package/src/ipc-client.ts +2 -2
- package/src/outbound-media.ts +2 -2
- package/src/routes.ts +14 -14
- package/src/tools/index.ts +68 -63
- package/src/types.ts +2 -2
- package/src/typing-indicator-example.ts +25 -25
- package/src/typing-indicator.ts +40 -40
- package/lib/bot.d.ts.map +0 -1
- package/lib/bot.js.map +0 -1
- package/lib/commands/index.d.ts +0 -7
- package/lib/commands/index.d.ts.map +0 -1
- package/lib/commands/index.js +0 -30
- package/lib/commands/index.js.map +0 -1
- package/src/commands/index.ts +0 -32
package/CHANGELOG.md
CHANGED
|
@@ -1,15 +1,32 @@
|
|
|
1
1
|
# @zhin.js/adapter-icqq
|
|
2
2
|
|
|
3
|
-
##
|
|
3
|
+
## 4.0.1
|
|
4
4
|
|
|
5
5
|
### Patch Changes
|
|
6
6
|
|
|
7
|
-
-
|
|
8
|
-
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
- zhin.js@1.0.
|
|
12
|
-
- @zhin.js/host-
|
|
7
|
+
- d8def69: fix: 性能优化
|
|
8
|
+
- 2ef4896: fix: 更新概念 Bot=>Endpoint,已适配后续更多的业务场景;统一角色权限
|
|
9
|
+
- Updated dependencies [d8def69]
|
|
10
|
+
- Updated dependencies [2ef4896]
|
|
11
|
+
- @zhin.js/host-router@1.0.1
|
|
12
|
+
- @zhin.js/host-api@1.0.1
|
|
13
|
+
- @zhin.js/agent@0.2.1
|
|
14
|
+
- @zhin.js/core@1.2.1
|
|
15
|
+
- zhin.js@2.0.1
|
|
16
|
+
- @zhin.js/client@2.0.3
|
|
17
|
+
|
|
18
|
+
## 4.0.0
|
|
19
|
+
|
|
20
|
+
### Patch Changes
|
|
21
|
+
|
|
22
|
+
- e62c23a: fix: update pnpm-lock.yaml and vitest configurations- Added new dependencies for the full-bot example, including multiple Zhin.js adapters and TypeScript.- Updated the test-bot example to include '@puniyu/system-info' and other necessary packages.- Modified vitest configuration to include additional module directories for better dependency resolution.- Enhanced documentation for the KOOK adapter, including new features like typing indicators and system notifications.- Removed unused test assets and scripts from the test-bot example to streamline the project.
|
|
23
|
+
- Updated dependencies [65f4b0a]
|
|
24
|
+
- Updated dependencies [e62c23a]
|
|
25
|
+
- @zhin.js/core@1.2.0
|
|
26
|
+
- @zhin.js/agent@0.2.0
|
|
27
|
+
- @zhin.js/host-api@1.0.0
|
|
28
|
+
- zhin.js@2.0.0
|
|
29
|
+
- @zhin.js/host-router@1.0.0
|
|
13
30
|
|
|
14
31
|
## 3.0.11
|
|
15
32
|
|
package/README.md
CHANGED
|
@@ -33,7 +33,7 @@ pnpm add -g @icqqjs/cli
|
|
|
33
33
|
在 `zhin.config.yml` 中声明 bot(**不在此填写 QQ 密码**):
|
|
34
34
|
|
|
35
35
|
```yaml
|
|
36
|
-
|
|
36
|
+
endpoints:
|
|
37
37
|
- context: icqq
|
|
38
38
|
name: "${ICQQ_ACCOUNT}" # QQ 号,须与 icqq login 的账号一致
|
|
39
39
|
autoReconnect: true # IPC 断开后自动重连,默认 true
|
|
@@ -58,7 +58,7 @@ TypeScript 配置等价写法:
|
|
|
58
58
|
import { defineConfig } from 'zhin.js'
|
|
59
59
|
|
|
60
60
|
export default defineConfig({
|
|
61
|
-
|
|
61
|
+
endpoints: [
|
|
62
62
|
{
|
|
63
63
|
context: 'icqq',
|
|
64
64
|
name: process.env.ICQQ_ACCOUNT!,
|
|
@@ -79,7 +79,7 @@ export default defineConfig({
|
|
|
79
79
|
|
|
80
80
|
- `autoReconnect`: IPC/RPC 意外断开时是否指数退避重连(默认 `true`)
|
|
81
81
|
- `rpc`: 远程守护进程连接(`host` / `port` / `token`);不配置则使用本地 Unix socket `~/.icqq/<uin>/daemon.sock`
|
|
82
|
-
- `typingIndicator`: AI 处理中的 reaction 或临时消息提示(见 `
|
|
82
|
+
- `typingIndicator`: AI 处理中的 reaction 或临时消息提示(见 `IcqqEndpointConfig` 类型)
|
|
83
83
|
|
|
84
84
|
## 使用示例
|
|
85
85
|
|
|
@@ -136,7 +136,7 @@ addCommand(new MessageCommand('pic <url:text>')
|
|
|
136
136
|
Agent **`generate_image` 文生图**出站的大图同样依赖上述配置;同机默认可用本机临时文件路径(`outboundMedia: file`)。详见 [文生图 (generate_image)](https://github.com/zhinjs/zhin/blob/main/docs/advanced/ai.md#文生图-generate_image)。
|
|
137
137
|
|
|
138
138
|
```yaml
|
|
139
|
-
|
|
139
|
+
endpoints:
|
|
140
140
|
- context: icqq
|
|
141
141
|
name: "123456"
|
|
142
142
|
outboundMedia: base64 # 异机 / 远程 RPC
|
|
@@ -172,7 +172,7 @@ addCommand(new MessageCommand('at <user:at>')
|
|
|
172
172
|
## 登录流程
|
|
173
173
|
|
|
174
174
|
1. **先登录 QQ**:在终端执行 `icqq login`,按 CLI 提示完成密码/扫码/滑块/设备锁等验证;会话由 `@icqqjs/cli` 守护进程维护。
|
|
175
|
-
2. **再启动 Zhin**:`zhin.config.yml` 中 `
|
|
175
|
+
2. **再启动 Zhin**:`zhin.config.yml` 中 `endpoints[].name` 与上一步 QQ 号一致,启动 `zhin dev` / `zhin start`;适配器连接守护进程并开始收发消息。
|
|
176
176
|
3. 若守护进程未运行或账号未登录,适配器会保持未连接状态,日志中会提示检查 `icqq` 守护进程。
|
|
177
177
|
|
|
178
178
|
### Web 控制台登录辅助(可选)
|
|
@@ -210,25 +210,25 @@ addCommand(new MessageCommand('at <user:at>')
|
|
|
210
210
|
## API 方法
|
|
211
211
|
|
|
212
212
|
```typescript
|
|
213
|
-
const
|
|
213
|
+
const endpoint = app.adapters.get('icqq')?.endpoints.get('你的QQ号')
|
|
214
214
|
|
|
215
215
|
// 发送群消息
|
|
216
|
-
await
|
|
216
|
+
await endpoint.sendGroupMsg(groupId, '消息内容')
|
|
217
217
|
|
|
218
218
|
// 发送私聊消息
|
|
219
|
-
await
|
|
219
|
+
await endpoint.sendPrivateMsg(userId, '消息内容')
|
|
220
220
|
|
|
221
221
|
// 撤回消息
|
|
222
|
-
await
|
|
222
|
+
await endpoint.$recallMessage(messageId)
|
|
223
223
|
|
|
224
224
|
// 获取群列表
|
|
225
|
-
const groupList =
|
|
225
|
+
const groupList = endpoint.getGroupList()
|
|
226
226
|
|
|
227
227
|
// 获取好友列表
|
|
228
|
-
const friendList =
|
|
228
|
+
const friendList = endpoint.getFriendList()
|
|
229
229
|
|
|
230
230
|
// 获取群成员信息
|
|
231
|
-
const memberInfo =
|
|
231
|
+
const memberInfo = endpoint.getGroupMemberInfo(groupId, userId)
|
|
232
232
|
```
|
|
233
233
|
|
|
234
234
|
## 🔧 群管理工具(AI 可调用)
|
|
@@ -283,48 +283,48 @@ AI:已戳了戳 朋友。
|
|
|
283
283
|
#### 编程调用
|
|
284
284
|
|
|
285
285
|
```typescript
|
|
286
|
-
// 获取 ICQQ
|
|
286
|
+
// 获取 ICQQ Endpoint 实例
|
|
287
287
|
const icqqAdapter = app.adapters.get('icqq')
|
|
288
|
-
const
|
|
288
|
+
const endpoint = icqqAdapter?.endpoints.get('你的QQ号')
|
|
289
289
|
|
|
290
290
|
// 踢出成员
|
|
291
|
-
await
|
|
291
|
+
await endpoint.kickMember(groupId, userId, true) // 第三个参数为是否拉黑
|
|
292
292
|
|
|
293
293
|
// 禁言成员(单位:秒)
|
|
294
|
-
await
|
|
295
|
-
await
|
|
294
|
+
await endpoint.muteMember(groupId, userId, 600) // 禁言 10 分钟
|
|
295
|
+
await endpoint.muteMember(groupId, userId, 0) // 解除禁言
|
|
296
296
|
|
|
297
297
|
// 全员禁言
|
|
298
|
-
await
|
|
299
|
-
await
|
|
298
|
+
await endpoint.muteAll(groupId, true) // 开启
|
|
299
|
+
await endpoint.muteAll(groupId, false) // 关闭
|
|
300
300
|
|
|
301
301
|
// 设置管理员
|
|
302
|
-
await
|
|
303
|
-
await
|
|
302
|
+
await endpoint.setAdmin(groupId, userId, true) // 设为管理员
|
|
303
|
+
await endpoint.setAdmin(groupId, userId, false) // 取消管理员
|
|
304
304
|
|
|
305
305
|
// 设置群名片
|
|
306
|
-
await
|
|
306
|
+
await endpoint.setCard(groupId, userId, '新名片')
|
|
307
307
|
|
|
308
308
|
// 设置专属头衔
|
|
309
|
-
await
|
|
309
|
+
await endpoint.setTitle(groupId, userId, '大佬', -1) // -1 表示永久
|
|
310
310
|
|
|
311
311
|
// 修改群名
|
|
312
|
-
await
|
|
312
|
+
await endpoint.setGroupName(groupId, '新群名')
|
|
313
313
|
|
|
314
314
|
// 发送群公告
|
|
315
|
-
await
|
|
315
|
+
await endpoint.sendAnnounce(groupId, '公告内容')
|
|
316
316
|
|
|
317
317
|
// 戳一戳
|
|
318
|
-
await
|
|
318
|
+
await endpoint.pokeMember(groupId, userId)
|
|
319
319
|
|
|
320
320
|
// 获取群成员列表
|
|
321
|
-
const members = await
|
|
321
|
+
const members = await endpoint.getMemberList(groupId)
|
|
322
322
|
|
|
323
323
|
// 获取被禁言成员列表
|
|
324
|
-
const mutedList = await
|
|
324
|
+
const mutedList = await endpoint.getMutedMembers(groupId)
|
|
325
325
|
|
|
326
326
|
// 开启/关闭匿名
|
|
327
|
-
await
|
|
327
|
+
await endpoint.setAnonymous(groupId, true)
|
|
328
328
|
```
|
|
329
329
|
|
|
330
330
|
### 发送者权限信息
|
|
@@ -389,7 +389,7 @@ onGroupMessage(async (message) => {
|
|
|
389
389
|
|
|
390
390
|
A:
|
|
391
391
|
1. 确认已对该 QQ 号执行过 `icqq login` 且守护进程在运行
|
|
392
|
-
2. 确认 `
|
|
392
|
+
2. 确认 `endpoints[].name` 与登录 QQ 号一致
|
|
393
393
|
3. 远程部署时检查 `rpc.host` / `rpc.port` / `rpc.token`
|
|
394
394
|
|
|
395
395
|
### Q: 还需要在 zhin.config 里写 password / platform 吗?
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { useCallback, useEffect, useState } from "react";
|
|
2
|
-
import { Activity,
|
|
2
|
+
import { Activity, Endpoint, LogIn, Users, RefreshCw, Wifi, WifiOff, Loader2 } from "lucide-react";
|
|
3
3
|
import LoginAssistPanel from "./LoginAssistPanel";
|
|
4
4
|
import { apiFetch } from "./utils/api";
|
|
5
5
|
|
|
6
|
-
interface
|
|
6
|
+
interface EndpointRow {
|
|
7
7
|
name: string;
|
|
8
8
|
connected: boolean;
|
|
9
9
|
groupCount: number;
|
|
@@ -16,7 +16,7 @@ type Tab = "overview" | "login";
|
|
|
16
16
|
|
|
17
17
|
export default function ICQQManagement() {
|
|
18
18
|
const [tab, setTab] = useState<Tab>("overview");
|
|
19
|
-
const [
|
|
19
|
+
const [endpoints, setEndpoints] = useState<EndpointRow[]>([]);
|
|
20
20
|
const [loading, setLoading] = useState(true);
|
|
21
21
|
const [err, setErr] = useState<string | null>(null);
|
|
22
22
|
|
|
@@ -24,13 +24,13 @@ export default function ICQQManagement() {
|
|
|
24
24
|
setLoading(true);
|
|
25
25
|
setErr(null);
|
|
26
26
|
try {
|
|
27
|
-
const res = await apiFetch("/api/icqq/
|
|
28
|
-
const json = (await res.json()) as { success?: boolean; data?:
|
|
27
|
+
const res = await apiFetch("/api/icqq/endpoints");
|
|
28
|
+
const json = (await res.json()) as { success?: boolean; data?: EndpointRow[]; message?: string };
|
|
29
29
|
if (!res.ok || !json.success) throw new Error(json.message || "加载失败");
|
|
30
|
-
|
|
30
|
+
setEndpoints(Array.isArray(json.data) ? json.data : []);
|
|
31
31
|
} catch (e) {
|
|
32
32
|
setErr((e as Error).message);
|
|
33
|
-
|
|
33
|
+
setEndpoints([]);
|
|
34
34
|
} finally {
|
|
35
35
|
setLoading(false);
|
|
36
36
|
}
|
|
@@ -103,17 +103,17 @@ export default function ICQQManagement() {
|
|
|
103
103
|
<div className="flex justify-center py-12">
|
|
104
104
|
<Loader2 className="w-6 h-6 animate-spin text-blue-500" />
|
|
105
105
|
</div>
|
|
106
|
-
) :
|
|
106
|
+
) : endpoints.length === 0 ? (
|
|
107
107
|
<div className="text-center text-muted-foreground py-12">
|
|
108
|
-
暂无 ICQQ
|
|
108
|
+
暂无 ICQQ Endpoint 实例
|
|
109
109
|
</div>
|
|
110
110
|
) : (
|
|
111
111
|
<div className="grid gap-4 md:grid-cols-2">
|
|
112
|
-
{
|
|
113
|
-
<div key={
|
|
112
|
+
{endpoints.map((endpoint) => (
|
|
113
|
+
<div key={endpoint.name} className="border rounded-lg p-4 bg-card shadow-sm">
|
|
114
114
|
<div className="flex items-center justify-between mb-3">
|
|
115
|
-
<span className="font-medium text-lg">{
|
|
116
|
-
{
|
|
115
|
+
<span className="font-medium text-lg">{endpoint.name}</span>
|
|
116
|
+
{endpoint.connected ? (
|
|
117
117
|
<span className="flex items-center gap-1 text-green-600 text-sm">
|
|
118
118
|
<Wifi className="w-4 h-4" /> 在线
|
|
119
119
|
</span>
|
|
@@ -126,11 +126,11 @@ export default function ICQQManagement() {
|
|
|
126
126
|
<div className="space-y-2 text-sm text-muted-foreground">
|
|
127
127
|
<div className="flex items-center gap-1.5">
|
|
128
128
|
<Users className="w-3.5 h-3.5" />
|
|
129
|
-
群 {
|
|
129
|
+
群 {endpoint.groupCount} · 好友 {endpoint.friendCount}
|
|
130
130
|
</div>
|
|
131
131
|
<div className="flex items-center gap-1.5">
|
|
132
132
|
<Activity className="w-3.5 h-3.5" />
|
|
133
|
-
登录方式 {
|
|
133
|
+
登录方式 {endpoint.loginMode} · {endpoint.status}
|
|
134
134
|
</div>
|
|
135
135
|
</div>
|
|
136
136
|
</div>
|
|
@@ -14,7 +14,7 @@ import { apiFetch } from "./utils/api";
|
|
|
14
14
|
interface PendingLoginTask {
|
|
15
15
|
id: string;
|
|
16
16
|
adapter: string;
|
|
17
|
-
|
|
17
|
+
endpointId: string;
|
|
18
18
|
type: string;
|
|
19
19
|
payload?: {
|
|
20
20
|
message?: string;
|
|
@@ -164,7 +164,7 @@ export default function LoginAssistPanel() {
|
|
|
164
164
|
</div>
|
|
165
165
|
<div className="flex gap-1 text-xs">
|
|
166
166
|
<span className="px-2 py-0.5 rounded border">{task.adapter}</span>
|
|
167
|
-
<span className="px-2 py-0.5 rounded bg-muted">{task.
|
|
167
|
+
<span className="px-2 py-0.5 rounded bg-muted">{task.endpointId}</span>
|
|
168
168
|
</div>
|
|
169
169
|
</div>
|
|
170
170
|
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{useCallback as ye,useEffect as Re,useState as N}from"react";import{forwardRef as re,createElement as fe}from"react";var E=(...a)=>a.filter((u,r,f)=>!!u&&u.trim()!==""&&f.indexOf(u)===r).join(" ").trim();var Q=a=>a.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();var J=a=>a.replace(/^([A-Z])|[\s-_]+(\w)/g,(u,r,f)=>f?f.toUpperCase():r.toLowerCase());var X=a=>{let u=J(a);return u.charAt(0).toUpperCase()+u.slice(1)};import{forwardRef as le,createElement as Y}from"react";var V={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};var _=a=>{for(let u in a)if(u.startsWith("aria-")||u==="role"||u==="title")return!0;return!1};import{createContext as oe,useContext as ue,useMemo as Ee,createElement as Ve}from"react";var de=oe({});var j=()=>ue(de);var $=le(({color:a,size:u,strokeWidth:r,absoluteStrokeWidth:f,className:p="",children:s,iconNode:m,...h},L)=>{let{size:d=24,strokeWidth:n=2,absoluteStrokeWidth:G=!1,color:g="currentColor",className:B=""}=j()??{},M=f??G?Number(r??n)*24/Number(u??d):r??n;return Y("svg",{ref:L,...V,width:u??d??V.width,height:u??d??V.height,stroke:a??g,strokeWidth:M,className:E("lucide",B,p),...!s&&!_(h)&&{"aria-hidden":"true"},...h},[...m.map(([z,e])=>Y(z,e)),...Array.isArray(s)?s:[s]])});var t=(a,u)=>{let r=re(({className:f,...p},s)=>fe($,{ref:s,iconNode:u,className:E(`lucide-${Q(X(a))}`,`lucide-${a}`,f),...p}));return r.displayName=X(a),r};var se=[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]],F=t("activity",se);var ie=[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]],P=t("bot",ie);var ce=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],k=t("circle-alert",ce);var ne=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],x=t("loader-circle",ne);var pe=[["path",{d:"m10 17 5-5-5-5",key:"1bsop3"}],["path",{d:"M15 12H3",key:"6jk70r"}],["path",{d:"M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4",key:"u53s6r"}]],w=t("log-in",pe);var me=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]],D=t("message-square",me);var Le=[["path",{d:"M12.586 12.586 19 19",key:"ea5xo7"}],["path",{d:"M3.688 3.037a.497.497 0 0 0-.651.651l6.5 15.999a.501.501 0 0 0 .947-.062l1.569-6.083a2 2 0 0 1 1.448-1.479l6.124-1.579a.5.5 0 0 0 .063-.947z",key:"277e5u"}]],y=t("mouse-pointer",Le);var Ie=[["rect",{width:"5",height:"5",x:"3",y:"3",rx:"1",key:"1tu5fj"}],["rect",{width:"5",height:"5",x:"16",y:"3",rx:"1",key:"1v8r4q"}],["rect",{width:"5",height:"5",x:"3",y:"16",rx:"1",key:"1x03jg"}],["path",{d:"M21 16h-3a2 2 0 0 0-2 2v3",key:"177gqh"}],["path",{d:"M21 21v.01",key:"ents32"}],["path",{d:"M12 7v3a2 2 0 0 1-2 2H7",key:"8crl2c"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M12 3h.01",key:"n36tog"}],["path",{d:"M12 16v.01",key:"133mhm"}],["path",{d:"M16 12h1",key:"1slzba"}],["path",{d:"M21 12v.01",key:"1lwtk9"}],["path",{d:"M12 21v-1",key:"1880an"}]],R=t("qr-code",Ie);var xe=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],T=t("refresh-cw",xe);var Ce=[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]],q=t("smartphone",Ce);var he=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]],b=t("users",he);var ge=[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}],["path",{d:"M5 12.859a10 10 0 0 1 5.17-2.69",key:"1dl1wf"}],["path",{d:"M19 12.859a10 10 0 0 0-2.007-1.523",key:"4k23kn"}],["path",{d:"M2 8.82a15 15 0 0 1 4.177-2.643",key:"1grhjp"}],["path",{d:"M22 8.82a15 15 0 0 0-11.288-3.764",key:"z3jwby"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],v=t("wifi-off",ge);var Se=[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M2 8.82a15 15 0 0 1 20 0",key:"dnpr2z"}],["path",{d:"M5 12.859a10 10 0 0 1 14 0",key:"1x1e6c"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}]],U=t("wifi",Se);var ke=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],O=t("x",ke);import{useCallback as ae,useEffect as Be,useRef as te,useState as H}from"react";var ee="zhin_api_token",we="zhin_api_base";function Pe(){let a=localStorage.getItem(we)?.trim();return a?a.replace(/\/$/,""):typeof window<"u"?window.location.origin:""}function Ae(){return localStorage.getItem(ee)}async function A(a,u){let r=Ae(),f=new Headers(u?.headers);r&&f.set("Authorization",`Bearer ${r}`);let p=Pe(),s=typeof a=="string"&&a.startsWith("/")?`${p}${a}`:a,m=await fetch(s,{...u,headers:f});return m.status===401&&(localStorage.removeItem(ee),window.dispatchEvent(new CustomEvent("zhin:auth-required"))),m}import{jsx as o,jsxs as C}from"react/jsx-runtime";var Me=2e3,Fe=15e3,De={qrcode:{icon:o(R,{className:"w-4 h-4"}),label:"\u626B\u7801\u767B\u5F55"},sms:{icon:o(D,{className:"w-4 h-4"}),label:"\u77ED\u4FE1\u9A8C\u8BC1\u7801"},device:{icon:o(q,{className:"w-4 h-4"}),label:"\u8BBE\u5907\u9A8C\u8BC1"},slider:{icon:o(y,{className:"w-4 h-4"}),label:"\u6ED1\u5757\u9A8C\u8BC1"}};function K(){let[a,u]=H([]),[r,f]=H(!0),[p,s]=H(null),[m,h]=H({}),[L,d]=H({}),n=te(0),G=te(),g=ae(async()=>{try{let e=await A("/api/login-assist/pending");if(!e.ok)throw new Error("\u83B7\u53D6\u5F85\u529E\u5931\u8D25");let S=await e.json(),I=(Array.isArray(S)?S:[]).filter(W=>W.adapter==="icqq");u(I),s(null),n.current=I.length>0?0:n.current+1}catch(e){s(e.message),n.current++}finally{f(!1)}},[]),B=ae(()=>{let e=Math.min(Me*Math.pow(1.5,n.current),Fe);G.current=setTimeout(async()=>{await g(),B()},e)},[g]);Be(()=>(g().then(B),()=>clearTimeout(G.current)),[g,B]);let M=async(e,S)=>{h(c=>({...c,[e]:!0}));try{if(!(await A("/api/login-assist/submit",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e,value:S})})).ok)throw new Error("\u63D0\u4EA4\u5931\u8D25");d(I=>{let W={...I};return delete W[e],W}),n.current=0,await g()}catch(c){s(c.message)}finally{h(c=>({...c,[e]:!1}))}},z=async e=>{try{(await A("/api/login-assist/cancel",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e})})).ok&&await g()}catch{}};return r&&a.length===0?o("div",{className:"flex justify-center py-12",children:o(x,{className:"w-6 h-6 animate-spin text-blue-500"})}):C("div",{className:"space-y-4",children:[o("p",{className:"text-sm text-muted-foreground",children:"\u626B\u7801\u3001\u77ED\u4FE1\u6216\u6ED1\u5757\u7B49\u9A8C\u8BC1\u4F1A\u51FA\u73B0\u5728\u4E0B\u65B9\uFF1B\u5237\u65B0\u9875\u9762\u540E\u4ECD\u53EF\u7EE7\u7EED\u5904\u7406\uFF08\u4EC5 ICQQ \u5F85\u529E\uFF09\u3002"}),p&&C("div",{className:"flex items-center gap-2 p-3 rounded border border-red-200 bg-red-50 text-red-600 text-sm dark:bg-red-900/20 dark:text-red-400 dark:border-red-800",children:[o(k,{className:"w-4 h-4 shrink-0"}),o("span",{children:p}),o("button",{onClick:()=>s(null),className:"ml-auto",children:o(O,{className:"w-3.5 h-3.5"})})]}),a.length===0?C("div",{className:"border rounded-lg bg-card p-12 text-center",children:[o(w,{className:"w-16 h-16 mx-auto mb-4 opacity-25"}),o("h3",{className:"text-lg font-semibold mb-1",children:"\u6682\u65E0\u5F85\u529E"}),o("p",{className:"text-sm text-muted-foreground",children:"\u673A\u5668\u4EBA\u9700\u8981\u9A8C\u8BC1\u65F6\uFF0C\u5F85\u529E\u5C06\u663E\u793A\u5728\u6B64\u5904"})]}):o("div",{className:"space-y-4",children:a.map(e=>{let S=De[e.type]??{icon:o(w,{className:"w-4 h-4"}),label:e.type};return C("div",{className:"border rounded-lg bg-card p-4 shadow-sm",children:[C("div",{className:"flex items-start justify-between flex-wrap gap-2 mb-2",children:[C("div",{className:"flex items-center gap-2 font-semibold",children:[S.icon," ",S.label]}),C("div",{className:"flex gap-1 text-xs",children:[o("span",{className:"px-2 py-0.5 rounded border",children:e.adapter}),o("span",{className:"px-2 py-0.5 rounded bg-muted",children:e.botId})]})]}),e.payload?.message&&o("p",{className:"text-sm text-muted-foreground mb-3",children:e.payload.message}),e.type==="qrcode"&&e.payload?.image&&o("div",{className:"flex justify-center p-4 bg-muted/30 rounded-lg mb-3",children:o("img",{src:String(e.payload.image),alt:"\u767B\u5F55\u4E8C\u7EF4\u7801",className:"max-w-[200px] w-full h-auto"})}),e.type==="slider"&&e.payload?.url&&C("p",{className:"text-sm break-all mb-3",children:[o("span",{className:"text-muted-foreground",children:"\u6ED1\u5757\u94FE\u63A5\uFF1A"})," ",o("a",{href:String(e.payload.url),target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:String(e.payload.url)})]}),(e.type==="sms"||e.type==="device"||e.type==="slider")&&C("div",{className:"flex flex-wrap gap-2 items-center",children:[o("input",{className:"h-9 px-3 rounded-md border border-input bg-background text-sm max-w-[18rem] flex-1",placeholder:e.type==="slider"?"\u8F93\u5165 ticket":"\u8F93\u5165\u9A8C\u8BC1\u7801",value:L[e.id]??"",onChange:c=>d(I=>({...I,[e.id]:c.target.value})),onKeyDown:c=>{if(c.key==="Enter"){let I=L[e.id]?.trim();I&&M(e.id,e.type==="slider"?{ticket:I}:I)}}}),o("button",{className:"h-9 px-4 rounded-md bg-primary text-primary-foreground text-sm disabled:opacity-50",disabled:m[e.id]||!L[e.id]?.trim(),onClick:()=>{let c=L[e.id]?.trim();c&&M(e.id,e.type==="slider"?{ticket:c}:c)},children:m[e.id]?"\u63D0\u4EA4\u4E2D\u2026":"\u63D0\u4EA4"})]}),e.type==="qrcode"&&C("div",{className:"flex gap-2 mt-3",children:[o("button",{className:"h-9 px-4 rounded-md bg-primary text-primary-foreground text-sm disabled:opacity-50",disabled:!!m[e.id],onClick:()=>{M(e.id,{done:!0})},children:m[e.id]?"\u63D0\u4EA4\u4E2D\u2026":"\u6211\u5DF2\u626B\u7801"}),o("button",{className:"h-9 px-4 rounded-md border text-sm hover:bg-accent transition-colors",onClick:()=>{z(e.id)},children:"\u53D6\u6D88"})]})]},e.id)})})]})}import{Fragment as Te,jsx as l,jsxs as i}from"react/jsx-runtime";function Z(){let[a,u]=N("overview"),[r,f]=N([]),[p,s]=N(!0),[m,h]=N(null),L=ye(async()=>{s(!0),h(null);try{let d=await A("/api/icqq/bots"),n=await d.json();if(!d.ok||!n.success)throw new Error(n.message||"\u52A0\u8F7D\u5931\u8D25");f(Array.isArray(n.data)?n.data:[])}catch(d){h(d.message),f([])}finally{s(!1)}},[]);return Re(()=>{a==="overview"&&L()},[a,L]),i("div",{className:"p-6 max-w-5xl mx-auto space-y-5",children:[i("div",{className:"flex items-center justify-between",children:[i("div",{children:[i("h1",{className:"text-2xl font-bold flex items-center gap-2",children:[l(P,{className:"w-6 h-6"})," ICQQ \u7BA1\u7406"]}),l("p",{className:"text-sm text-muted-foreground mt-1",children:"\u673A\u5668\u4EBA\u6982\u89C8\u4E0E\u767B\u5F55\u8F85\u52A9\uFF08\u626B\u7801 / \u9A8C\u8BC1\u7801 / \u6ED1\u5757\uFF09"})]}),a==="overview"&&i("button",{onClick:L,disabled:p,className:"flex items-center gap-1 px-3 py-1.5 rounded bg-blue-500 text-white hover:bg-blue-600 disabled:opacity-50 text-sm",children:[l(T,{className:`w-4 h-4 ${p?"animate-spin":""}`})," \u5237\u65B0"]})]}),i("div",{className:"flex gap-1 border-b",children:[l("button",{onClick:()=>u("overview"),className:`px-4 py-2 text-sm font-medium border-b-2 transition-colors ${a==="overview"?"border-blue-500 text-blue-600":"border-transparent text-gray-500 hover:text-gray-700"}`,children:i("span",{className:"flex items-center gap-1.5",children:[l(P,{className:"w-4 h-4"})," \u6982\u89C8"]})}),l("button",{onClick:()=>u("login"),className:`px-4 py-2 text-sm font-medium border-b-2 transition-colors ${a==="login"?"border-blue-500 text-blue-600":"border-transparent text-gray-500 hover:text-gray-700"}`,children:i("span",{className:"flex items-center gap-1.5",children:[l(w,{className:"w-4 h-4"})," \u767B\u5F55\u8F85\u52A9"]})})]}),a==="overview"&&i(Te,{children:[m&&l("div",{className:"p-3 bg-red-50 text-red-600 rounded border border-red-200 text-sm dark:bg-red-900/20 dark:text-red-400 dark:border-red-800",children:m}),p?l("div",{className:"flex justify-center py-12",children:l(x,{className:"w-6 h-6 animate-spin text-blue-500"})}):r.length===0?l("div",{className:"text-center text-muted-foreground py-12",children:"\u6682\u65E0 ICQQ \u673A\u5668\u4EBA\u5B9E\u4F8B"}):l("div",{className:"grid gap-4 md:grid-cols-2",children:r.map(d=>i("div",{className:"border rounded-lg p-4 bg-card shadow-sm",children:[i("div",{className:"flex items-center justify-between mb-3",children:[l("span",{className:"font-medium text-lg",children:d.name}),d.connected?i("span",{className:"flex items-center gap-1 text-green-600 text-sm",children:[l(U,{className:"w-4 h-4"})," \u5728\u7EBF"]}):i("span",{className:"flex items-center gap-1 text-gray-400 text-sm",children:[l(v,{className:"w-4 h-4"})," \u79BB\u7EBF"]})]}),i("div",{className:"space-y-2 text-sm text-muted-foreground",children:[i("div",{className:"flex items-center gap-1.5",children:[l(b,{className:"w-3.5 h-3.5"}),"\u7FA4 ",d.groupCount," \xB7 \u597D\u53CB ",d.friendCount]}),i("div",{className:"flex items-center gap-1.5",children:[l(F,{className:"w-3.5 h-3.5"}),"\u767B\u5F55\u65B9\u5F0F ",d.loginMode," \xB7 ",d.status]})]})]},d.name))})]}),a==="login"&&l(K,{})]})}function ut(a){a.addRoute({path:"/console/icqq",name:"ICQQ\u7BA1\u7406",element:a.React.createElement(Z,{hostReact:a.React})}),a.addTool({id:"icqq",name:"ICQQ",path:"/console/icqq"})}export{ut as register};
|
|
1
|
+
import{useCallback as Fe,useEffect as De,useState as V}from"react";import{forwardRef as le,createElement as re}from"react";var E=(...a)=>a.filter((u,r,f)=>!!u&&u.trim()!==""&&f.indexOf(u)===r).join(" ").trim();var Z=a=>a.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();var Q=a=>a.replace(/^([A-Z])|[\s-_]+(\w)/g,(u,r,f)=>f?f.toUpperCase():r.toLowerCase());var z=a=>{let u=Q(a);return u.charAt(0).toUpperCase()+u.slice(1)};import{forwardRef as de,createElement as j}from"react";var W={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};var J=a=>{for(let u in a)if(u.startsWith("aria-")||u==="role"||u==="title")return!0;return!1};import{createContext as te,useContext as oe,useMemo as Ge,createElement as Ee}from"react";var ue=te({});var _=()=>oe(ue);var Y=de(({color:a,size:u,strokeWidth:r,absoluteStrokeWidth:f,className:p="",children:s,iconNode:m,...h},L)=>{let{size:d=24,strokeWidth:n=2,absoluteStrokeWidth:H=!1,color:g="currentColor",className:A=""}=_()??{},B=f??H?Number(r??n)*24/Number(u??d):r??n;return j("svg",{ref:L,...W,width:u??d??W.width,height:u??d??W.height,stroke:a??g,strokeWidth:B,className:E("lucide",A,p),...!s&&!J(h)&&{"aria-hidden":"true"},...h},[...m.map(([N,e])=>j(N,e)),...Array.isArray(s)?s:[s]])});var o=(a,u)=>{let r=le(({className:f,...p},s)=>re(Y,{ref:s,iconNode:u,className:E(`lucide-${Z(z(a))}`,`lucide-${a}`,f),...p}));return r.displayName=z(a),r};var fe=[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]],M=o("activity",fe);var se=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],k=o("circle-alert",se);var ie=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],x=o("loader-circle",ie);var ce=[["path",{d:"m10 17 5-5-5-5",key:"1bsop3"}],["path",{d:"M15 12H3",key:"6jk70r"}],["path",{d:"M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4",key:"u53s6r"}]],w=o("log-in",ce);var ne=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]],F=o("message-square",ne);var pe=[["path",{d:"M12.586 12.586 19 19",key:"ea5xo7"}],["path",{d:"M3.688 3.037a.497.497 0 0 0-.651.651l6.5 15.999a.501.501 0 0 0 .947-.062l1.569-6.083a2 2 0 0 1 1.448-1.479l6.124-1.579a.5.5 0 0 0 .063-.947z",key:"277e5u"}]],D=o("mouse-pointer",pe);var me=[["rect",{width:"5",height:"5",x:"3",y:"3",rx:"1",key:"1tu5fj"}],["rect",{width:"5",height:"5",x:"16",y:"3",rx:"1",key:"1v8r4q"}],["rect",{width:"5",height:"5",x:"3",y:"16",rx:"1",key:"1x03jg"}],["path",{d:"M21 16h-3a2 2 0 0 0-2 2v3",key:"177gqh"}],["path",{d:"M21 21v.01",key:"ents32"}],["path",{d:"M12 7v3a2 2 0 0 1-2 2H7",key:"8crl2c"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M12 3h.01",key:"n36tog"}],["path",{d:"M12 16v.01",key:"133mhm"}],["path",{d:"M16 12h1",key:"1slzba"}],["path",{d:"M21 12v.01",key:"1lwtk9"}],["path",{d:"M12 21v-1",key:"1880an"}]],y=o("qr-code",me);var Le=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],R=o("refresh-cw",Le);var Ie=[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]],T=o("smartphone",Ie);var xe=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]],q=o("users",xe);var Ce=[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}],["path",{d:"M5 12.859a10 10 0 0 1 5.17-2.69",key:"1dl1wf"}],["path",{d:"M19 12.859a10 10 0 0 0-2.007-1.523",key:"4k23kn"}],["path",{d:"M2 8.82a15 15 0 0 1 4.177-2.643",key:"1grhjp"}],["path",{d:"M22 8.82a15 15 0 0 0-11.288-3.764",key:"z3jwby"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],b=o("wifi-off",Ce);var he=[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M2 8.82a15 15 0 0 1 20 0",key:"dnpr2z"}],["path",{d:"M5 12.859a10 10 0 0 1 14 0",key:"1x1e6c"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}]],v=o("wifi",he);var ge=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],U=o("x",ge);import{useCallback as ee,useEffect as Pe,useRef as ae,useState as O}from"react";var $="zhin_api_token",Se="zhin_api_base";function ke(){let a=localStorage.getItem(Se)?.trim();return a?a.replace(/\/$/,""):typeof window<"u"?window.location.origin:""}function we(){return localStorage.getItem($)}async function P(a,u){let r=we(),f=new Headers(u?.headers);r&&f.set("Authorization",`Bearer ${r}`);let p=ke(),s=typeof a=="string"&&a.startsWith("/")?`${p}${a}`:a,m=await fetch(s,{...u,headers:f});return m.status===401&&(localStorage.removeItem($),window.dispatchEvent(new CustomEvent("zhin:auth-required"))),m}import{jsx as t,jsxs as C}from"react/jsx-runtime";var Ae=2e3,Be=15e3,Me={qrcode:{icon:t(y,{className:"w-4 h-4"}),label:"\u626B\u7801\u767B\u5F55"},sms:{icon:t(F,{className:"w-4 h-4"}),label:"\u77ED\u4FE1\u9A8C\u8BC1\u7801"},device:{icon:t(T,{className:"w-4 h-4"}),label:"\u8BBE\u5907\u9A8C\u8BC1"},slider:{icon:t(D,{className:"w-4 h-4"}),label:"\u6ED1\u5757\u9A8C\u8BC1"}};function X(){let[a,u]=O([]),[r,f]=O(!0),[p,s]=O(null),[m,h]=O({}),[L,d]=O({}),n=ae(0),H=ae(),g=ee(async()=>{try{let e=await P("/api/login-assist/pending");if(!e.ok)throw new Error("\u83B7\u53D6\u5F85\u529E\u5931\u8D25");let S=await e.json(),I=(Array.isArray(S)?S:[]).filter(G=>G.adapter==="icqq");u(I),s(null),n.current=I.length>0?0:n.current+1}catch(e){s(e.message),n.current++}finally{f(!1)}},[]),A=ee(()=>{let e=Math.min(Ae*Math.pow(1.5,n.current),Be);H.current=setTimeout(async()=>{await g(),A()},e)},[g]);Pe(()=>(g().then(A),()=>clearTimeout(H.current)),[g,A]);let B=async(e,S)=>{h(c=>({...c,[e]:!0}));try{if(!(await P("/api/login-assist/submit",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e,value:S})})).ok)throw new Error("\u63D0\u4EA4\u5931\u8D25");d(I=>{let G={...I};return delete G[e],G}),n.current=0,await g()}catch(c){s(c.message)}finally{h(c=>({...c,[e]:!1}))}},N=async e=>{try{(await P("/api/login-assist/cancel",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:e})})).ok&&await g()}catch{}};return r&&a.length===0?t("div",{className:"flex justify-center py-12",children:t(x,{className:"w-6 h-6 animate-spin text-blue-500"})}):C("div",{className:"space-y-4",children:[t("p",{className:"text-sm text-muted-foreground",children:"\u626B\u7801\u3001\u77ED\u4FE1\u6216\u6ED1\u5757\u7B49\u9A8C\u8BC1\u4F1A\u51FA\u73B0\u5728\u4E0B\u65B9\uFF1B\u5237\u65B0\u9875\u9762\u540E\u4ECD\u53EF\u7EE7\u7EED\u5904\u7406\uFF08\u4EC5 ICQQ \u5F85\u529E\uFF09\u3002"}),p&&C("div",{className:"flex items-center gap-2 p-3 rounded border border-red-200 bg-red-50 text-red-600 text-sm dark:bg-red-900/20 dark:text-red-400 dark:border-red-800",children:[t(k,{className:"w-4 h-4 shrink-0"}),t("span",{children:p}),t("button",{onClick:()=>s(null),className:"ml-auto",children:t(U,{className:"w-3.5 h-3.5"})})]}),a.length===0?C("div",{className:"border rounded-lg bg-card p-12 text-center",children:[t(w,{className:"w-16 h-16 mx-auto mb-4 opacity-25"}),t("h3",{className:"text-lg font-semibold mb-1",children:"\u6682\u65E0\u5F85\u529E"}),t("p",{className:"text-sm text-muted-foreground",children:"\u673A\u5668\u4EBA\u9700\u8981\u9A8C\u8BC1\u65F6\uFF0C\u5F85\u529E\u5C06\u663E\u793A\u5728\u6B64\u5904"})]}):t("div",{className:"space-y-4",children:a.map(e=>{let S=Me[e.type]??{icon:t(w,{className:"w-4 h-4"}),label:e.type};return C("div",{className:"border rounded-lg bg-card p-4 shadow-sm",children:[C("div",{className:"flex items-start justify-between flex-wrap gap-2 mb-2",children:[C("div",{className:"flex items-center gap-2 font-semibold",children:[S.icon," ",S.label]}),C("div",{className:"flex gap-1 text-xs",children:[t("span",{className:"px-2 py-0.5 rounded border",children:e.adapter}),t("span",{className:"px-2 py-0.5 rounded bg-muted",children:e.endpointId})]})]}),e.payload?.message&&t("p",{className:"text-sm text-muted-foreground mb-3",children:e.payload.message}),e.type==="qrcode"&&e.payload?.image&&t("div",{className:"flex justify-center p-4 bg-muted/30 rounded-lg mb-3",children:t("img",{src:String(e.payload.image),alt:"\u767B\u5F55\u4E8C\u7EF4\u7801",className:"max-w-[200px] w-full h-auto"})}),e.type==="slider"&&e.payload?.url&&C("p",{className:"text-sm break-all mb-3",children:[t("span",{className:"text-muted-foreground",children:"\u6ED1\u5757\u94FE\u63A5\uFF1A"})," ",t("a",{href:String(e.payload.url),target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:String(e.payload.url)})]}),(e.type==="sms"||e.type==="device"||e.type==="slider")&&C("div",{className:"flex flex-wrap gap-2 items-center",children:[t("input",{className:"h-9 px-3 rounded-md border border-input bg-background text-sm max-w-[18rem] flex-1",placeholder:e.type==="slider"?"\u8F93\u5165 ticket":"\u8F93\u5165\u9A8C\u8BC1\u7801",value:L[e.id]??"",onChange:c=>d(I=>({...I,[e.id]:c.target.value})),onKeyDown:c=>{if(c.key==="Enter"){let I=L[e.id]?.trim();I&&B(e.id,e.type==="slider"?{ticket:I}:I)}}}),t("button",{className:"h-9 px-4 rounded-md bg-primary text-primary-foreground text-sm disabled:opacity-50",disabled:m[e.id]||!L[e.id]?.trim(),onClick:()=>{let c=L[e.id]?.trim();c&&B(e.id,e.type==="slider"?{ticket:c}:c)},children:m[e.id]?"\u63D0\u4EA4\u4E2D\u2026":"\u63D0\u4EA4"})]}),e.type==="qrcode"&&C("div",{className:"flex gap-2 mt-3",children:[t("button",{className:"h-9 px-4 rounded-md bg-primary text-primary-foreground text-sm disabled:opacity-50",disabled:!!m[e.id],onClick:()=>{B(e.id,{done:!0})},children:m[e.id]?"\u63D0\u4EA4\u4E2D\u2026":"\u6211\u5DF2\u626B\u7801"}),t("button",{className:"h-9 px-4 rounded-md border text-sm hover:bg-accent transition-colors",onClick:()=>{N(e.id)},children:"\u53D6\u6D88"})]})]},e.id)})})]})}import{Fragment as ye,jsx as l,jsxs as i}from"react/jsx-runtime";function K(){let[a,u]=V("overview"),[r,f]=V([]),[p,s]=V(!0),[m,h]=V(null),L=Fe(async()=>{s(!0),h(null);try{let d=await P("/api/icqq/endpoints"),n=await d.json();if(!d.ok||!n.success)throw new Error(n.message||"\u52A0\u8F7D\u5931\u8D25");f(Array.isArray(n.data)?n.data:[])}catch(d){h(d.message),f([])}finally{s(!1)}},[]);return De(()=>{a==="overview"&&L()},[a,L]),i("div",{className:"p-6 max-w-5xl mx-auto space-y-5",children:[i("div",{className:"flex items-center justify-between",children:[i("div",{children:[i("h1",{className:"text-2xl font-bold flex items-center gap-2",children:[l(Bot,{className:"w-6 h-6"})," ICQQ \u7BA1\u7406"]}),l("p",{className:"text-sm text-muted-foreground mt-1",children:"\u673A\u5668\u4EBA\u6982\u89C8\u4E0E\u767B\u5F55\u8F85\u52A9\uFF08\u626B\u7801 / \u9A8C\u8BC1\u7801 / \u6ED1\u5757\uFF09"})]}),a==="overview"&&i("button",{onClick:L,disabled:p,className:"flex items-center gap-1 px-3 py-1.5 rounded bg-blue-500 text-white hover:bg-blue-600 disabled:opacity-50 text-sm",children:[l(R,{className:`w-4 h-4 ${p?"animate-spin":""}`})," \u5237\u65B0"]})]}),i("div",{className:"flex gap-1 border-b",children:[l("button",{onClick:()=>u("overview"),className:`px-4 py-2 text-sm font-medium border-b-2 transition-colors ${a==="overview"?"border-blue-500 text-blue-600":"border-transparent text-gray-500 hover:text-gray-700"}`,children:i("span",{className:"flex items-center gap-1.5",children:[l(Bot,{className:"w-4 h-4"})," \u6982\u89C8"]})}),l("button",{onClick:()=>u("login"),className:`px-4 py-2 text-sm font-medium border-b-2 transition-colors ${a==="login"?"border-blue-500 text-blue-600":"border-transparent text-gray-500 hover:text-gray-700"}`,children:i("span",{className:"flex items-center gap-1.5",children:[l(w,{className:"w-4 h-4"})," \u767B\u5F55\u8F85\u52A9"]})})]}),a==="overview"&&i(ye,{children:[m&&l("div",{className:"p-3 bg-red-50 text-red-600 rounded border border-red-200 text-sm dark:bg-red-900/20 dark:text-red-400 dark:border-red-800",children:m}),p?l("div",{className:"flex justify-center py-12",children:l(x,{className:"w-6 h-6 animate-spin text-blue-500"})}):r.length===0?l("div",{className:"text-center text-muted-foreground py-12",children:"\u6682\u65E0 ICQQ Endpoint \u5B9E\u4F8B"}):l("div",{className:"grid gap-4 md:grid-cols-2",children:r.map(d=>i("div",{className:"border rounded-lg p-4 bg-card shadow-sm",children:[i("div",{className:"flex items-center justify-between mb-3",children:[l("span",{className:"font-medium text-lg",children:d.name}),d.connected?i("span",{className:"flex items-center gap-1 text-green-600 text-sm",children:[l(v,{className:"w-4 h-4"})," \u5728\u7EBF"]}):i("span",{className:"flex items-center gap-1 text-gray-400 text-sm",children:[l(b,{className:"w-4 h-4"})," \u79BB\u7EBF"]})]}),i("div",{className:"space-y-2 text-sm text-muted-foreground",children:[i("div",{className:"flex items-center gap-1.5",children:[l(q,{className:"w-3.5 h-3.5"}),"\u7FA4 ",d.groupCount," \xB7 \u597D\u53CB ",d.friendCount]}),i("div",{className:"flex items-center gap-1.5",children:[l(M,{className:"w-3.5 h-3.5"}),"\u767B\u5F55\u65B9\u5F0F ",d.loginMode," \xB7 ",d.status]})]})]},d.name))})]}),a==="login"&&l(X,{})]})}function et(a){a.addRoute({path:"/console/icqq",name:"ICQQ\u7BA1\u7406",element:a.React.createElement(K,{hostReact:a.React})}),a.addTool({id:"icqq",name:"ICQQ",path:"/console/icqq"})}export{et as register};
|
|
2
2
|
/*! Bundled license information:
|
|
3
3
|
|
|
4
4
|
lucide-react/dist/esm/shared/src/utils/mergeClasses.mjs:
|
|
@@ -11,7 +11,6 @@ lucide-react/dist/esm/context.mjs:
|
|
|
11
11
|
lucide-react/dist/esm/Icon.mjs:
|
|
12
12
|
lucide-react/dist/esm/createLucideIcon.mjs:
|
|
13
13
|
lucide-react/dist/esm/icons/activity.mjs:
|
|
14
|
-
lucide-react/dist/esm/icons/bot.mjs:
|
|
15
14
|
lucide-react/dist/esm/icons/circle-alert.mjs:
|
|
16
15
|
lucide-react/dist/esm/icons/loader-circle.mjs:
|
|
17
16
|
lucide-react/dist/esm/icons/log-in.mjs:
|
package/lib/adapter.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* ICQQ 适配器 — 通过 @icqqjs/cli 守护进程 IPC 管理
|
|
2
|
+
* ICQQ 适配器 — 通过 @icqqjs/cli 守护进程 IPC 管理 Endpoint 实例
|
|
3
3
|
*/
|
|
4
4
|
import { Adapter, Plugin } from 'zhin.js';
|
|
5
|
-
import {
|
|
6
|
-
import type {
|
|
7
|
-
export declare class IcqqAdapter extends Adapter<
|
|
5
|
+
import { IcqqEndpoint } from "./endpoint.js";
|
|
6
|
+
import type { IcqqEndpointConfig } from "./types.js";
|
|
7
|
+
export declare class IcqqAdapter extends Adapter<IcqqEndpoint> {
|
|
8
|
+
static readonly capabilities: readonly ["inbound", "outbound"];
|
|
8
9
|
constructor(plugin: Plugin);
|
|
9
10
|
getOutboundMediaCapabilities(): {
|
|
10
11
|
image: boolean;
|
|
@@ -13,17 +14,17 @@ export declare class IcqqAdapter extends Adapter<IcqqBot> {
|
|
|
13
14
|
file: boolean;
|
|
14
15
|
maxAttachmentBytes: number;
|
|
15
16
|
};
|
|
16
|
-
|
|
17
|
+
createEndpoint(config: IcqqEndpointConfig): IcqqEndpoint;
|
|
17
18
|
start(): Promise<void>;
|
|
18
19
|
stop(): Promise<void>;
|
|
19
|
-
private
|
|
20
|
-
kickMember(
|
|
21
|
-
muteMember(
|
|
22
|
-
muteAll(
|
|
23
|
-
setAdmin(
|
|
24
|
-
setMemberNickname(
|
|
25
|
-
setGroupName(
|
|
26
|
-
listMembers(
|
|
20
|
+
private getEndpoint;
|
|
21
|
+
kickMember(endpointId: string, sceneId: string, userId: string): Promise<boolean>;
|
|
22
|
+
muteMember(endpointId: string, sceneId: string, userId: string, duration?: number): Promise<boolean>;
|
|
23
|
+
muteAll(endpointId: string, sceneId: string, enable?: boolean): Promise<boolean>;
|
|
24
|
+
setAdmin(endpointId: string, sceneId: string, userId: string, enable?: boolean): Promise<boolean>;
|
|
25
|
+
setMemberNickname(endpointId: string, sceneId: string, userId: string, nickname: string): Promise<boolean>;
|
|
26
|
+
setGroupName(endpointId: string, sceneId: string, name: string): Promise<boolean>;
|
|
27
|
+
listMembers(endpointId: string, sceneId: string): Promise<{
|
|
27
28
|
members: {
|
|
28
29
|
user_id: number;
|
|
29
30
|
nickname: string;
|
package/lib/adapter.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../src/adapter.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAiB,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACzD,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../src/adapter.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAiB,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,KAAK,EAAE,kBAAkB,EAAiB,MAAM,YAAY,CAAC;AAGpE,qBAAa,WAAY,SAAQ,OAAO,CAAC,YAAY,CAAC;IACpD,gBAAyB,YAAY,mCAAoC;gBAE7D,MAAM,EAAE,MAAM;IAI1B,4BAA4B;;;;;;;IAU5B,cAAc,CAAC,MAAM,EAAE,kBAAkB,GAAG,YAAY;IAIlD,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAItB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAO3B,OAAO,CAAC,WAAW;IAMb,UAAU,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;IAW9D,UAAU,CACd,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,MAAM,EACd,QAAQ,SAAM;IAYV,OAAO,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,UAAO;IAU1D,QAAQ,CACZ,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,MAAM,EACd,MAAM,UAAO;IAYT,iBAAiB,CACrB,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM;IAYZ,YAAY,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM;IAU9D,WAAW,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM;;;;;;;;;;CAiBtD"}
|
package/lib/adapter.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* ICQQ 适配器 — 通过 @icqqjs/cli 守护进程 IPC 管理
|
|
2
|
+
* ICQQ 适配器 — 通过 @icqqjs/cli 守护进程 IPC 管理 Endpoint 实例
|
|
3
3
|
*/
|
|
4
4
|
import { formatCompact, Adapter } from 'zhin.js';
|
|
5
|
-
import {
|
|
5
|
+
import { IcqqEndpoint } from "./endpoint.js";
|
|
6
6
|
import { Actions } from "./protocol.js";
|
|
7
7
|
export class IcqqAdapter extends Adapter {
|
|
8
|
+
static capabilities = ['inbound', 'outbound'];
|
|
8
9
|
constructor(plugin) {
|
|
9
10
|
super(plugin, "icqq", []);
|
|
10
11
|
}
|
|
@@ -17,8 +18,8 @@ export class IcqqAdapter extends Adapter {
|
|
|
17
18
|
maxAttachmentBytes: 20 * 1024 * 1024,
|
|
18
19
|
};
|
|
19
20
|
}
|
|
20
|
-
|
|
21
|
-
return new
|
|
21
|
+
createEndpoint(config) {
|
|
22
|
+
return new IcqqEndpoint(this, config);
|
|
22
23
|
}
|
|
23
24
|
async start() {
|
|
24
25
|
await super.start();
|
|
@@ -28,15 +29,15 @@ export class IcqqAdapter extends Adapter {
|
|
|
28
29
|
this.logger.debug(formatCompact({ stop: true }));
|
|
29
30
|
}
|
|
30
31
|
// ── IGroupManagement 标准群管方法(通过 IPC) ─────────────────────
|
|
31
|
-
|
|
32
|
-
const
|
|
33
|
-
if (!
|
|
34
|
-
throw new Error(`
|
|
35
|
-
return
|
|
32
|
+
getEndpoint(endpointId) {
|
|
33
|
+
const endpoint = this.endpoints.get(endpointId);
|
|
34
|
+
if (!endpoint)
|
|
35
|
+
throw new Error(`Endpoint ${endpointId} 不存在`);
|
|
36
|
+
return endpoint;
|
|
36
37
|
}
|
|
37
|
-
async kickMember(
|
|
38
|
-
const
|
|
39
|
-
const resp = await
|
|
38
|
+
async kickMember(endpointId, sceneId, userId) {
|
|
39
|
+
const endpoint = this.getEndpoint(endpointId);
|
|
40
|
+
const resp = await endpoint.ipc.request(Actions.GROUP_KICK, {
|
|
40
41
|
group_id: Number(sceneId),
|
|
41
42
|
user_id: Number(userId),
|
|
42
43
|
reject_add_request: false,
|
|
@@ -45,9 +46,9 @@ export class IcqqAdapter extends Adapter {
|
|
|
45
46
|
throw new Error(resp.error ?? "踢人失败");
|
|
46
47
|
return true;
|
|
47
48
|
}
|
|
48
|
-
async muteMember(
|
|
49
|
-
const
|
|
50
|
-
const resp = await
|
|
49
|
+
async muteMember(endpointId, sceneId, userId, duration = 600) {
|
|
50
|
+
const endpoint = this.getEndpoint(endpointId);
|
|
51
|
+
const resp = await endpoint.ipc.request(Actions.GROUP_MUTE, {
|
|
51
52
|
group_id: Number(sceneId),
|
|
52
53
|
user_id: Number(userId),
|
|
53
54
|
duration,
|
|
@@ -56,9 +57,9 @@ export class IcqqAdapter extends Adapter {
|
|
|
56
57
|
throw new Error(resp.error ?? "禁言失败");
|
|
57
58
|
return true;
|
|
58
59
|
}
|
|
59
|
-
async muteAll(
|
|
60
|
-
const
|
|
61
|
-
const resp = await
|
|
60
|
+
async muteAll(endpointId, sceneId, enable = true) {
|
|
61
|
+
const endpoint = this.getEndpoint(endpointId);
|
|
62
|
+
const resp = await endpoint.ipc.request(Actions.GROUP_MUTE_ALL, {
|
|
62
63
|
group_id: Number(sceneId),
|
|
63
64
|
enable,
|
|
64
65
|
});
|
|
@@ -66,9 +67,9 @@ export class IcqqAdapter extends Adapter {
|
|
|
66
67
|
throw new Error(resp.error ?? "全员禁言失败");
|
|
67
68
|
return true;
|
|
68
69
|
}
|
|
69
|
-
async setAdmin(
|
|
70
|
-
const
|
|
71
|
-
const resp = await
|
|
70
|
+
async setAdmin(endpointId, sceneId, userId, enable = true) {
|
|
71
|
+
const endpoint = this.getEndpoint(endpointId);
|
|
72
|
+
const resp = await endpoint.ipc.request(Actions.SET_GROUP_ADMIN, {
|
|
72
73
|
group_id: Number(sceneId),
|
|
73
74
|
user_id: Number(userId),
|
|
74
75
|
enable,
|
|
@@ -77,9 +78,9 @@ export class IcqqAdapter extends Adapter {
|
|
|
77
78
|
throw new Error(resp.error ?? "设置管理员失败");
|
|
78
79
|
return true;
|
|
79
80
|
}
|
|
80
|
-
async setMemberNickname(
|
|
81
|
-
const
|
|
82
|
-
const resp = await
|
|
81
|
+
async setMemberNickname(endpointId, sceneId, userId, nickname) {
|
|
82
|
+
const endpoint = this.getEndpoint(endpointId);
|
|
83
|
+
const resp = await endpoint.ipc.request(Actions.SET_GROUP_CARD, {
|
|
83
84
|
group_id: Number(sceneId),
|
|
84
85
|
user_id: Number(userId),
|
|
85
86
|
card: nickname,
|
|
@@ -88,9 +89,9 @@ export class IcqqAdapter extends Adapter {
|
|
|
88
89
|
throw new Error(resp.error ?? "设置群名片失败");
|
|
89
90
|
return true;
|
|
90
91
|
}
|
|
91
|
-
async setGroupName(
|
|
92
|
-
const
|
|
93
|
-
const resp = await
|
|
92
|
+
async setGroupName(endpointId, sceneId, name) {
|
|
93
|
+
const endpoint = this.getEndpoint(endpointId);
|
|
94
|
+
const resp = await endpoint.ipc.request(Actions.SET_GROUP_NAME, {
|
|
94
95
|
group_id: Number(sceneId),
|
|
95
96
|
name,
|
|
96
97
|
});
|
|
@@ -98,9 +99,9 @@ export class IcqqAdapter extends Adapter {
|
|
|
98
99
|
throw new Error(resp.error ?? "设置群名失败");
|
|
99
100
|
return true;
|
|
100
101
|
}
|
|
101
|
-
async listMembers(
|
|
102
|
-
const
|
|
103
|
-
const resp = await
|
|
102
|
+
async listMembers(endpointId, sceneId) {
|
|
103
|
+
const endpoint = this.getEndpoint(endpointId);
|
|
104
|
+
const resp = await endpoint.ipc.request(Actions.LIST_GROUP_MEMBERS, {
|
|
104
105
|
group_id: Number(sceneId),
|
|
105
106
|
});
|
|
106
107
|
if (!resp.ok)
|
package/lib/adapter.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adapter.js","sourceRoot":"","sources":["../src/adapter.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,aAAa,EAAE,OAAO,EAAU,MAAM,SAAS,CAAC;AACzD,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"adapter.js","sourceRoot":"","sources":["../src/adapter.ts"],"names":[],"mappings":"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"}
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* ICQQ Bot:通过 @icqqjs/cli 守护进程 IPC 通信,实现 zhin
|
|
2
|
+
* ICQQ Bot:通过 @icqqjs/cli 守护进程 IPC 通信,实现 zhin Endpoint 接口
|
|
3
3
|
*
|
|
4
4
|
* 不再直接依赖 @icqqjs/icqq 协议库。
|
|
5
|
-
* 登录由 `icqq login` 完成,本
|
|
5
|
+
* 登录由 `icqq login` 完成,本 Endpoint 只负责连接守护进程并收发消息。
|
|
6
6
|
*/
|
|
7
|
-
import {
|
|
8
|
-
import type {
|
|
7
|
+
import { Endpoint, Message, SendOptions, type QuotedMessagePayload } from 'zhin.js';
|
|
8
|
+
import type { IcqqEndpointConfig, IpcFriendInfo, IpcGroupInfo } from "./types.js";
|
|
9
9
|
import type { IcqqAdapter } from "./adapter.js";
|
|
10
10
|
import { IpcClient } from "./ipc-client.js";
|
|
11
11
|
import type { IcqqIpcMessageEvent } from "./icqq-inbound.js";
|
|
12
12
|
import { type NormalizedIcqqInbound } from "./icqq-inbound.js";
|
|
13
13
|
import { buildIcqqIpcMessage as buildIcqqIpcMessageImpl, parseCqMessage as parseCqMessageImpl, toCqString as toCqStringImpl } from "./cq-message.js";
|
|
14
14
|
import { type ICQQTypingIndicatorManager } from "./typing-indicator.js";
|
|
15
|
-
export declare class
|
|
15
|
+
export declare class IcqqEndpoint implements Endpoint<IcqqEndpointConfig, IcqqIpcMessageEvent> {
|
|
16
16
|
adapter: IcqqAdapter;
|
|
17
17
|
$connected: boolean;
|
|
18
|
-
$config:
|
|
18
|
+
$config: IcqqEndpointConfig;
|
|
19
19
|
ipc: IpcClient;
|
|
20
20
|
/** 缓存的好友列表 */
|
|
21
21
|
friends: Map<number, IpcFriendInfo>;
|
|
@@ -34,7 +34,7 @@ export declare class IcqqBot implements Bot<IcqqBotConfig, IcqqIpcMessageEvent>
|
|
|
34
34
|
$typingIndicator?: ICQQTypingIndicatorManager;
|
|
35
35
|
get $id(): `${number}`;
|
|
36
36
|
get logger(): import("zhin.js").Logger;
|
|
37
|
-
constructor(adapter: IcqqAdapter, config:
|
|
37
|
+
constructor(adapter: IcqqAdapter, config: IcqqEndpointConfig);
|
|
38
38
|
$connect(): Promise<void>;
|
|
39
39
|
/**
|
|
40
40
|
* 初始化 Typing Indicator
|
|
@@ -91,9 +91,9 @@ export declare class IcqqBot implements Bot<IcqqBotConfig, IcqqIpcMessageEvent>
|
|
|
91
91
|
$removeReaction(messageId: string, reactionId: string): Promise<void>;
|
|
92
92
|
}
|
|
93
93
|
/** @deprecated 使用 `./cq-message.js` 导出 */
|
|
94
|
-
export declare namespace
|
|
94
|
+
export declare namespace IcqqEndpoint {
|
|
95
95
|
const parseCqMessage: typeof parseCqMessageImpl;
|
|
96
96
|
const buildIcqqIpcMessage: typeof buildIcqqIpcMessageImpl;
|
|
97
97
|
const toCqString: typeof toCqStringImpl;
|
|
98
98
|
}
|
|
99
|
-
//# sourceMappingURL=
|
|
99
|
+
//# sourceMappingURL=endpoint.d.ts.map
|