@zhin.js/adapter-kook 3.0.0 → 3.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 +14 -0
- package/README.md +27 -27
- package/client/Dashboard.tsx +33 -33
- package/dist/index.js +1 -1
- package/lib/adapter.d.ts +10 -9
- package/lib/adapter.d.ts.map +1 -1
- package/lib/adapter.js +33 -32
- 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} +43 -40
- package/lib/endpoint.js.map +1 -0
- package/lib/index.d.ts +1 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +96 -88
- package/lib/index.js.map +1 -1
- package/lib/kook-side-events.d.ts +1 -1
- package/lib/kook-side-events.d.ts.map +1 -1
- package/lib/kook-side-events.js +3 -3
- package/lib/kook-side-events.js.map +1 -1
- package/lib/platform-permit.d.ts +14 -0
- package/lib/platform-permit.d.ts.map +1 -0
- package/lib/platform-permit.js +63 -0
- package/lib/platform-permit.js.map +1 -0
- package/lib/types.d.ts +4 -1
- package/lib/types.d.ts.map +1 -1
- package/package.json +13 -10
- package/skills/kook/PERMITS.md +23 -0
- package/src/adapter.ts +27 -25
- package/src/{bot.ts → endpoint.ts} +45 -42
- package/src/index.ts +87 -78
- package/src/kook-side-events.ts +3 -3
- package/src/platform-permit.ts +77 -0
- package/src/types.ts +4 -1
- package/lib/bot.d.ts.map +0 -1
- package/lib/bot.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @zhin.js/adapter-kook
|
|
2
2
|
|
|
3
|
+
## 3.0.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
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@2.0.1
|
|
14
|
+
- @zhin.js/logger@0.1.71
|
|
15
|
+
- @zhin.js/client@2.0.3
|
|
16
|
+
|
|
3
17
|
## 3.0.0
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -27,7 +27,7 @@ pnpm add @zhin.js/adapter-kook
|
|
|
27
27
|
| **连接方式** | 当前适配器通过 **WebSocket** 连接 KOOK(`kook-client`);无需公网 URL |
|
|
28
28
|
| **host-router** | 不需要 |
|
|
29
29
|
|
|
30
|
-
必填字段见 `
|
|
30
|
+
必填字段见 `KookEndpointConfig`:`context`、`name`、`token`。
|
|
31
31
|
|
|
32
32
|
## 最小配置
|
|
33
33
|
|
|
@@ -35,7 +35,7 @@ pnpm add @zhin.js/adapter-kook
|
|
|
35
35
|
plugins:
|
|
36
36
|
- "@zhin.js/adapter-kook"
|
|
37
37
|
|
|
38
|
-
|
|
38
|
+
endpoints:
|
|
39
39
|
- context: kook
|
|
40
40
|
name: my-kook-bot
|
|
41
41
|
token: "${KOOK_TOKEN}"
|
|
@@ -43,10 +43,10 @@ bots:
|
|
|
43
43
|
|
|
44
44
|
## 配置
|
|
45
45
|
|
|
46
|
-
可选字段(见 `
|
|
46
|
+
可选字段(见 `KookEndpointConfig`):`data_dir`、`timeout`、`max_retry`、`ignore`、`logLevel`、`typingIndicator`。
|
|
47
47
|
|
|
48
48
|
```yaml
|
|
49
|
-
|
|
49
|
+
endpoints:
|
|
50
50
|
- context: kook
|
|
51
51
|
name: my-kook-bot
|
|
52
52
|
token: "${KOOK_TOKEN}"
|
|
@@ -72,7 +72,7 @@ TypeScript 等价写法:
|
|
|
72
72
|
import { defineConfig } from 'zhin.js'
|
|
73
73
|
|
|
74
74
|
export default defineConfig({
|
|
75
|
-
|
|
75
|
+
endpoints: [
|
|
76
76
|
{
|
|
77
77
|
context: 'kook',
|
|
78
78
|
name: 'my-kook-bot',
|
|
@@ -256,16 +256,16 @@ addCommand(new MessageCommand('card')
|
|
|
256
256
|
## API 方法
|
|
257
257
|
|
|
258
258
|
```typescript
|
|
259
|
-
const
|
|
259
|
+
const endpoint = app.adapters.get('kook')?.endpoints.get('my-kook-bot')
|
|
260
260
|
|
|
261
261
|
// 发送频道消息
|
|
262
|
-
await
|
|
262
|
+
await endpoint.sendChannelMsg(channelId, '消息内容')
|
|
263
263
|
|
|
264
264
|
// 发送私聊消息
|
|
265
|
-
await
|
|
265
|
+
await endpoint.sendPrivateMsg(userId, '消息内容')
|
|
266
266
|
|
|
267
267
|
// 统一发送(出站返回带路由的 msg ref,见「消息 ID 与路由」)
|
|
268
|
-
const msgRef = await
|
|
268
|
+
const msgRef = await endpoint.$sendMessage({
|
|
269
269
|
context: 'kook',
|
|
270
270
|
bot: 'my-kook-bot',
|
|
271
271
|
type: 'group', // 或 'private'
|
|
@@ -274,14 +274,14 @@ const msgRef = await bot.$sendMessage({
|
|
|
274
274
|
})
|
|
275
275
|
|
|
276
276
|
// 撤回:支持出站 ref,或入站 plain msg_id + 路由由适配器推断
|
|
277
|
-
await
|
|
278
|
-
await
|
|
277
|
+
await endpoint.$recallMessage(msgRef)
|
|
278
|
+
await endpoint.$recallMessage(message.$id, { route: 'direct' }) // 入站私聊
|
|
279
279
|
|
|
280
280
|
// Typing Indicator:在用户消息上贴/删表情回应
|
|
281
|
-
const reactionId = await
|
|
281
|
+
const reactionId = await endpoint.$addReaction(message.$id, '⏳', {
|
|
282
282
|
sceneType: message.$channel.type === 'private' ? 'private' : 'channel',
|
|
283
283
|
})
|
|
284
|
-
await
|
|
284
|
+
await endpoint.$removeReaction(message.$id, reactionId)
|
|
285
285
|
```
|
|
286
286
|
|
|
287
287
|
## 🔧 频道管理工具(AI 可调用)
|
|
@@ -324,39 +324,39 @@ AI:当前服务器有以下角色:
|
|
|
324
324
|
#### 编程调用
|
|
325
325
|
|
|
326
326
|
```typescript
|
|
327
|
-
// 获取 KOOK
|
|
327
|
+
// 获取 KOOK Endpoint 实例
|
|
328
328
|
const kookAdapter = app.adapters.get('kook')
|
|
329
|
-
const
|
|
329
|
+
const endpoint = kookAdapter?.endpoints.get('my-kook-bot')
|
|
330
330
|
|
|
331
331
|
// 踢出用户
|
|
332
|
-
await
|
|
332
|
+
await endpoint.kickUser(guildId, userId)
|
|
333
333
|
|
|
334
334
|
// 加入黑名单(封禁)
|
|
335
|
-
await
|
|
335
|
+
await endpoint.addToBlacklist(guildId, userId, '违规发言', 7) // 删除7天内消息
|
|
336
336
|
|
|
337
337
|
// 解除封禁
|
|
338
|
-
await
|
|
338
|
+
await endpoint.removeFromBlacklist(guildId, userId)
|
|
339
339
|
|
|
340
340
|
// 授予角色
|
|
341
|
-
await
|
|
341
|
+
await endpoint.grantRole(guildId, userId, roleId)
|
|
342
342
|
|
|
343
343
|
// 撤销角色
|
|
344
|
-
await
|
|
344
|
+
await endpoint.revokeRole(guildId, userId, roleId)
|
|
345
345
|
|
|
346
346
|
// 设置昵称
|
|
347
|
-
await
|
|
347
|
+
await endpoint.setNickname(guildId, userId, '新昵称')
|
|
348
348
|
|
|
349
349
|
// 获取角色列表
|
|
350
|
-
const roles = await
|
|
350
|
+
const roles = await endpoint.getRoleList(guildId)
|
|
351
351
|
|
|
352
352
|
// 创建角色
|
|
353
|
-
const newRole = await
|
|
353
|
+
const newRole = await endpoint.createRole(guildId, '新角色')
|
|
354
354
|
|
|
355
355
|
// 删除角色
|
|
356
|
-
await
|
|
356
|
+
await endpoint.deleteRole(guildId, roleId)
|
|
357
357
|
|
|
358
358
|
// 获取成员列表
|
|
359
|
-
const members = await
|
|
359
|
+
const members = await endpoint.getGuildMembers(guildId)
|
|
360
360
|
```
|
|
361
361
|
|
|
362
362
|
### 发送者权限信息
|
|
@@ -444,7 +444,7 @@ KOOK 有发送频率限制(约每秒 5 条);建议队列化发送并检查
|
|
|
444
444
|
使用 KOOK 卡片消息格式:
|
|
445
445
|
|
|
446
446
|
```typescript
|
|
447
|
-
await
|
|
447
|
+
await endpoint.sendChannelMsg(channelId, [
|
|
448
448
|
{
|
|
449
449
|
type: 'card',
|
|
450
450
|
data: {
|
|
@@ -464,7 +464,7 @@ await bot.sendChannelMsg(channelId, [
|
|
|
464
464
|
|
|
465
465
|
## full-bot L4 参考
|
|
466
466
|
|
|
467
|
-
[`examples/full-bot`](../../../examples/full-bot/) 默认加载本适配器(`
|
|
467
|
+
[`examples/full-bot`](../../../examples/full-bot/) 默认加载本适配器(`endpoints` 段需填写 `KOOK_TOKEN` 后取消注释)。
|
|
468
468
|
|
|
469
469
|
- 入站 → `ZhinAgent` → 出站走 `Adapter.sendMessage` 统一链路
|
|
470
470
|
- 契约测试:`plugins/adapters/kook/tests/l4-contract.test.ts` + `integration.test.ts`
|
package/client/Dashboard.tsx
CHANGED
|
@@ -2,7 +2,7 @@ import { useEffect, useState, useCallback } from 'react'
|
|
|
2
2
|
import { apiFetch } from './utils/api'
|
|
3
3
|
import { RefreshCw, Server, Wifi, WifiOff, Power, PowerOff, Loader2, Shield, Plus, Trash2, X } from 'lucide-react'
|
|
4
4
|
|
|
5
|
-
interface
|
|
5
|
+
interface EndpointRow {
|
|
6
6
|
name: string
|
|
7
7
|
connected: boolean
|
|
8
8
|
guildCount: number
|
|
@@ -19,14 +19,14 @@ interface Role {
|
|
|
19
19
|
type Tab = 'overview' | 'roles'
|
|
20
20
|
|
|
21
21
|
export default function KookDashboard() {
|
|
22
|
-
const [
|
|
22
|
+
const [endpoints, setEndpoints] = useState<EndpointRow[]>([])
|
|
23
23
|
const [loading, setLoading] = useState(true)
|
|
24
24
|
const [error, setError] = useState('')
|
|
25
25
|
const [tab, setTab] = useState<Tab>('overview')
|
|
26
26
|
const [actionLoading, setActionLoading] = useState<Record<string, boolean>>({})
|
|
27
27
|
|
|
28
28
|
// Role management state
|
|
29
|
-
const [
|
|
29
|
+
const [selectedEndpoint, setSelectedEndpoint] = useState('')
|
|
30
30
|
const [guildId, setGuildId] = useState('')
|
|
31
31
|
const [roles, setRoles] = useState<Role[]>([])
|
|
32
32
|
const [rolesLoading, setRolesLoading] = useState(false)
|
|
@@ -38,9 +38,9 @@ export default function KookDashboard() {
|
|
|
38
38
|
setLoading(true)
|
|
39
39
|
setError('')
|
|
40
40
|
try {
|
|
41
|
-
const res = await apiFetch('/api/kook/
|
|
41
|
+
const res = await apiFetch('/api/kook/endpoints')
|
|
42
42
|
const json = await res.json()
|
|
43
|
-
if (json.success)
|
|
43
|
+
if (json.success) setEndpoints(json.data)
|
|
44
44
|
else setError(json.error || '获取数据失败')
|
|
45
45
|
} catch {
|
|
46
46
|
setError('无法连接服务器')
|
|
@@ -55,7 +55,7 @@ export default function KookDashboard() {
|
|
|
55
55
|
setActionLoading(prev => ({ ...prev, [name]: true }))
|
|
56
56
|
try {
|
|
57
57
|
const endpoint = connected ? 'disconnect' : 'connect'
|
|
58
|
-
const res = await apiFetch(`/api/kook/
|
|
58
|
+
const res = await apiFetch(`/api/kook/endpoints/${encodeURIComponent(name)}/${endpoint}`, { method: 'POST' })
|
|
59
59
|
const json = await res.json()
|
|
60
60
|
if (!json.success) setError(json.error || '操作失败')
|
|
61
61
|
await fetchData()
|
|
@@ -67,11 +67,11 @@ export default function KookDashboard() {
|
|
|
67
67
|
}
|
|
68
68
|
|
|
69
69
|
const loadRoles = async () => {
|
|
70
|
-
if (!
|
|
70
|
+
if (!selectedEndpoint || !guildId) return
|
|
71
71
|
setRolesLoading(true)
|
|
72
72
|
setRoles([])
|
|
73
73
|
try {
|
|
74
|
-
const res = await apiFetch(`/api/kook/
|
|
74
|
+
const res = await apiFetch(`/api/kook/endpoints/${encodeURIComponent(selectedEndpoint)}/guilds/${encodeURIComponent(guildId)}/roles`)
|
|
75
75
|
const json = await res.json()
|
|
76
76
|
if (json.success) setRoles(json.data)
|
|
77
77
|
else setError(json.error || '获取角色失败')
|
|
@@ -83,10 +83,10 @@ export default function KookDashboard() {
|
|
|
83
83
|
}
|
|
84
84
|
|
|
85
85
|
const createRole = async () => {
|
|
86
|
-
if (!
|
|
86
|
+
if (!selectedEndpoint || !guildId || !newRoleName.trim()) return
|
|
87
87
|
setCreateLoading(true)
|
|
88
88
|
try {
|
|
89
|
-
const res = await apiFetch(`/api/kook/
|
|
89
|
+
const res = await apiFetch(`/api/kook/endpoints/${encodeURIComponent(selectedEndpoint)}/guilds/${encodeURIComponent(guildId)}/roles`, {
|
|
90
90
|
method: 'POST',
|
|
91
91
|
headers: { 'Content-Type': 'application/json' },
|
|
92
92
|
body: JSON.stringify({ name: newRoleName.trim() }),
|
|
@@ -106,10 +106,10 @@ export default function KookDashboard() {
|
|
|
106
106
|
}
|
|
107
107
|
|
|
108
108
|
const deleteRole = async (roleId: string) => {
|
|
109
|
-
if (!
|
|
109
|
+
if (!selectedEndpoint || !guildId) return
|
|
110
110
|
setDeleteLoading(roleId)
|
|
111
111
|
try {
|
|
112
|
-
const res = await apiFetch(`/api/kook/
|
|
112
|
+
const res = await apiFetch(`/api/kook/endpoints/${encodeURIComponent(selectedEndpoint)}/guilds/${encodeURIComponent(guildId)}/roles/${encodeURIComponent(roleId)}`, {
|
|
113
113
|
method: 'DELETE',
|
|
114
114
|
})
|
|
115
115
|
const json = await res.json()
|
|
@@ -125,7 +125,7 @@ export default function KookDashboard() {
|
|
|
125
125
|
}
|
|
126
126
|
}
|
|
127
127
|
|
|
128
|
-
const
|
|
128
|
+
const onlineEndpoints = endpoints.filter((e) => e.connected)
|
|
129
129
|
|
|
130
130
|
return (
|
|
131
131
|
<div className="p-6 max-w-5xl mx-auto">
|
|
@@ -159,29 +159,29 @@ export default function KookDashboard() {
|
|
|
159
159
|
{/* Overview Tab */}
|
|
160
160
|
{tab === 'overview' && (
|
|
161
161
|
<>
|
|
162
|
-
{!loading && !
|
|
163
|
-
<div className="text-center text-gray-500 py-12">暂无 KOOK
|
|
162
|
+
{!loading && !endpoints.length && !error && (
|
|
163
|
+
<div className="text-center text-gray-500 py-12">暂无 KOOK Endpoint 实例</div>
|
|
164
164
|
)}
|
|
165
165
|
<div className="grid gap-4 md:grid-cols-2">
|
|
166
|
-
{
|
|
167
|
-
<div key={
|
|
166
|
+
{endpoints.map((endpoint) => (
|
|
167
|
+
<div key={endpoint.name} className="border rounded-lg p-4 bg-card shadow-sm">
|
|
168
168
|
<div className="flex items-center justify-between mb-3">
|
|
169
|
-
<span className="font-medium text-lg">{
|
|
170
|
-
{
|
|
169
|
+
<span className="font-medium text-lg">{endpoint.name}</span>
|
|
170
|
+
{endpoint.connected
|
|
171
171
|
? <span className="flex items-center gap-1 text-green-600 text-sm"><Wifi className="w-4 h-4" /> 在线</span>
|
|
172
172
|
: <span className="flex items-center gap-1 text-gray-400 text-sm"><WifiOff className="w-4 h-4" /> 离线</span>}
|
|
173
173
|
</div>
|
|
174
174
|
<div className="text-sm text-gray-600 mb-3">
|
|
175
|
-
<div className="flex justify-between"><span>服务器</span><span className="font-mono">{
|
|
175
|
+
<div className="flex justify-between"><span>服务器</span><span className="font-mono">{endpoint.guildCount}</span></div>
|
|
176
176
|
</div>
|
|
177
177
|
<button
|
|
178
|
-
onClick={() => toggleConnect(
|
|
179
|
-
disabled={actionLoading[
|
|
180
|
-
className={`flex items-center gap-1 px-3 py-1.5 rounded text-sm text-white ${
|
|
181
|
-
{actionLoading[
|
|
178
|
+
onClick={() => toggleConnect(endpoint.name, endpoint.connected)}
|
|
179
|
+
disabled={actionLoading[endpoint.name]}
|
|
180
|
+
className={`flex items-center gap-1 px-3 py-1.5 rounded text-sm text-white ${endpoint.connected ? 'bg-red-500 hover:bg-red-600' : 'bg-green-500 hover:bg-green-600'} disabled:opacity-50`}>
|
|
181
|
+
{actionLoading[endpoint.name]
|
|
182
182
|
? <Loader2 className="w-3.5 h-3.5 animate-spin" />
|
|
183
|
-
:
|
|
184
|
-
{
|
|
183
|
+
: endpoint.connected ? <PowerOff className="w-3.5 h-3.5" /> : <Power className="w-3.5 h-3.5" />}
|
|
184
|
+
{endpoint.connected ? '断开' : '连接'}
|
|
185
185
|
</button>
|
|
186
186
|
</div>
|
|
187
187
|
))}
|
|
@@ -192,14 +192,14 @@ export default function KookDashboard() {
|
|
|
192
192
|
{/* Roles Tab */}
|
|
193
193
|
{tab === 'roles' && (
|
|
194
194
|
<div className="space-y-4">
|
|
195
|
-
{/*
|
|
195
|
+
{/* Endpoint + Guild selector */}
|
|
196
196
|
<div className="flex flex-wrap items-end gap-3">
|
|
197
197
|
<div>
|
|
198
198
|
<label className="block text-xs text-gray-500 mb-1">机器人</label>
|
|
199
|
-
<select value={
|
|
199
|
+
<select value={selectedEndpoint} onChange={(e) => setSelectedEndpoint(e.target.value)}
|
|
200
200
|
className="border rounded px-2 py-1.5 text-sm min-w-[140px]">
|
|
201
201
|
<option value="">--</option>
|
|
202
|
-
{
|
|
202
|
+
{onlineEndpoints.map((e) => <option key={e.name} value={e.name}>{e.name}</option>)}
|
|
203
203
|
</select>
|
|
204
204
|
</div>
|
|
205
205
|
<div>
|
|
@@ -207,16 +207,16 @@ export default function KookDashboard() {
|
|
|
207
207
|
<input value={guildId} onChange={(e) => setGuildId(e.target.value)} placeholder="输入服务器 ID"
|
|
208
208
|
className="border rounded px-2 py-1.5 text-sm w-[180px]" />
|
|
209
209
|
</div>
|
|
210
|
-
<button onClick={loadRoles} disabled={!
|
|
210
|
+
<button onClick={loadRoles} disabled={!selectedEndpoint || !guildId || rolesLoading}
|
|
211
211
|
className="px-3 py-1.5 rounded bg-sky-500 text-white text-sm hover:bg-sky-600 disabled:opacity-50 flex items-center gap-1">
|
|
212
212
|
{rolesLoading ? <Loader2 className="w-3.5 h-3.5 animate-spin" /> : <Shield className="w-3.5 h-3.5" />} 查询角色
|
|
213
213
|
</button>
|
|
214
214
|
</div>
|
|
215
215
|
|
|
216
|
-
{!
|
|
216
|
+
{!onlineEndpoints.length && <div className="text-center text-gray-500 py-4">暂无在线 Endpoint</div>}
|
|
217
217
|
|
|
218
218
|
{/* Create Role */}
|
|
219
|
-
{
|
|
219
|
+
{selectedEndpoint && guildId && roles.length > 0 && (
|
|
220
220
|
<div className="flex items-center gap-2">
|
|
221
221
|
<input value={newRoleName} onChange={(e) => setNewRoleName(e.target.value)} placeholder="新角色名称"
|
|
222
222
|
className="border rounded px-2 py-1.5 text-sm flex-1 max-w-[240px]"
|
|
@@ -247,7 +247,7 @@ export default function KookDashboard() {
|
|
|
247
247
|
</div>
|
|
248
248
|
)}
|
|
249
249
|
|
|
250
|
-
{!rolesLoading &&
|
|
250
|
+
{!rolesLoading && selectedEndpoint && guildId && !roles.length && <div className="text-center text-gray-400 py-6">暂无角色数据,请先查询</div>}
|
|
251
251
|
</div>
|
|
252
252
|
)}
|
|
253
253
|
</div>
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{useEffect as Fe,useState as p,useCallback as De}from"react";var Y="zhin_api_token",se="zhin_api_base";function re(){let t=localStorage.getItem(se)?.trim();return t?t.replace(/\/$/,""):typeof window<"u"?window.location.origin:""}function ie(){return localStorage.getItem(Y)}async function S(t,u){let f=ie(),s=new Headers(u?.headers);f&&s.set("Authorization",`Bearer ${f}`);let m=re(),l=typeof t=="string"&&t.startsWith("/")?`${m}${t}`:t,L=await fetch(l,{...u,headers:s});return L.status===401&&(localStorage.removeItem(Y),window.dispatchEvent(new CustomEvent("zhin:auth-required"))),L}import{forwardRef as Le,createElement as Ie}from"react";var O=(...t)=>t.filter((u,f,s)=>!!u&&u.trim()!==""&&s.indexOf(u)===f).join(" ").trim();var ee=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();var ae=t=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(u,f,s)=>s?s.toUpperCase():f.toLowerCase());var V=t=>{let u=ae(t);return u.charAt(0).toUpperCase()+u.slice(1)};import{forwardRef as me,createElement as ue}from"react";var H={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 te=t=>{for(let u in t)if(u.startsWith("aria-")||u==="role"||u==="title")return!0;return!1};import{createContext as ce,useContext as ne,useMemo as We,createElement as Ve}from"react";var pe=ce({});var oe=()=>ne(pe);var de=me(({color:t,size:u,strokeWidth:f,absoluteStrokeWidth:s,className:m="",children:l,iconNode:L,...g},q)=>{let{size:C=24,strokeWidth:r=2,absoluteStrokeWidth:G=!1,color:c="currentColor",className:W=""}=oe()??{},h=s??G?Number(f??r)*24/Number(u??C):f??r;return ue("svg",{ref:q,...H,width:u??C??H.width,height:u??C??H.height,stroke:t??c,strokeWidth:h,className:O("lucide",W,m),...!l&&!te(g)&&{"aria-hidden":"true"},...g},[...L.map(([k,x])=>ue(k,x)),...Array.isArray(l)?l:[l]])});var d=(t,u)=>{let f=Le(({className:s,...m},l)=>Ie(de,{ref:l,iconNode:u,className:O(`lucide-${ee(V(t))}`,`lucide-${t}`,s),...m}));return f.displayName=V(t),f};var xe=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],n=d("loader-circle",xe);var Ce=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],w=d("plus",Ce);var he=[["path",{d:"M18.36 6.64A9 9 0 0 1 20.77 15",key:"dxknvb"}],["path",{d:"M6.16 6.16a9 9 0 1 0 12.68 12.68",key:"1x7qb5"}],["path",{d:"M12 2v4",key:"3427ic"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],P=d("power-off",he);var Se=[["path",{d:"M12 2v10",key:"mnfbl"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04",key:"obofu9"}]],A=d("power",Se);var ge=[["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"}]],B=d("refresh-cw",ge);var ke=[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]],M=d("server",ke);var we=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]],F=d("shield",we);var Pe=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],D=d("trash-2",Pe);var Ae=[["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"}]],y=d("wifi-off",Ae);var Be=[["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"}]],R=d("wifi",Be);var Me=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],T=d("x",Me);import{Fragment as ye,jsx as a,jsxs as o}from"react/jsx-runtime";function E(){let[t,u]=p([]),[f,s]=p(!0),[m,l]=p(""),[L,g]=p("overview"),[q,C]=p({}),[r,G]=p(""),[c,W]=p(""),[h,k]=p([]),[x,N]=p(!1),[b,z]=p(""),[X,K]=p(!1),[Z,Q]=p(null),v=De(async()=>{s(!0),l("");try{let i=await(await S("/api/kook/bots")).json();i.success?u(i.data):l(i.error||"\u83B7\u53D6\u6570\u636E\u5931\u8D25")}catch{l("\u65E0\u6CD5\u8FDE\u63A5\u670D\u52A1\u5668")}finally{s(!1)}},[]);Fe(()=>{v()},[v]);let le=async(e,i)=>{C(I=>({...I,[e]:!0}));try{let I=i?"disconnect":"connect",U=await(await S(`/api/kook/bots/${encodeURIComponent(e)}/${I}`,{method:"POST"})).json();U.success||l(U.error||"\u64CD\u4F5C\u5931\u8D25"),await v()}catch{l("\u64CD\u4F5C\u5931\u8D25")}finally{C(I=>({...I,[e]:!1}))}},J=async()=>{if(!(!r||!c)){N(!0),k([]);try{let i=await(await S(`/api/kook/bots/${encodeURIComponent(r)}/guilds/${encodeURIComponent(c)}/roles`)).json();i.success?k(i.data):l(i.error||"\u83B7\u53D6\u89D2\u8272\u5931\u8D25")}catch{l("\u83B7\u53D6\u89D2\u8272\u5931\u8D25")}finally{N(!1)}}},_=async()=>{if(!(!r||!c||!b.trim())){K(!0);try{let i=await(await S(`/api/kook/bots/${encodeURIComponent(r)}/guilds/${encodeURIComponent(c)}/roles`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:b.trim()})})).json();i.success?(z(""),await J()):l(i.error||"\u521B\u5EFA\u89D2\u8272\u5931\u8D25")}catch{l("\u521B\u5EFA\u89D2\u8272\u5931\u8D25")}finally{K(!1)}}},fe=async e=>{if(!(!r||!c)){Q(e);try{let I=await(await S(`/api/kook/bots/${encodeURIComponent(r)}/guilds/${encodeURIComponent(c)}/roles/${encodeURIComponent(e)}`,{method:"DELETE"})).json();I.success?k($=>$.filter(U=>U.id!==e)):l(I.error||"\u5220\u9664\u89D2\u8272\u5931\u8D25")}catch{l("\u5220\u9664\u89D2\u8272\u5931\u8D25")}finally{Q(null)}}},j=t.filter(e=>e.connected);return o("div",{className:"p-6 max-w-5xl mx-auto",children:[o("div",{className:"flex items-center justify-between mb-6",children:[o("h1",{className:"text-2xl font-bold flex items-center gap-2",children:[a(M,{className:"w-6 h-6"})," KOOK \u673A\u5668\u4EBA"]}),o("button",{onClick:v,disabled:f,className:"flex items-center gap-1 px-3 py-1.5 rounded bg-sky-500 text-white hover:bg-sky-600 disabled:opacity-50 text-sm",children:[a(B,{className:`w-4 h-4 ${f?"animate-spin":""}`})," \u5237\u65B0"]})]}),m&&o("div",{className:"mb-4 p-3 bg-red-50 text-red-600 rounded border border-red-200 flex items-center justify-between",children:[a("span",{children:m}),a("button",{onClick:()=>l(""),className:"text-red-400 hover:text-red-600",children:a(T,{className:"w-4 h-4"})})]}),o("div",{className:"flex gap-1 mb-6 border-b",children:[a("button",{onClick:()=>g("overview"),className:`px-4 py-2 text-sm font-medium border-b-2 transition-colors ${L==="overview"?"border-sky-500 text-sky-600":"border-transparent text-gray-500 hover:text-gray-700"}`,children:"\u6982\u89C8"}),a("button",{onClick:()=>g("roles"),className:`px-4 py-2 text-sm font-medium border-b-2 transition-colors ${L==="roles"?"border-sky-500 text-sky-600":"border-transparent text-gray-500 hover:text-gray-700"}`,children:"\u89D2\u8272\u7BA1\u7406"})]}),L==="overview"&&o(ye,{children:[!f&&!t.length&&!m&&a("div",{className:"text-center text-gray-500 py-12",children:"\u6682\u65E0 KOOK \u673A\u5668\u4EBA\u5B9E\u4F8B"}),a("div",{className:"grid gap-4 md:grid-cols-2",children:t.map(e=>o("div",{className:"border rounded-lg p-4 bg-card shadow-sm",children:[o("div",{className:"flex items-center justify-between mb-3",children:[a("span",{className:"font-medium text-lg",children:e.name}),e.connected?o("span",{className:"flex items-center gap-1 text-green-600 text-sm",children:[a(R,{className:"w-4 h-4"})," \u5728\u7EBF"]}):o("span",{className:"flex items-center gap-1 text-gray-400 text-sm",children:[a(y,{className:"w-4 h-4"})," \u79BB\u7EBF"]})]}),a("div",{className:"text-sm text-gray-600 mb-3",children:o("div",{className:"flex justify-between",children:[a("span",{children:"\u670D\u52A1\u5668"}),a("span",{className:"font-mono",children:e.guildCount})]})}),o("button",{onClick:()=>le(e.name,e.connected),disabled:q[e.name],className:`flex items-center gap-1 px-3 py-1.5 rounded text-sm text-white ${e.connected?"bg-red-500 hover:bg-red-600":"bg-green-500 hover:bg-green-600"} disabled:opacity-50`,children:[q[e.name]?a(n,{className:"w-3.5 h-3.5 animate-spin"}):e.connected?a(P,{className:"w-3.5 h-3.5"}):a(A,{className:"w-3.5 h-3.5"}),e.connected?"\u65AD\u5F00":"\u8FDE\u63A5"]})]},e.name))})]}),L==="roles"&&o("div",{className:"space-y-4",children:[o("div",{className:"flex flex-wrap items-end gap-3",children:[o("div",{children:[a("label",{className:"block text-xs text-gray-500 mb-1",children:"\u673A\u5668\u4EBA"}),o("select",{value:r,onChange:e=>G(e.target.value),className:"border rounded px-2 py-1.5 text-sm min-w-[140px]",children:[a("option",{value:"",children:"--"}),j.map(e=>a("option",{value:e.name,children:e.name},e.name))]})]}),o("div",{children:[a("label",{className:"block text-xs text-gray-500 mb-1",children:"\u670D\u52A1\u5668 ID"}),a("input",{value:c,onChange:e=>W(e.target.value),placeholder:"\u8F93\u5165\u670D\u52A1\u5668 ID",className:"border rounded px-2 py-1.5 text-sm w-[180px]"})]}),o("button",{onClick:J,disabled:!r||!c||x,className:"px-3 py-1.5 rounded bg-sky-500 text-white text-sm hover:bg-sky-600 disabled:opacity-50 flex items-center gap-1",children:[x?a(n,{className:"w-3.5 h-3.5 animate-spin"}):a(F,{className:"w-3.5 h-3.5"})," \u67E5\u8BE2\u89D2\u8272"]})]}),!j.length&&a("div",{className:"text-center text-gray-500 py-4",children:"\u6682\u65E0\u5728\u7EBF\u673A\u5668\u4EBA"}),r&&c&&h.length>0&&o("div",{className:"flex items-center gap-2",children:[a("input",{value:b,onChange:e=>z(e.target.value),placeholder:"\u65B0\u89D2\u8272\u540D\u79F0",className:"border rounded px-2 py-1.5 text-sm flex-1 max-w-[240px]",onKeyDown:e=>e.key==="Enter"&&_()}),o("button",{onClick:_,disabled:X||!b.trim(),className:"px-3 py-1.5 rounded bg-green-500 text-white text-sm hover:bg-green-600 disabled:opacity-50 flex items-center gap-1",children:[X?a(n,{className:"w-3.5 h-3.5 animate-spin"}):a(w,{className:"w-3.5 h-3.5"})," \u521B\u5EFA"]})]}),x&&a("div",{className:"flex justify-center py-8",children:a(n,{className:"w-6 h-6 animate-spin text-sky-500"})}),!x&&h.length>0&&a("div",{className:"border rounded-lg bg-card shadow-sm divide-y",children:h.map(e=>o("div",{className:"flex items-center px-4 py-2.5 hover:bg-gray-50",children:[a("div",{className:"w-3 h-3 rounded-full mr-3",style:{backgroundColor:e.color?`#${e.color.toString(16).padStart(6,"0")}`:"#999"}}),a("span",{className:"font-medium text-sm flex-1",children:e.name}),o("span",{className:"text-xs text-gray-400 mr-4",children:["ID: ",e.id]}),a("button",{onClick:()=>fe(e.id),disabled:Z===e.id,className:"text-gray-400 hover:text-red-500 disabled:opacity-50",children:Z===e.id?a(n,{className:"w-4 h-4 animate-spin"}):a(D,{className:"w-4 h-4"})})]},e.id))}),!x&&r&&c&&!h.length&&a("div",{className:"text-center text-gray-400 py-6",children:"\u6682\u65E0\u89D2\u8272\u6570\u636E\uFF0C\u8BF7\u5148\u67E5\u8BE2"})]})]})}function Va(t){t.addRoute({path:"/kook",name:"KOOK",element:t.React.createElement(E,{hostReact:t.React})}),t.addTool({id:"kook",name:"KOOK",path:"/kook"})}export{Va as register};
|
|
1
|
+
import{useEffect as Fe,useState as p,useCallback as De}from"react";var Y="zhin_api_token",se="zhin_api_base";function re(){let t=localStorage.getItem(se)?.trim();return t?t.replace(/\/$/,""):typeof window<"u"?window.location.origin:""}function ie(){return localStorage.getItem(Y)}async function S(t,u){let f=ie(),s=new Headers(u?.headers);f&&s.set("Authorization",`Bearer ${f}`);let m=re(),l=typeof t=="string"&&t.startsWith("/")?`${m}${t}`:t,L=await fetch(l,{...u,headers:s});return L.status===401&&(localStorage.removeItem(Y),window.dispatchEvent(new CustomEvent("zhin:auth-required"))),L}import{forwardRef as Le,createElement as Ie}from"react";var O=(...t)=>t.filter((u,f,s)=>!!u&&u.trim()!==""&&s.indexOf(u)===f).join(" ").trim();var ee=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();var ae=t=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(u,f,s)=>s?s.toUpperCase():f.toLowerCase());var E=t=>{let u=ae(t);return u.charAt(0).toUpperCase()+u.slice(1)};import{forwardRef as me,createElement as ue}from"react";var H={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 te=t=>{for(let u in t)if(u.startsWith("aria-")||u==="role"||u==="title")return!0;return!1};import{createContext as ce,useContext as ne,useMemo as We,createElement as Ee}from"react";var pe=ce({});var oe=()=>ne(pe);var de=me(({color:t,size:u,strokeWidth:f,absoluteStrokeWidth:s,className:m="",children:l,iconNode:L,...g},q)=>{let{size:C=24,strokeWidth:r=2,absoluteStrokeWidth:G=!1,color:c="currentColor",className:W=""}=oe()??{},h=s??G?Number(f??r)*24/Number(u??C):f??r;return ue("svg",{ref:q,...H,width:u??C??H.width,height:u??C??H.height,stroke:t??c,strokeWidth:h,className:O("lucide",W,m),...!l&&!te(g)&&{"aria-hidden":"true"},...g},[...L.map(([k,x])=>ue(k,x)),...Array.isArray(l)?l:[l]])});var d=(t,u)=>{let f=Le(({className:s,...m},l)=>Ie(de,{ref:l,iconNode:u,className:O(`lucide-${ee(E(t))}`,`lucide-${t}`,s),...m}));return f.displayName=E(t),f};var xe=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],n=d("loader-circle",xe);var Ce=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],w=d("plus",Ce);var he=[["path",{d:"M18.36 6.64A9 9 0 0 1 20.77 15",key:"dxknvb"}],["path",{d:"M6.16 6.16a9 9 0 1 0 12.68 12.68",key:"1x7qb5"}],["path",{d:"M12 2v4",key:"3427ic"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],P=d("power-off",he);var Se=[["path",{d:"M12 2v10",key:"mnfbl"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04",key:"obofu9"}]],A=d("power",Se);var ge=[["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"}]],B=d("refresh-cw",ge);var ke=[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]],M=d("server",ke);var we=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]],F=d("shield",we);var Pe=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],D=d("trash-2",Pe);var Ae=[["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"}]],y=d("wifi-off",Ae);var Be=[["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"}]],R=d("wifi",Be);var Me=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],T=d("x",Me);import{Fragment as ye,jsx as a,jsxs as o}from"react/jsx-runtime";function V(){let[t,u]=p([]),[f,s]=p(!0),[m,l]=p(""),[L,g]=p("overview"),[q,C]=p({}),[r,G]=p(""),[c,W]=p(""),[h,k]=p([]),[x,N]=p(!1),[b,z]=p(""),[X,K]=p(!1),[Z,Q]=p(null),v=De(async()=>{s(!0),l("");try{let i=await(await S("/api/kook/endpoints")).json();i.success?u(i.data):l(i.error||"\u83B7\u53D6\u6570\u636E\u5931\u8D25")}catch{l("\u65E0\u6CD5\u8FDE\u63A5\u670D\u52A1\u5668")}finally{s(!1)}},[]);Fe(()=>{v()},[v]);let le=async(e,i)=>{C(I=>({...I,[e]:!0}));try{let I=i?"disconnect":"connect",U=await(await S(`/api/kook/endpoints/${encodeURIComponent(e)}/${I}`,{method:"POST"})).json();U.success||l(U.error||"\u64CD\u4F5C\u5931\u8D25"),await v()}catch{l("\u64CD\u4F5C\u5931\u8D25")}finally{C(I=>({...I,[e]:!1}))}},J=async()=>{if(!(!r||!c)){N(!0),k([]);try{let i=await(await S(`/api/kook/endpoints/${encodeURIComponent(r)}/guilds/${encodeURIComponent(c)}/roles`)).json();i.success?k(i.data):l(i.error||"\u83B7\u53D6\u89D2\u8272\u5931\u8D25")}catch{l("\u83B7\u53D6\u89D2\u8272\u5931\u8D25")}finally{N(!1)}}},_=async()=>{if(!(!r||!c||!b.trim())){K(!0);try{let i=await(await S(`/api/kook/endpoints/${encodeURIComponent(r)}/guilds/${encodeURIComponent(c)}/roles`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:b.trim()})})).json();i.success?(z(""),await J()):l(i.error||"\u521B\u5EFA\u89D2\u8272\u5931\u8D25")}catch{l("\u521B\u5EFA\u89D2\u8272\u5931\u8D25")}finally{K(!1)}}},fe=async e=>{if(!(!r||!c)){Q(e);try{let I=await(await S(`/api/kook/endpoints/${encodeURIComponent(r)}/guilds/${encodeURIComponent(c)}/roles/${encodeURIComponent(e)}`,{method:"DELETE"})).json();I.success?k($=>$.filter(U=>U.id!==e)):l(I.error||"\u5220\u9664\u89D2\u8272\u5931\u8D25")}catch{l("\u5220\u9664\u89D2\u8272\u5931\u8D25")}finally{Q(null)}}},j=t.filter(e=>e.connected);return o("div",{className:"p-6 max-w-5xl mx-auto",children:[o("div",{className:"flex items-center justify-between mb-6",children:[o("h1",{className:"text-2xl font-bold flex items-center gap-2",children:[a(M,{className:"w-6 h-6"})," KOOK \u673A\u5668\u4EBA"]}),o("button",{onClick:v,disabled:f,className:"flex items-center gap-1 px-3 py-1.5 rounded bg-sky-500 text-white hover:bg-sky-600 disabled:opacity-50 text-sm",children:[a(B,{className:`w-4 h-4 ${f?"animate-spin":""}`})," \u5237\u65B0"]})]}),m&&o("div",{className:"mb-4 p-3 bg-red-50 text-red-600 rounded border border-red-200 flex items-center justify-between",children:[a("span",{children:m}),a("button",{onClick:()=>l(""),className:"text-red-400 hover:text-red-600",children:a(T,{className:"w-4 h-4"})})]}),o("div",{className:"flex gap-1 mb-6 border-b",children:[a("button",{onClick:()=>g("overview"),className:`px-4 py-2 text-sm font-medium border-b-2 transition-colors ${L==="overview"?"border-sky-500 text-sky-600":"border-transparent text-gray-500 hover:text-gray-700"}`,children:"\u6982\u89C8"}),a("button",{onClick:()=>g("roles"),className:`px-4 py-2 text-sm font-medium border-b-2 transition-colors ${L==="roles"?"border-sky-500 text-sky-600":"border-transparent text-gray-500 hover:text-gray-700"}`,children:"\u89D2\u8272\u7BA1\u7406"})]}),L==="overview"&&o(ye,{children:[!f&&!t.length&&!m&&a("div",{className:"text-center text-gray-500 py-12",children:"\u6682\u65E0 KOOK Endpoint \u5B9E\u4F8B"}),a("div",{className:"grid gap-4 md:grid-cols-2",children:t.map(e=>o("div",{className:"border rounded-lg p-4 bg-card shadow-sm",children:[o("div",{className:"flex items-center justify-between mb-3",children:[a("span",{className:"font-medium text-lg",children:e.name}),e.connected?o("span",{className:"flex items-center gap-1 text-green-600 text-sm",children:[a(R,{className:"w-4 h-4"})," \u5728\u7EBF"]}):o("span",{className:"flex items-center gap-1 text-gray-400 text-sm",children:[a(y,{className:"w-4 h-4"})," \u79BB\u7EBF"]})]}),a("div",{className:"text-sm text-gray-600 mb-3",children:o("div",{className:"flex justify-between",children:[a("span",{children:"\u670D\u52A1\u5668"}),a("span",{className:"font-mono",children:e.guildCount})]})}),o("button",{onClick:()=>le(e.name,e.connected),disabled:q[e.name],className:`flex items-center gap-1 px-3 py-1.5 rounded text-sm text-white ${e.connected?"bg-red-500 hover:bg-red-600":"bg-green-500 hover:bg-green-600"} disabled:opacity-50`,children:[q[e.name]?a(n,{className:"w-3.5 h-3.5 animate-spin"}):e.connected?a(P,{className:"w-3.5 h-3.5"}):a(A,{className:"w-3.5 h-3.5"}),e.connected?"\u65AD\u5F00":"\u8FDE\u63A5"]})]},e.name))})]}),L==="roles"&&o("div",{className:"space-y-4",children:[o("div",{className:"flex flex-wrap items-end gap-3",children:[o("div",{children:[a("label",{className:"block text-xs text-gray-500 mb-1",children:"\u673A\u5668\u4EBA"}),o("select",{value:r,onChange:e=>G(e.target.value),className:"border rounded px-2 py-1.5 text-sm min-w-[140px]",children:[a("option",{value:"",children:"--"}),j.map(e=>a("option",{value:e.name,children:e.name},e.name))]})]}),o("div",{children:[a("label",{className:"block text-xs text-gray-500 mb-1",children:"\u670D\u52A1\u5668 ID"}),a("input",{value:c,onChange:e=>W(e.target.value),placeholder:"\u8F93\u5165\u670D\u52A1\u5668 ID",className:"border rounded px-2 py-1.5 text-sm w-[180px]"})]}),o("button",{onClick:J,disabled:!r||!c||x,className:"px-3 py-1.5 rounded bg-sky-500 text-white text-sm hover:bg-sky-600 disabled:opacity-50 flex items-center gap-1",children:[x?a(n,{className:"w-3.5 h-3.5 animate-spin"}):a(F,{className:"w-3.5 h-3.5"})," \u67E5\u8BE2\u89D2\u8272"]})]}),!j.length&&a("div",{className:"text-center text-gray-500 py-4",children:"\u6682\u65E0\u5728\u7EBF Endpoint"}),r&&c&&h.length>0&&o("div",{className:"flex items-center gap-2",children:[a("input",{value:b,onChange:e=>z(e.target.value),placeholder:"\u65B0\u89D2\u8272\u540D\u79F0",className:"border rounded px-2 py-1.5 text-sm flex-1 max-w-[240px]",onKeyDown:e=>e.key==="Enter"&&_()}),o("button",{onClick:_,disabled:X||!b.trim(),className:"px-3 py-1.5 rounded bg-green-500 text-white text-sm hover:bg-green-600 disabled:opacity-50 flex items-center gap-1",children:[X?a(n,{className:"w-3.5 h-3.5 animate-spin"}):a(w,{className:"w-3.5 h-3.5"})," \u521B\u5EFA"]})]}),x&&a("div",{className:"flex justify-center py-8",children:a(n,{className:"w-6 h-6 animate-spin text-sky-500"})}),!x&&h.length>0&&a("div",{className:"border rounded-lg bg-card shadow-sm divide-y",children:h.map(e=>o("div",{className:"flex items-center px-4 py-2.5 hover:bg-gray-50",children:[a("div",{className:"w-3 h-3 rounded-full mr-3",style:{backgroundColor:e.color?`#${e.color.toString(16).padStart(6,"0")}`:"#999"}}),a("span",{className:"font-medium text-sm flex-1",children:e.name}),o("span",{className:"text-xs text-gray-400 mr-4",children:["ID: ",e.id]}),a("button",{onClick:()=>fe(e.id),disabled:Z===e.id,className:"text-gray-400 hover:text-red-500 disabled:opacity-50",children:Z===e.id?a(n,{className:"w-4 h-4 animate-spin"}):a(D,{className:"w-4 h-4"})})]},e.id))}),!x&&r&&c&&!h.length&&a("div",{className:"text-center text-gray-400 py-6",children:"\u6682\u65E0\u89D2\u8272\u6570\u636E\uFF0C\u8BF7\u5148\u67E5\u8BE2"})]})]})}function Ea(t){t.addRoute({path:"/kook",name:"KOOK",element:t.React.createElement(V,{hostReact:t.React})}),t.addTool({id:"kook",name:"KOOK",path:"/kook"})}export{Ea as register};
|
|
2
2
|
/*! Bundled license information:
|
|
3
3
|
|
|
4
4
|
lucide-react/dist/esm/shared/src/utils/mergeClasses.mjs:
|
package/lib/adapter.d.ts
CHANGED
|
@@ -2,16 +2,17 @@
|
|
|
2
2
|
* KOOK 适配器
|
|
3
3
|
*/
|
|
4
4
|
import { Adapter, Plugin } from 'zhin.js';
|
|
5
|
-
import {
|
|
6
|
-
import type {
|
|
7
|
-
export declare class KookAdapter extends Adapter<
|
|
5
|
+
import { KookEndpoint } from "./endpoint.js";
|
|
6
|
+
import type { KookEndpointConfig } from "./types.js";
|
|
7
|
+
export declare class KookAdapter extends Adapter<KookEndpoint> {
|
|
8
|
+
static readonly capabilities: readonly ["inbound", "outbound"];
|
|
8
9
|
constructor(plugin: Plugin);
|
|
9
|
-
|
|
10
|
-
kickMember(
|
|
11
|
-
banMember(
|
|
12
|
-
unbanMember(
|
|
13
|
-
setMemberNickname(
|
|
14
|
-
listMembers(
|
|
10
|
+
createEndpoint(config: KookEndpointConfig): KookEndpoint;
|
|
11
|
+
kickMember(endpointId: string, sceneId: string, userId: string): Promise<boolean>;
|
|
12
|
+
banMember(endpointId: string, sceneId: string, userId: string, reason?: string): Promise<boolean>;
|
|
13
|
+
unbanMember(endpointId: string, sceneId: string, userId: string): Promise<boolean>;
|
|
14
|
+
setMemberNickname(endpointId: string, sceneId: string, userId: string, nickname: string): Promise<boolean>;
|
|
15
|
+
listMembers(endpointId: string, sceneId: string): Promise<{
|
|
15
16
|
members: {
|
|
16
17
|
id: string;
|
|
17
18
|
username: 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,EAAE,MAAM,YAAY,CAAC;AAErD,qBAAa,WAAY,SAAQ,OAAO,CAAC,YAAY,CAAC;IACpD,gBAAyB,YAAY,mCAAoC;gBAE7D,MAAM,EAAE,MAAM;IAI1B,cAAc,CAAC,MAAM,EAAE,kBAAkB,GAAG,YAAY;IAMlD,UAAU,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;IAM9D,SAAS,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM;IAM9E,WAAW,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;IAM/D,iBAAiB,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM;IAMvF,WAAW,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM;;;;;;;;;IAe/C,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAItB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;CAI5B"}
|
package/lib/adapter.js
CHANGED
|
@@ -2,44 +2,45 @@
|
|
|
2
2
|
* KOOK 适配器
|
|
3
3
|
*/
|
|
4
4
|
import { formatCompact, Adapter } from 'zhin.js';
|
|
5
|
-
import {
|
|
5
|
+
import { KookEndpoint } from "./endpoint.js";
|
|
6
6
|
export class KookAdapter extends Adapter {
|
|
7
|
+
static capabilities = ['inbound', 'outbound'];
|
|
7
8
|
constructor(plugin) {
|
|
8
9
|
super(plugin, "kook", []);
|
|
9
10
|
}
|
|
10
|
-
|
|
11
|
-
return new
|
|
11
|
+
createEndpoint(config) {
|
|
12
|
+
return new KookEndpoint(this, config);
|
|
12
13
|
}
|
|
13
14
|
// ── IGroupManagement 标准群管方法 ──────────────────────────────────
|
|
14
|
-
async kickMember(
|
|
15
|
-
const
|
|
16
|
-
if (!
|
|
17
|
-
throw new Error(`
|
|
18
|
-
return
|
|
19
|
-
}
|
|
20
|
-
async banMember(
|
|
21
|
-
const
|
|
22
|
-
if (!
|
|
23
|
-
throw new Error(`
|
|
24
|
-
return
|
|
25
|
-
}
|
|
26
|
-
async unbanMember(
|
|
27
|
-
const
|
|
28
|
-
if (!
|
|
29
|
-
throw new Error(`
|
|
30
|
-
return
|
|
31
|
-
}
|
|
32
|
-
async setMemberNickname(
|
|
33
|
-
const
|
|
34
|
-
if (!
|
|
35
|
-
throw new Error(`
|
|
36
|
-
return
|
|
37
|
-
}
|
|
38
|
-
async listMembers(
|
|
39
|
-
const
|
|
40
|
-
if (!
|
|
41
|
-
throw new Error(`
|
|
42
|
-
const members = await
|
|
15
|
+
async kickMember(endpointId, sceneId, userId) {
|
|
16
|
+
const endpoint = this.endpoints.get(endpointId);
|
|
17
|
+
if (!endpoint)
|
|
18
|
+
throw new Error(`Endpoint ${endpointId} 不存在`);
|
|
19
|
+
return endpoint.kickUser(sceneId, userId);
|
|
20
|
+
}
|
|
21
|
+
async banMember(endpointId, sceneId, userId, reason) {
|
|
22
|
+
const endpoint = this.endpoints.get(endpointId);
|
|
23
|
+
if (!endpoint)
|
|
24
|
+
throw new Error(`Endpoint ${endpointId} 不存在`);
|
|
25
|
+
return endpoint.addToBlacklist(sceneId, userId, reason);
|
|
26
|
+
}
|
|
27
|
+
async unbanMember(endpointId, sceneId, userId) {
|
|
28
|
+
const endpoint = this.endpoints.get(endpointId);
|
|
29
|
+
if (!endpoint)
|
|
30
|
+
throw new Error(`Endpoint ${endpointId} 不存在`);
|
|
31
|
+
return endpoint.removeFromBlacklist(sceneId, userId);
|
|
32
|
+
}
|
|
33
|
+
async setMemberNickname(endpointId, sceneId, userId, nickname) {
|
|
34
|
+
const endpoint = this.endpoints.get(endpointId);
|
|
35
|
+
if (!endpoint)
|
|
36
|
+
throw new Error(`Endpoint ${endpointId} 不存在`);
|
|
37
|
+
return endpoint.setNickname(sceneId, userId, nickname);
|
|
38
|
+
}
|
|
39
|
+
async listMembers(endpointId, sceneId) {
|
|
40
|
+
const endpoint = this.endpoints.get(endpointId);
|
|
41
|
+
if (!endpoint)
|
|
42
|
+
throw new Error(`Endpoint ${endpointId} 不存在`);
|
|
43
|
+
const members = await endpoint.getGuildMembers(sceneId);
|
|
43
44
|
return {
|
|
44
45
|
members: members.map(m => ({
|
|
45
46
|
id: m.id, username: m.username,
|
package/lib/adapter.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adapter.js","sourceRoot":"","sources":["../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AAO,CAAC,MAAM;SACtB,CAAC;IACJ,CAAC;IAED,kEAAkE;IAElE,KAAK,CAAC,KAAK;QACT,MAAM,KAAK,CAAC,KAAK,EAAE,CAAC;IACtB,CAAC;IAED,KAAK,CAAC,IAAI;QACR,MAAM,KAAK,CAAC,IAAI,EAAE,CAAC;QACnB,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,aAAa,CAAE,EAAE,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC;IAC1D,CAAC"}
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* KOOK
|
|
2
|
+
* KOOK Endpoint 实现
|
|
3
3
|
*/
|
|
4
4
|
import { Client, User, Guild } from "kook-client";
|
|
5
|
-
import {
|
|
6
|
-
import type {
|
|
5
|
+
import { Endpoint, Message, SendOptions } from "zhin.js";
|
|
6
|
+
import type { KookEndpointConfig, KookRawMessage } from "./types.js";
|
|
7
7
|
import type { KookAdapter } from "./adapter.js";
|
|
8
8
|
import { type KookMsgRoute } from "./kook-msg-route.js";
|
|
9
|
-
export declare class
|
|
10
|
-
$config:
|
|
9
|
+
export declare class KookEndpoint extends Client implements Endpoint<KookEndpointConfig, KookRawMessage> {
|
|
10
|
+
$config: KookEndpointConfig;
|
|
11
11
|
$connected: boolean;
|
|
12
|
-
/** KOOK 平台 user_id,用于 @ 触发匹配(
|
|
12
|
+
/** KOOK 平台 user_id,用于 @ 触发匹配(resolveEndpointAtIds) */
|
|
13
13
|
$platformUserId?: string;
|
|
14
14
|
adapter: KookAdapter;
|
|
15
15
|
private readonly inboundDeduper;
|
|
16
16
|
private readonly onGatewayEvent;
|
|
17
17
|
get $id(): string;
|
|
18
18
|
get pluginLogger(): import("zhin.js").Logger;
|
|
19
|
-
constructor(adapter: KookAdapter, $config:
|
|
19
|
+
constructor(adapter: KookAdapter, $config: KookEndpointConfig);
|
|
20
20
|
/**
|
|
21
21
|
* 在 kook-client Receiver transform 之前拦截原始 gateway 事件(SDK 未实现 notice transform)
|
|
22
22
|
*/
|
|
@@ -141,7 +141,7 @@ export declare class KookBot extends Client implements Bot<KookBotConfig, KookRa
|
|
|
141
141
|
$addReaction(messageId: string, emoji: string, hint?: {
|
|
142
142
|
sceneType?: 'private' | 'group' | 'channel';
|
|
143
143
|
}): Promise<string>;
|
|
144
|
-
/** 移除本
|
|
144
|
+
/** 移除本 Endpoint 在消息上的表情回应 */
|
|
145
145
|
$removeReaction(messageId: string, reactionId: string): Promise<void>;
|
|
146
146
|
private mutateMsgReaction;
|
|
147
147
|
/**
|
|
@@ -150,4 +150,4 @@ export declare class KookBot extends Client implements Bot<KookBotConfig, KookRa
|
|
|
150
150
|
*/
|
|
151
151
|
private convertToKookFormat;
|
|
152
152
|
}
|
|
153
|
-
//# sourceMappingURL=
|
|
153
|
+
//# sourceMappingURL=endpoint.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"endpoint.d.ts","sourceRoot":"","sources":["../src/endpoint.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EACL,MAAM,EAIN,IAAI,EACJ,KAAK,EAGN,MAAM,aAAa,CAAC;AAGrB,OAAO,EACL,QAAQ,EACR,OAAO,EACP,WAAW,EAKZ,MAAM,SAAS,CAAC;AACjB,OAAO,KAAK,EAAE,kBAAkB,EAAkB,cAAc,EAAE,MAAM,YAAY,CAAC;AAErF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAWhD,OAAO,EAeL,KAAK,YAAY,EAClB,MAAM,qBAAqB,CAAC;AAK7B,qBAAa,YAAa,SAAQ,MAAO,YAAW,QAAQ,CAAC,kBAAkB,EAAE,cAAc,CAAC;IAkBrD,OAAO,EAAE,kBAAkB;IAjBpE,UAAU,EAAE,OAAO,CAAS;IAC5B,sDAAsD;IACtD,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,OAAO,EAAE,WAAW,CAAC;IACrB,OAAO,CAAC,QAAQ,CAA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