@zhin.js/adapter-discord 5.0.1 → 5.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (68) hide show
  1. package/CHANGELOG.md +55 -0
  2. package/README.md +51 -76
  3. package/adapters/discord.ts +46 -0
  4. package/agent/tools/add_role.ts +24 -0
  5. package/agent/tools/create_thread.ts +25 -0
  6. package/agent/tools/forum_post.ts +24 -0
  7. package/agent/tools/list_roles.ts +22 -0
  8. package/agent/tools/react.ts +22 -0
  9. package/agent/tools/remove_role.ts +24 -0
  10. package/agent/tools/send_embed.ts +37 -0
  11. package/lib/discord-agent-deps.d.ts +35 -0
  12. package/lib/discord-agent-deps.js +32 -0
  13. package/lib/endpoint.d.ts +66 -119
  14. package/lib/endpoint.js +308 -1047
  15. package/lib/gateway.d.ts +122 -0
  16. package/lib/gateway.js +235 -0
  17. package/lib/index.d.ts +6 -18
  18. package/lib/index.js +6 -330
  19. package/lib/platform-permit.d.ts +1 -2
  20. package/lib/platform-permit.js +4 -2
  21. package/lib/protocol.d.ts +135 -0
  22. package/lib/protocol.js +234 -0
  23. package/lib/webhook.d.ts +13 -0
  24. package/lib/webhook.js +86 -0
  25. package/package.json +48 -31
  26. package/plugin.ts +13 -0
  27. package/schema.json +63 -0
  28. package/src/discord-agent-deps.ts +79 -0
  29. package/src/endpoint.ts +385 -1167
  30. package/src/gateway.ts +337 -0
  31. package/src/index.ts +55 -332
  32. package/src/platform-permit.ts +1 -2
  33. package/src/protocol.ts +392 -0
  34. package/src/webhook.ts +121 -0
  35. package/client/Dashboard.tsx +0 -195
  36. package/client/index.tsx +0 -11
  37. package/client/tsconfig.json +0 -7
  38. package/client/utils/api.ts +0 -30
  39. package/dist/index.js +0 -29
  40. package/lib/adapter.d.ts +0 -25
  41. package/lib/adapter.d.ts.map +0 -1
  42. package/lib/adapter.js +0 -96
  43. package/lib/adapter.js.map +0 -1
  44. package/lib/endpoint-interactions.d.ts +0 -34
  45. package/lib/endpoint-interactions.d.ts.map +0 -1
  46. package/lib/endpoint-interactions.js +0 -284
  47. package/lib/endpoint-interactions.js.map +0 -1
  48. package/lib/endpoint.d.ts.map +0 -1
  49. package/lib/endpoint.js.map +0 -1
  50. package/lib/index.d.ts.map +0 -1
  51. package/lib/index.js.map +0 -1
  52. package/lib/platform-permit.d.ts.map +0 -1
  53. package/lib/platform-permit.js.map +0 -1
  54. package/lib/segment-mapper.d.ts +0 -2
  55. package/lib/segment-mapper.d.ts.map +0 -1
  56. package/lib/segment-mapper.js +0 -2
  57. package/lib/segment-mapper.js.map +0 -1
  58. package/lib/types.d.ts +0 -49
  59. package/lib/types.d.ts.map +0 -1
  60. package/lib/types.js +0 -2
  61. package/lib/types.js.map +0 -1
  62. package/plugin.yml +0 -3
  63. package/src/adapter.ts +0 -108
  64. package/src/endpoint-interactions.ts +0 -354
  65. package/src/segment-mapper.ts +0 -1
  66. package/src/types.ts +0 -60
  67. /package/{skills/discord → agent}/PERMITS.md +0 -0
  68. /package/{skills/discord/SKILL.md → agent/skills/discord.md} +0 -0
@@ -1,195 +0,0 @@
1
- import { useEffect, useState, useCallback } from 'react'
2
- import { apiFetch } from './utils/api'
3
- import { RefreshCw, Server, Wifi, WifiOff, Power, PowerOff, Users, Loader2, Globe } from 'lucide-react'
4
-
5
- interface EndpointRow {
6
- name: string
7
- connected: boolean
8
- mode: string
9
- guildCount: number
10
- channelCount: number
11
- status: string
12
- user: { tag: string; id: string } | null
13
- }
14
-
15
- interface GuildInfo {
16
- id: string
17
- name: string
18
- memberCount: number
19
- icon: string | null
20
- }
21
-
22
- type Tab = 'overview' | 'guilds'
23
-
24
- export default function DiscordDashboard() {
25
- const [endpoints, setEndpoints] = useState<EndpointRow[]>([])
26
- const [loading, setLoading] = useState(true)
27
- const [error, setError] = useState('')
28
- const [tab, setTab] = useState<Tab>('overview')
29
- const [actionLoading, setActionLoading] = useState<Record<string, boolean>>({})
30
-
31
- // Guild browser state
32
- const [selectedEndpoint, setSelectedEndpoint] = useState('')
33
- const [guilds, setGuilds] = useState<GuildInfo[]>([])
34
- const [guildsLoading, setGuildsLoading] = useState(false)
35
-
36
- const fetchData = useCallback(async () => {
37
- setLoading(true)
38
- setError('')
39
- try {
40
- const res = await apiFetch('/api/discord/endpoints')
41
- const json = await res.json()
42
- if (json.success) setEndpoints(json.data)
43
- else setError(json.error || '获取数据失败')
44
- } catch {
45
- setError('无法连接服务器')
46
- } finally {
47
- setLoading(false)
48
- }
49
- }, [])
50
-
51
- useEffect(() => { fetchData() }, [fetchData])
52
-
53
- const toggleConnect = async (name: string, connected: boolean) => {
54
- setActionLoading(prev => ({ ...prev, [name]: true }))
55
- try {
56
- const endpoint = connected ? 'disconnect' : 'connect'
57
- const res = await apiFetch(`/api/discord/endpoints/${encodeURIComponent(name)}/${endpoint}`, { method: 'POST' })
58
- const json = await res.json()
59
- if (!json.success) setError(json.error || '操作失败')
60
- await fetchData()
61
- } catch {
62
- setError('操作失败')
63
- } finally {
64
- setActionLoading(prev => ({ ...prev, [name]: false }))
65
- }
66
- }
67
-
68
- const loadGuilds = async (endpointName: string) => {
69
- setSelectedEndpoint(endpointName)
70
- setGuildsLoading(true)
71
- setGuilds([])
72
- try {
73
- const res = await apiFetch(`/api/discord/endpoints/${encodeURIComponent(endpointName)}/guilds`)
74
- const json = await res.json()
75
- if (json.success) setGuilds(json.data)
76
- else setError(json.error || '获取服务器列表失败')
77
- } catch {
78
- setError('获取服务器列表失败')
79
- } finally {
80
- setGuildsLoading(false)
81
- }
82
- }
83
-
84
- const gatewayEndpoints = endpoints.filter((e) => e.connected && e.mode === 'gateway')
85
-
86
- return (
87
- <div className="p-6 max-w-5xl mx-auto">
88
- <div className="flex items-center justify-between mb-6">
89
- <h1 className="text-2xl font-bold flex items-center gap-2">
90
- <Server className="w-6 h-6" /> Discord 机器人
91
- </h1>
92
- <button onClick={fetchData} disabled={loading}
93
- className="flex items-center gap-1 px-3 py-1.5 rounded bg-indigo-500 text-white hover:bg-indigo-600 disabled:opacity-50 text-sm">
94
- <RefreshCw className={`w-4 h-4 ${loading ? 'animate-spin' : ''}`} /> 刷新
95
- </button>
96
- </div>
97
-
98
- {error && <div className="mb-4 p-3 bg-red-50 text-red-600 rounded border border-red-200">{error}</div>}
99
-
100
- {/* Tabs */}
101
- <div className="flex gap-1 mb-6 border-b">
102
- <button onClick={() => setTab('overview')}
103
- className={`px-4 py-2 text-sm font-medium border-b-2 transition-colors ${tab === 'overview' ? 'border-indigo-500 text-indigo-600' : 'border-transparent text-gray-500 hover:text-gray-700'}`}>
104
- 概览
105
- </button>
106
- <button onClick={() => setTab('guilds')}
107
- className={`px-4 py-2 text-sm font-medium border-b-2 transition-colors ${tab === 'guilds' ? 'border-indigo-500 text-indigo-600' : 'border-transparent text-gray-500 hover:text-gray-700'}`}>
108
- 服务器列表
109
- </button>
110
- </div>
111
-
112
- {/* Overview Tab */}
113
- {tab === 'overview' && (
114
- <>
115
- {!loading && !endpoints.length && !error && (
116
- <div className="text-center text-gray-500 py-12">暂无 Discord Endpoint 实例</div>
117
- )}
118
- <div className="grid gap-4 md:grid-cols-2">
119
- {endpoints.map((endpoint) => (
120
- <div key={endpoint.name} className="border rounded-lg p-4 bg-card shadow-sm">
121
- <div className="flex items-center justify-between mb-3">
122
- <span className="font-medium text-lg">{endpoint.name}</span>
123
- {endpoint.connected
124
- ? <span className="flex items-center gap-1 text-green-600 text-sm"><Wifi className="w-4 h-4" /> 在线</span>
125
- : <span className="flex items-center gap-1 text-gray-400 text-sm"><WifiOff className="w-4 h-4" /> 离线</span>}
126
- </div>
127
- {endpoint.user && <div className="text-sm text-gray-500 mb-2">@{endpoint.user.tag}</div>}
128
- <div className="grid grid-cols-2 gap-2 text-sm text-gray-600 mb-3">
129
- <div className="flex justify-between"><span>模式</span><span className="font-mono">{endpoint.mode}</span></div>
130
- <div className="flex justify-between"><span>服务器</span><span className="font-mono">{endpoint.guildCount}</span></div>
131
- <div className="flex justify-between"><span>频道</span><span className="font-mono">{endpoint.channelCount}</span></div>
132
- </div>
133
- <div className="flex gap-2">
134
- <button
135
- onClick={() => toggleConnect(endpoint.name, endpoint.connected)}
136
- disabled={actionLoading[endpoint.name]}
137
- 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`}>
138
- {actionLoading[endpoint.name]
139
- ? <Loader2 className="w-3.5 h-3.5 animate-spin" />
140
- : endpoint.connected ? <PowerOff className="w-3.5 h-3.5" /> : <Power className="w-3.5 h-3.5" />}
141
- {endpoint.connected ? '断开' : '连接'}
142
- </button>
143
- {endpoint.connected && endpoint.mode === 'gateway' && (
144
- <button onClick={() => { setTab('guilds'); loadGuilds(endpoint.name) }}
145
- className="flex items-center gap-1 px-3 py-1.5 rounded text-sm bg-gray-100 hover:bg-gray-200 text-gray-700">
146
- <Globe className="w-3.5 h-3.5" /> 查看服务器
147
- </button>
148
- )}
149
- </div>
150
- </div>
151
- ))}
152
- </div>
153
- </>
154
- )}
155
-
156
- {/* Guilds Tab */}
157
- {tab === 'guilds' && (
158
- <div>
159
- {gatewayEndpoints.length > 0 && (
160
- <div className="mb-4 flex items-center gap-2">
161
- <label className="text-sm text-gray-500">选择机器人:</label>
162
- <select value={selectedEndpoint} onChange={(e) => loadGuilds(e.target.value)}
163
- className="border rounded px-2 py-1 text-sm">
164
- <option value="">--</option>
165
- {gatewayEndpoints.map((e) => <option key={e.name} value={e.name}>{e.name}</option>)}
166
- </select>
167
- <span className="text-xs text-gray-400 ml-2">仅 Gateway 模式支持</span>
168
- </div>
169
- )}
170
- {!gatewayEndpoints.length && <div className="text-center text-gray-500 py-8">暂无 Gateway 模式在线 Endpoint</div>}
171
- {guildsLoading && <div className="flex justify-center py-8"><Loader2 className="w-6 h-6 animate-spin text-indigo-500" /></div>}
172
-
173
- {!guildsLoading && guilds.length > 0 && (
174
- <div className="grid gap-3 md:grid-cols-2 lg:grid-cols-3">
175
- {guilds.map(g => (
176
- <div key={g.id} className="border rounded-lg p-3 bg-card shadow-sm flex items-center gap-3">
177
- {g.icon
178
- ? <img src={g.icon} alt="" className="w-10 h-10 rounded-full" />
179
- : <div className="w-10 h-10 rounded-full bg-indigo-100 flex items-center justify-center text-indigo-500 font-bold text-sm">{g.name[0]}</div>}
180
- <div className="flex-1 min-w-0">
181
- <div className="font-medium text-sm truncate">{g.name}</div>
182
- <div className="flex items-center gap-1 text-xs text-gray-400">
183
- <Users className="w-3 h-3" /> {g.memberCount} 成员
184
- </div>
185
- </div>
186
- </div>
187
- ))}
188
- </div>
189
- )}
190
- {!guildsLoading && selectedEndpoint && !guilds.length && <div className="text-center text-gray-400 py-8">该机器人未加入任何服务器</div>}
191
- </div>
192
- )}
193
- </div>
194
- )
195
- }
package/client/index.tsx DELETED
@@ -1,11 +0,0 @@
1
- import type { PluginRegisterHostApi } from '@zhin.js/contract'
2
- import DiscordDashboard from './Dashboard'
3
-
4
- export function register(api: PluginRegisterHostApi) {
5
- api.addRoute({
6
- path: '/console/discord',
7
- name: 'Discord',
8
- element: api.React.createElement(DiscordDashboard, { hostReact: api.React }),
9
- })
10
- api.addTool({ id: 'discord', name: 'Discord', path: '/console/discord' })
11
- }
@@ -1,7 +0,0 @@
1
- {
2
- "extends": "../node_modules/@zhin.js/host-api/browser.tsconfig.json",
3
- "compilerOptions": {
4
- "outDir": "../dist"
5
- },
6
- "include": ["./**/*"]
7
- }
@@ -1,30 +0,0 @@
1
- const TOKEN_KEY = "zhin_api_token";
2
- const API_BASE_KEY = "zhin_api_base";
3
-
4
- export function getApiBase(): string {
5
- const stored = localStorage.getItem(API_BASE_KEY)?.trim();
6
- if (stored) return stored.replace(/\/$/, "");
7
- if (typeof window !== "undefined") return window.location.origin;
8
- return "";
9
- }
10
-
11
- export function getToken(): string | null {
12
- return localStorage.getItem(TOKEN_KEY);
13
- }
14
-
15
- export async function apiFetch(input: RequestInfo | URL, init?: RequestInit): Promise<Response> {
16
- const token = getToken();
17
- const headers = new Headers(init?.headers);
18
- if (token) headers.set("Authorization", `Bearer ${token}`);
19
-
20
- const base = getApiBase();
21
- const url =
22
- typeof input === "string" && input.startsWith("/") ? `${base}${input}` : input;
23
-
24
- const res = await fetch(url, { ...init, headers });
25
- if (res.status === 401) {
26
- localStorage.removeItem(TOKEN_KEY);
27
- window.dispatchEvent(new CustomEvent("zhin:auth-required"));
28
- }
29
- return res;
30
- }
package/dist/index.js DELETED
@@ -1,29 +0,0 @@
1
- import{useEffect as pe,useState as p,useCallback as me}from"react";var E="zhin_api_token",J="zhin_api_base";function _(){let t=localStorage.getItem(J)?.trim();return t?t.replace(/\/$/,""):typeof window<"u"?window.location.origin:""}function j(){return localStorage.getItem(E)}async function T(t,u){let l=j(),s=new Headers(u?.headers);l&&s.set("Authorization",`Bearer ${l}`);let r=_(),f=typeof t=="string"&&t.startsWith("/")?`${r}${t}`:t,i=await fetch(f,{...u,headers:s});return i.status===401&&(localStorage.removeItem(E),window.dispatchEvent(new CustomEvent("zhin:auth-required"))),i}import{forwardRef as te,createElement as oe}from"react";var b=(...t)=>t.filter((u,l,s)=>!!u&&u.trim()!==""&&s.indexOf(u)===l).join(" ").trim();var V=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();var z=t=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(u,l,s)=>s?s.toUpperCase():l.toLowerCase());var O=t=>{let u=z(t);return u.charAt(0).toUpperCase()+u.slice(1)};import{forwardRef as ae,createElement as K}from"react";var q={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 N=t=>{for(let u in t)if(u.startsWith("aria-")||u==="role"||u==="title")return!0;return!1};import{createContext as $,useContext as Y,useMemo as Be,createElement as Me}from"react";var ee=$({});var X=()=>Y(ee);var Z=ae(({color:t,size:u,strokeWidth:l,absoluteStrokeWidth:s,className:r="",children:f,iconNode:i,...m},F)=>{let{size:L=24,strokeWidth:C=2,absoluteStrokeWidth:v=!1,color:h="currentColor",className:R=""}=X()??{},g=s??v?Number(l??C)*24/Number(u??L):l??C;return K("svg",{ref:F,...q,width:u??L??q.width,height:u??L??q.height,stroke:t??h,strokeWidth:g,className:b("lucide",R,r),...!f&&!N(m)&&{"aria-hidden":"true"},...m},[...i.map(([y,I])=>K(y,I)),...Array.isArray(f)?f:[f]])});var d=(t,u)=>{let l=te(({className:s,...r},f)=>oe(Z,{ref:f,iconNode:u,className:b(`lucide-${V(O(t))}`,`lucide-${t}`,s),...r}));return l.displayName=O(t),l};var ue=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]],S=d("globe",ue);var de=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],n=d("loader-circle",de);var le=[["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"}]],k=d("power-off",le);var fe=[["path",{d:"M12 2v10",key:"mnfbl"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04",key:"obofu9"}]],w=d("power",fe);var se=[["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"}]],P=d("refresh-cw",se);var re=[["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"}]],A=d("server",re);var ie=[["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=d("users",ie);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"}]],M=d("wifi-off",ce);var ne=[["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"}]],D=d("wifi",ne);import{Fragment as Le,jsx as a,jsxs as o}from"react/jsx-runtime";function H(){let[t,u]=p([]),[l,s]=p(!0),[r,f]=p(""),[i,m]=p("overview"),[F,L]=p({}),[C,v]=p(""),[h,R]=p([]),[g,y]=p(!1),I=me(async()=>{s(!0),f("");try{let x=await(await T("/api/discord/endpoints")).json();x.success?u(x.data):f(x.error||"\u83B7\u53D6\u6570\u636E\u5931\u8D25")}catch{f("\u65E0\u6CD5\u8FDE\u63A5\u670D\u52A1\u5668")}finally{s(!1)}},[]);pe(()=>{I()},[I]);let Q=async(e,x)=>{L(c=>({...c,[e]:!0}));try{let c=x?"disconnect":"connect",W=await(await T(`/api/discord/endpoints/${encodeURIComponent(e)}/${c}`,{method:"POST"})).json();W.success||f(W.error||"\u64CD\u4F5C\u5931\u8D25"),await I()}catch{f("\u64CD\u4F5C\u5931\u8D25")}finally{L(c=>({...c,[e]:!1}))}},G=async e=>{v(e),y(!0),R([]);try{let c=await(await T(`/api/discord/endpoints/${encodeURIComponent(e)}/guilds`)).json();c.success?R(c.data):f(c.error||"\u83B7\u53D6\u670D\u52A1\u5668\u5217\u8868\u5931\u8D25")}catch{f("\u83B7\u53D6\u670D\u52A1\u5668\u5217\u8868\u5931\u8D25")}finally{y(!1)}},U=t.filter(e=>e.connected&&e.mode==="gateway");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(A,{className:"w-6 h-6"})," Discord \u673A\u5668\u4EBA"]}),o("button",{onClick:I,disabled:l,className:"flex items-center gap-1 px-3 py-1.5 rounded bg-indigo-500 text-white hover:bg-indigo-600 disabled:opacity-50 text-sm",children:[a(P,{className:`w-4 h-4 ${l?"animate-spin":""}`})," \u5237\u65B0"]})]}),r&&a("div",{className:"mb-4 p-3 bg-red-50 text-red-600 rounded border border-red-200",children:r}),o("div",{className:"flex gap-1 mb-6 border-b",children:[a("button",{onClick:()=>m("overview"),className:`px-4 py-2 text-sm font-medium border-b-2 transition-colors ${i==="overview"?"border-indigo-500 text-indigo-600":"border-transparent text-gray-500 hover:text-gray-700"}`,children:"\u6982\u89C8"}),a("button",{onClick:()=>m("guilds"),className:`px-4 py-2 text-sm font-medium border-b-2 transition-colors ${i==="guilds"?"border-indigo-500 text-indigo-600":"border-transparent text-gray-500 hover:text-gray-700"}`,children:"\u670D\u52A1\u5668\u5217\u8868"})]}),i==="overview"&&o(Le,{children:[!l&&!t.length&&!r&&a("div",{className:"text-center text-gray-500 py-12",children:"\u6682\u65E0 Discord 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(D,{className:"w-4 h-4"})," \u5728\u7EBF"]}):o("span",{className:"flex items-center gap-1 text-gray-400 text-sm",children:[a(M,{className:"w-4 h-4"})," \u79BB\u7EBF"]})]}),e.user&&o("div",{className:"text-sm text-gray-500 mb-2",children:["@",e.user.tag]}),o("div",{className:"grid grid-cols-2 gap-2 text-sm text-gray-600 mb-3",children:[o("div",{className:"flex justify-between",children:[a("span",{children:"\u6A21\u5F0F"}),a("span",{className:"font-mono",children:e.mode})]}),o("div",{className:"flex justify-between",children:[a("span",{children:"\u670D\u52A1\u5668"}),a("span",{className:"font-mono",children:e.guildCount})]}),o("div",{className:"flex justify-between",children:[a("span",{children:"\u9891\u9053"}),a("span",{className:"font-mono",children:e.channelCount})]})]}),o("div",{className:"flex gap-2",children:[o("button",{onClick:()=>Q(e.name,e.connected),disabled:F[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:[F[e.name]?a(n,{className:"w-3.5 h-3.5 animate-spin"}):e.connected?a(k,{className:"w-3.5 h-3.5"}):a(w,{className:"w-3.5 h-3.5"}),e.connected?"\u65AD\u5F00":"\u8FDE\u63A5"]}),e.connected&&e.mode==="gateway"&&o("button",{onClick:()=>{m("guilds"),G(e.name)},className:"flex items-center gap-1 px-3 py-1.5 rounded text-sm bg-gray-100 hover:bg-gray-200 text-gray-700",children:[a(S,{className:"w-3.5 h-3.5"})," \u67E5\u770B\u670D\u52A1\u5668"]})]})]},e.name))})]}),i==="guilds"&&o("div",{children:[U.length>0&&o("div",{className:"mb-4 flex items-center gap-2",children:[a("label",{className:"text-sm text-gray-500",children:"\u9009\u62E9\u673A\u5668\u4EBA\uFF1A"}),o("select",{value:C,onChange:e=>G(e.target.value),className:"border rounded px-2 py-1 text-sm",children:[a("option",{value:"",children:"--"}),U.map(e=>a("option",{value:e.name,children:e.name},e.name))]}),a("span",{className:"text-xs text-gray-400 ml-2",children:"\u4EC5 Gateway \u6A21\u5F0F\u652F\u6301"})]}),!U.length&&a("div",{className:"text-center text-gray-500 py-8",children:"\u6682\u65E0 Gateway \u6A21\u5F0F\u5728\u7EBF Endpoint"}),g&&a("div",{className:"flex justify-center py-8",children:a(n,{className:"w-6 h-6 animate-spin text-indigo-500"})}),!g&&h.length>0&&a("div",{className:"grid gap-3 md:grid-cols-2 lg:grid-cols-3",children:h.map(e=>o("div",{className:"border rounded-lg p-3 bg-card shadow-sm flex items-center gap-3",children:[e.icon?a("img",{src:e.icon,alt:"",className:"w-10 h-10 rounded-full"}):a("div",{className:"w-10 h-10 rounded-full bg-indigo-100 flex items-center justify-center text-indigo-500 font-bold text-sm",children:e.name[0]}),o("div",{className:"flex-1 min-w-0",children:[a("div",{className:"font-medium text-sm truncate",children:e.name}),o("div",{className:"flex items-center gap-1 text-xs text-gray-400",children:[a(B,{className:"w-3 h-3"})," ",e.memberCount," \u6210\u5458"]})]})]},e.id))}),!g&&C&&!h.length&&a("div",{className:"text-center text-gray-400 py-8",children:"\u8BE5\u673A\u5668\u4EBA\u672A\u52A0\u5165\u4EFB\u4F55\u670D\u52A1\u5668"})]})]})}function Sa(t){t.addRoute({path:"/console/discord",name:"Discord",element:t.React.createElement(H,{hostReact:t.React})}),t.addTool({id:"discord",name:"Discord",path:"/console/discord"})}export{Sa as register};
2
- /*! Bundled license information:
3
-
4
- lucide-react/dist/esm/shared/src/utils/mergeClasses.mjs:
5
- lucide-react/dist/esm/shared/src/utils/toKebabCase.mjs:
6
- lucide-react/dist/esm/shared/src/utils/toCamelCase.mjs:
7
- lucide-react/dist/esm/shared/src/utils/toPascalCase.mjs:
8
- lucide-react/dist/esm/defaultAttributes.mjs:
9
- lucide-react/dist/esm/shared/src/utils/hasA11yProp.mjs:
10
- lucide-react/dist/esm/context.mjs:
11
- lucide-react/dist/esm/Icon.mjs:
12
- lucide-react/dist/esm/createLucideIcon.mjs:
13
- lucide-react/dist/esm/icons/globe.mjs:
14
- lucide-react/dist/esm/icons/loader-circle.mjs:
15
- lucide-react/dist/esm/icons/power-off.mjs:
16
- lucide-react/dist/esm/icons/power.mjs:
17
- lucide-react/dist/esm/icons/refresh-cw.mjs:
18
- lucide-react/dist/esm/icons/server.mjs:
19
- lucide-react/dist/esm/icons/users.mjs:
20
- lucide-react/dist/esm/icons/wifi-off.mjs:
21
- lucide-react/dist/esm/icons/wifi.mjs:
22
- lucide-react/dist/esm/lucide-react.mjs:
23
- (**
24
- * @license lucide-react v1.23.0 - ISC
25
- *
26
- * This source code is licensed under the ISC license.
27
- * See the LICENSE file in the root directory of this source tree.
28
- *)
29
- */
package/lib/adapter.d.ts DELETED
@@ -1,25 +0,0 @@
1
- /**
2
- * Discord 适配器:单一适配器支持 Gateway / Interactions,由 config.connection 区分
3
- */
4
- import { Adapter, Plugin } from 'zhin.js';
5
- import { DiscordEndpoint } from "./endpoint.js";
6
- import { DiscordInteractionsEndpoint } from "./endpoint-interactions.js";
7
- import type { DiscordEndpointConfig } from "./types.js";
8
- export type DiscordEndpointLike = DiscordEndpoint | DiscordInteractionsEndpoint;
9
- export declare class DiscordAdapter extends Adapter<DiscordEndpointLike> {
10
- #private;
11
- static readonly capabilities: readonly ["inbound", "outbound"];
12
- static outboundRichSegmentPolicy: import("zhin.js").OutboundRichSegmentPolicy;
13
- static interactivePolicy: "native";
14
- constructor(plugin: Plugin);
15
- createEndpoint(config: DiscordEndpointConfig): DiscordEndpointLike;
16
- removeMember(endpointId: string, sceneId: string, userId: string): Promise<boolean>;
17
- banMember(endpointId: string, sceneId: string, userId: string, reason?: string): Promise<boolean>;
18
- unbanMember(endpointId: string, sceneId: string, userId: string): Promise<boolean>;
19
- muteMember(endpointId: string, sceneId: string, userId: string, duration?: number): Promise<boolean>;
20
- setMemberNickname(endpointId: string, sceneId: string, userId: string, nickname: string): Promise<boolean>;
21
- listMembers(endpointId: string, sceneId: string): Promise<any[]>;
22
- getSceneInfo(endpointId: string, sceneId: string): Promise<any>;
23
- start(): Promise<void>;
24
- }
25
- //# sourceMappingURL=adapter.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../src/adapter.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,OAAO,EAAE,MAAM,EAAwC,MAAM,SAAS,CAAC;AAEhF,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,2BAA2B,EAAE,MAAM,4BAA4B,CAAC;AACzE,OAAO,KAAK,EACV,qBAAqB,EAGtB,MAAM,YAAY,CAAC;AAEpB,MAAM,MAAM,mBAAmB,GAAG,eAAe,GAAG,2BAA2B,CAAC;AAMhF,qBAAa,cAAe,SAAQ,OAAO,CAAC,mBAAmB,CAAC;;IAC9D,gBAAyB,YAAY,mCAAoC;IACzE,OAAgB,yBAAyB,8CAAwC;IACjF,OAAgB,iBAAiB,EAAG,QAAQ,CAAU;gBAI1C,MAAM,EAAE,MAAM;IAI1B,cAAc,CAAC,MAAM,EAAE,qBAAqB,GAAG,mBAAmB;IAiB5D,YAAY,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;IAOhE,SAAS,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM;IAO9E,WAAW,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;IAO/D,UAAU,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,SAAM;IAO9E,iBAAiB,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM;IAOvF,WAAW,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM;IAO/C,YAAY,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM;IAOhD,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;CAW7B"}
package/lib/adapter.js DELETED
@@ -1,96 +0,0 @@
1
- /**
2
- * Discord 适配器:单一适配器支持 Gateway / Interactions,由 config.connection 区分
3
- */
4
- import { Adapter, OUTBOUND_RICH_SEGMENT_POLICY_IM_FULL } from 'zhin.js';
5
- import { DiscordEndpoint } from "./endpoint.js";
6
- import { DiscordInteractionsEndpoint } from "./endpoint-interactions.js";
7
- function isGatewayBot(endpoint) {
8
- return endpoint.$config.connection === "gateway";
9
- }
10
- export class DiscordAdapter extends Adapter {
11
- static capabilities = ['inbound', 'outbound'];
12
- static outboundRichSegmentPolicy = OUTBOUND_RICH_SEGMENT_POLICY_IM_FULL;
13
- static interactivePolicy = 'native';
14
- #router;
15
- constructor(plugin) {
16
- super(plugin, "discord", []);
17
- }
18
- createEndpoint(config) {
19
- const connection = config.connection ?? "gateway";
20
- switch (connection) {
21
- case "gateway":
22
- return new DiscordEndpoint(this, config);
23
- case "interactions":
24
- if (!this.#router) {
25
- throw new Error("Discord connection: interactions 需要 router,请安装并在配置中启用 @zhin.js/host-router");
26
- }
27
- return new DiscordInteractionsEndpoint(this, this.#router, config);
28
- default:
29
- throw new Error(`Unknown Discord connection: ${config.connection}`);
30
- }
31
- }
32
- async removeMember(endpointId, sceneId, userId) {
33
- const endpoint = this.endpoints.get(endpointId);
34
- if (!endpoint)
35
- throw new Error(`Endpoint ${endpointId} 不存在`);
36
- if (!isGatewayBot(endpoint))
37
- throw new Error("群管仅支持 connection: gateway");
38
- return endpoint.kickMember(sceneId, userId);
39
- }
40
- async banMember(endpointId, sceneId, userId, reason) {
41
- const endpoint = this.endpoints.get(endpointId);
42
- if (!endpoint)
43
- throw new Error(`Endpoint ${endpointId} 不存在`);
44
- if (!isGatewayBot(endpoint))
45
- throw new Error("群管仅支持 connection: gateway");
46
- return endpoint.banMember(sceneId, userId, reason);
47
- }
48
- async unbanMember(endpointId, sceneId, userId) {
49
- const endpoint = this.endpoints.get(endpointId);
50
- if (!endpoint)
51
- throw new Error(`Endpoint ${endpointId} 不存在`);
52
- if (!isGatewayBot(endpoint))
53
- throw new Error("群管仅支持 connection: gateway");
54
- return endpoint.unbanMember(sceneId, userId);
55
- }
56
- async muteMember(endpointId, sceneId, userId, duration = 600) {
57
- const endpoint = this.endpoints.get(endpointId);
58
- if (!endpoint)
59
- throw new Error(`Endpoint ${endpointId} 不存在`);
60
- if (!isGatewayBot(endpoint))
61
- throw new Error("群管仅支持 connection: gateway");
62
- return endpoint.timeoutMember(sceneId, userId, duration);
63
- }
64
- async setMemberNickname(endpointId, sceneId, userId, nickname) {
65
- const endpoint = this.endpoints.get(endpointId);
66
- if (!endpoint)
67
- throw new Error(`Endpoint ${endpointId} 不存在`);
68
- if (!isGatewayBot(endpoint))
69
- throw new Error("群管仅支持 connection: gateway");
70
- return endpoint.setNickname(sceneId, userId, nickname);
71
- }
72
- async listMembers(endpointId, sceneId) {
73
- const endpoint = this.endpoints.get(endpointId);
74
- if (!endpoint)
75
- throw new Error(`Endpoint ${endpointId} 不存在`);
76
- if (!isGatewayBot(endpoint))
77
- throw new Error("群管仅支持 connection: gateway");
78
- return endpoint.getMembers(sceneId);
79
- }
80
- async getSceneInfo(endpointId, sceneId) {
81
- const endpoint = this.endpoints.get(endpointId);
82
- if (!endpoint)
83
- throw new Error(`Endpoint ${endpointId} 不存在`);
84
- if (!isGatewayBot(endpoint))
85
- throw new Error("群管仅支持 connection: gateway");
86
- return endpoint.getGuildInfo(sceneId);
87
- }
88
- async start() {
89
- this.#router = this.plugin.inject("router");
90
- this.plugin.useContext("router", (router) => {
91
- this.#router = router;
92
- });
93
- await super.start();
94
- }
95
- }
96
- //# sourceMappingURL=adapter.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"adapter.js","sourceRoot":"","sources":["../src/adapter.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,OAAO,EAAU,oCAAoC,EAAE,MAAM,SAAS,CAAC;AAEhF,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,2BAA2B,EAAE,MAAM,4BAA4B,CAAC;AASzE,SAAS,YAAY,CAAC,QAA6B;IACjD,OAAQ,QAAQ,CAAC,OAAmC,CAAC,UAAU,KAAK,SAAS,CAAC;AAChF,CAAC;AAED,MAAM,OAAO,cAAe,SAAQ,OAA4B;IAC9D,MAAM,CAAmB,YAAY,GAAG,CAAC,SAAS,EAAE,UAAU,CAAU,CAAC;IACzE,MAAM,CAAU,yBAAyB,GAAG,oCAAoC,CAAC;IACjF,MAAM,CAAU,iBAAiB,GAAG,QAAiB,CAAC;IAEtD,OAAO,CAAU;IAEjB,YAAY,MAAc;QACxB,KAAK,CAAC,MAAM,EAAE,SAAS,EAAE,EAAE,CAAC,CAAC;IAC/B,CAAC;IAED,cAAc,CAAC,MAA6B;QAC1C,MAAM,UAAU,GAAG,MAAM,CAAC,UAAU,IAAI,SAAS,CAAC;QAClD,QAAQ,UAAU,EAAE,CAAC;YACnB,KAAK,SAAS;gBACZ,OAAO,IAAI,eAAe,CAAC,IAAI,EAAE,MAA8B,CAAC,CAAC;YACnE,KAAK,cAAc;gBACjB,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;oBAClB,MAAM,IAAI,KAAK,CACb,4EAA4E,CAC7E,CAAC;gBACJ,CAAC;gBACD,OAAO,IAAI,2BAA2B,CAAC,IAAI,EAAE,IAAI,CAAC,OAAO,EAAE,MAAmC,CAAC,CAAC;YAClG;gBACE,MAA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KAAK,CAAC,2BAA2B,CAAC,CAAC;QAC1E,OAAO,QAAQ,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;IACtC,CAAC;IAED,KAAK,CAAC,YAAY,CAAC,UAAkB,EAAE,OAAe;QACpD,MAAM,QAAQ,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;QAChD,IAAI,CAAC,QAAQ;YAAE,MAAM,IAAI,KAAK,CAAC,YAAY,UAAU,MAAM,CAAC,CAAC;QAC7D,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC;YAAE,MAAM,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAC;QAC1E,OAAO,QAAQ,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;IACxC,CAAC;IAED,KAAK,CAAC,KAAK;QACT,IAAI,CAAC,OAAO,GAAI,IAAI,CAAC,MAAM,CAAC,MAA8C,CAAC,QAAQ,CAAC,CAAC;QACpF,IAAI,CAAC,MAAM,CAAC,UAAkE,CAC7E,QAAQ,EACR,CAAC,MAAc,EAAE,EAAE;YACjB,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QACxB,CAAC,CACF,CAAC;QACF,MAAM,KAAK,CAAC,KAAK,EAAE,CAAC;IACtB,CAAC"}
@@ -1,34 +0,0 @@
1
- /**
2
- * Discord Interactions Endpoint 实现
3
- */
4
- import { Client } from "discord.js";
5
- import { Endpoint, Message, SendOptions } from 'zhin.js';
6
- import { type Router } from "@zhin.js/host-router/router";
7
- import type { DiscordInteractionsConfig } from "./types.js";
8
- import type { DiscordAdapter } from "./adapter.js";
9
- export declare class DiscordInteractionsEndpoint extends Client implements Endpoint<DiscordInteractionsConfig, any> {
10
- adapter: DiscordAdapter;
11
- $config: DiscordInteractionsConfig;
12
- $connected: boolean;
13
- private router;
14
- private slashCommandHandlers;
15
- get pluginLogger(): import("zhin.js").Logger;
16
- get $id(): string;
17
- constructor(adapter: DiscordAdapter, router: Router, $config: DiscordInteractionsConfig);
18
- private setupInteractionsEndpoint;
19
- private handleInteraction;
20
- private verifyDiscordSignature;
21
- private handleApplicationCommand;
22
- private formatInteractionAsMessage;
23
- private formatSendContent;
24
- $connect(): Promise<void>;
25
- $disconnect(): Promise<void>;
26
- private registerSlashCommands;
27
- addSlashCommandHandler(commandName: string, handler: (interaction: any) => Promise<void>): void;
28
- removeSlashCommandHandler(commandName: string): boolean;
29
- private getActivityType;
30
- $formatMessage(msg: any): Message<any>;
31
- $sendMessage(options: SendOptions): Promise<string>;
32
- $recallMessage(id: string): Promise<void>;
33
- }
34
- //# sourceMappingURL=endpoint-interactions.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"endpoint-interactions.d.ts","sourceRoot":"","sources":["../src/endpoint-interactions.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EACL,MAAM,EAiBP,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,WAAW,EAAwC,MAAM,SAAS,CAAC;AAC/F,OAAO,EAAsB,KAAK,MAAM,EAAsB,MAAM,6BAA6B,CAAC;AAClG,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,YAAY,CAAC;AAC5D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAEnD,qBAAa,2BACX,SAAQ,MACR,YAAW,QAAQ,CAAC,yBAAyB,EAAE,GAAG,CAAC;IAgBhC,OAAO,EAAE,cAAc;IAAyB,OAAO,EAAE,yBAAyB;IAfrG,UAAU,EAAE,OAAO,CAAC;IACpB,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,oBAAoB,CAGd;IAEd,IAAI,YAAY,6BAEf;IAED,IAAI,GAAG,WAEN;gBAEkB,OAAO,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,EAAS,OAAO,EAAE,yBAAyB;IAerG,OAAO,CAAC,yBAAyB;YAOnB,iBAAiB;IA0C/B,OAAO,CAAC,sBAAsB;YAiBhB,wBAAwB;IA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