@zhin.js/adapter-telegram 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 +9 -9
- package/client/Dashboard.tsx +32 -32
- package/dist/index.js +1 -1
- package/lib/adapter.d.ts +11 -10
- package/lib/adapter.d.ts.map +1 -1
- package/lib/adapter.js +39 -38
- package/lib/adapter.js.map +1 -1
- package/lib/{bot.d.ts → endpoint.d.ts} +9 -7
- package/lib/endpoint.d.ts.map +1 -0
- package/lib/{bot.js → endpoint.js} +74 -47
- 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 +121 -114
- package/lib/index.js.map +1 -1
- package/lib/platform-permit.d.ts +19 -0
- package/lib/platform-permit.d.ts.map +1 -0
- package/lib/platform-permit.js +59 -0
- package/lib/platform-permit.js.map +1 -0
- package/lib/types.d.ts +3 -3
- package/lib/types.d.ts.map +1 -1
- package/package.json +13 -10
- package/skills/telegram/PERMITS.md +24 -0
- package/src/adapter.ts +31 -29
- package/src/{bot.ts → endpoint.ts} +85 -49
- package/src/index.ts +112 -100
- package/src/platform-permit.ts +73 -0
- package/src/types.ts +3 -3
- 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
|
# Changelog
|
|
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
|
@@ -12,12 +12,12 @@ pnpm add @zhin.js/adapter-telegram
|
|
|
12
12
|
|
|
13
13
|
| 要求 | 说明 |
|
|
14
14
|
|------|------|
|
|
15
|
-
| **Bot Token** | 通过 [@BotFather](https://t.me/botfather) 创建
|
|
15
|
+
| **Bot Token** | 通过 [@BotFather](https://t.me/botfather) 创建 Endpoint 并获取 Token |
|
|
16
16
|
| **Polling(默认)** | 本地开发无需公网 IP;`polling: true`(默认) |
|
|
17
17
|
| **Webhook(可选)** | 生产环境:`polling: false` + 公网 **HTTPS** 域名与有效 TLS;Telegraf 在 `webhook.port` 监听 |
|
|
18
18
|
| **host-router** | 不需要;本适配器自行处理 polling / webhook |
|
|
19
19
|
|
|
20
|
-
必填字段见 `
|
|
20
|
+
必填字段见 `TelegramEndpointConfig`:`context`、`name`、`token`;`polling` 默认为 `true`。
|
|
21
21
|
|
|
22
22
|
## Minimal configuration
|
|
23
23
|
|
|
@@ -25,7 +25,7 @@ pnpm add @zhin.js/adapter-telegram
|
|
|
25
25
|
plugins:
|
|
26
26
|
- "@zhin.js/adapter-telegram"
|
|
27
27
|
|
|
28
|
-
|
|
28
|
+
endpoints:
|
|
29
29
|
- context: telegram
|
|
30
30
|
name: my-telegram-bot
|
|
31
31
|
token: "${TELEGRAM_TOKEN}"
|
|
@@ -42,7 +42,7 @@ bots:
|
|
|
42
42
|
plugins:
|
|
43
43
|
- "@zhin.js/adapter-telegram"
|
|
44
44
|
|
|
45
|
-
|
|
45
|
+
endpoints:
|
|
46
46
|
- context: telegram
|
|
47
47
|
name: my-telegram-bot
|
|
48
48
|
token: "${TELEGRAM_TOKEN}"
|
|
@@ -54,7 +54,7 @@ bots:
|
|
|
54
54
|
设置 `polling: false` 并配置 `webhook` 对象;Telegraf 在 `webhook.port` 上启动 HTTPS 服务:
|
|
55
55
|
|
|
56
56
|
```yaml
|
|
57
|
-
|
|
57
|
+
endpoints:
|
|
58
58
|
- context: telegram
|
|
59
59
|
name: my-telegram-bot
|
|
60
60
|
token: "${TELEGRAM_TOKEN}"
|
|
@@ -82,7 +82,7 @@ TypeScript 等价配置:
|
|
|
82
82
|
import { defineConfig } from 'zhin.js'
|
|
83
83
|
|
|
84
84
|
export default defineConfig({
|
|
85
|
-
|
|
85
|
+
endpoints: [
|
|
86
86
|
{
|
|
87
87
|
name: 'my-telegram-bot',
|
|
88
88
|
context: 'telegram',
|
|
@@ -107,7 +107,7 @@ export default defineConfig({
|
|
|
107
107
|
- ✅ Long polling and webhook modes
|
|
108
108
|
- ✅ Private and group chats
|
|
109
109
|
|
|
110
|
-
## Getting Your
|
|
110
|
+
## Getting Your Endpoint Token
|
|
111
111
|
|
|
112
112
|
1. Talk to [@BotFather](https://t.me/botfather) on Telegram
|
|
113
113
|
2. Send `/newbot` and follow the instructions
|
|
@@ -170,10 +170,10 @@ You can send files using:
|
|
|
170
170
|
|
|
171
171
|
| 现象 | 排查 |
|
|
172
172
|
|------|------|
|
|
173
|
-
|
|
|
173
|
+
| Endpoint 无响应 / 收不到消息 | 确认 Token 正确;进程已启动;私聊 Endpoint 或将其加入群组 |
|
|
174
174
|
| Polling 报错 | 检查网络能否访问 `api.telegram.org`;同一 Token 勿多进程同时 polling |
|
|
175
175
|
| Webhook 不工作 | `webhook.domain` 须为 Telegram 可访问的 `https://`;放行 `webhook.port`;BotFather 或 launch 时注册 URL |
|
|
176
|
-
| 发送失败 | Token revoked 或
|
|
176
|
+
| 发送失败 | Token revoked 或 Endpoint 被限制;查看日志中的 Telegraf 错误 |
|
|
177
177
|
|
|
178
178
|
## Documentation
|
|
179
179
|
|
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, Link2, BarChart3, ShieldCheck, Plus, X } from 'lucide-react'
|
|
4
4
|
|
|
5
|
-
interface
|
|
5
|
+
interface EndpointRow {
|
|
6
6
|
name: string
|
|
7
7
|
connected: boolean
|
|
8
8
|
mode: string
|
|
@@ -20,14 +20,14 @@ interface Admin {
|
|
|
20
20
|
type Tab = 'overview' | 'actions'
|
|
21
21
|
|
|
22
22
|
export default function TelegramDashboard() {
|
|
23
|
-
const [
|
|
23
|
+
const [endpoints, setEndpoints] = useState<EndpointRow[]>([])
|
|
24
24
|
const [loading, setLoading] = useState(true)
|
|
25
25
|
const [error, setError] = useState('')
|
|
26
26
|
const [tab, setTab] = useState<Tab>('overview')
|
|
27
27
|
const [actionLoading, setActionLoading] = useState<Record<string, boolean>>({})
|
|
28
28
|
|
|
29
29
|
// Quick actions state
|
|
30
|
-
const [
|
|
30
|
+
const [selectedEndpoint, setSelectedEndpoint] = useState('')
|
|
31
31
|
const [chatId, setChatId] = useState('')
|
|
32
32
|
const [inviteResult, setInviteResult] = useState('')
|
|
33
33
|
const [admins, setAdmins] = useState<Admin[]>([])
|
|
@@ -45,9 +45,9 @@ export default function TelegramDashboard() {
|
|
|
45
45
|
setLoading(true)
|
|
46
46
|
setError('')
|
|
47
47
|
try {
|
|
48
|
-
const res = await apiFetch('/api/telegram/
|
|
48
|
+
const res = await apiFetch('/api/telegram/endpoints')
|
|
49
49
|
const json = await res.json()
|
|
50
|
-
if (json.success)
|
|
50
|
+
if (json.success) setEndpoints(json.data)
|
|
51
51
|
else setError(json.error || '获取数据失败')
|
|
52
52
|
} catch {
|
|
53
53
|
setError('无法连接服务器')
|
|
@@ -62,7 +62,7 @@ export default function TelegramDashboard() {
|
|
|
62
62
|
setActionLoading(prev => ({ ...prev, [name]: true }))
|
|
63
63
|
try {
|
|
64
64
|
const endpoint = connected ? 'disconnect' : 'connect'
|
|
65
|
-
const res = await apiFetch(`/api/telegram/
|
|
65
|
+
const res = await apiFetch(`/api/telegram/endpoints/${encodeURIComponent(name)}/${endpoint}`, { method: 'POST' })
|
|
66
66
|
const json = await res.json()
|
|
67
67
|
if (!json.success) setError(json.error || '操作失败')
|
|
68
68
|
await fetchData()
|
|
@@ -74,10 +74,10 @@ export default function TelegramDashboard() {
|
|
|
74
74
|
}
|
|
75
75
|
|
|
76
76
|
const createInvite = async () => {
|
|
77
|
-
if (!
|
|
77
|
+
if (!selectedEndpoint || !chatId) return
|
|
78
78
|
setInviteResult('')
|
|
79
79
|
try {
|
|
80
|
-
const res = await apiFetch(`/api/telegram/
|
|
80
|
+
const res = await apiFetch(`/api/telegram/endpoints/${encodeURIComponent(selectedEndpoint)}/invite`, {
|
|
81
81
|
method: 'POST',
|
|
82
82
|
headers: { 'Content-Type': 'application/json' },
|
|
83
83
|
body: JSON.stringify({ chat_id: chatId }),
|
|
@@ -91,11 +91,11 @@ export default function TelegramDashboard() {
|
|
|
91
91
|
}
|
|
92
92
|
|
|
93
93
|
const fetchAdmins = async () => {
|
|
94
|
-
if (!
|
|
94
|
+
if (!selectedEndpoint || !chatId) return
|
|
95
95
|
setAdminsLoading(true)
|
|
96
96
|
setAdmins([])
|
|
97
97
|
try {
|
|
98
|
-
const res = await apiFetch(`/api/telegram/
|
|
98
|
+
const res = await apiFetch(`/api/telegram/endpoints/${encodeURIComponent(selectedEndpoint)}/admins?chat_id=${encodeURIComponent(chatId)}`)
|
|
99
99
|
const json = await res.json()
|
|
100
100
|
if (json.success && Array.isArray(json.data)) setAdmins(json.data)
|
|
101
101
|
else setError(json.error || '获取管理员失败')
|
|
@@ -107,13 +107,13 @@ export default function TelegramDashboard() {
|
|
|
107
107
|
}
|
|
108
108
|
|
|
109
109
|
const sendPoll = async () => {
|
|
110
|
-
if (!
|
|
110
|
+
if (!selectedEndpoint || !chatId || !pollQuestion) return
|
|
111
111
|
const validOptions = pollOptions.filter(o => o.trim())
|
|
112
112
|
if (validOptions.length < 2) { setError('至少需要 2 个选项'); return }
|
|
113
113
|
setPollLoading(true)
|
|
114
114
|
setPollResult('')
|
|
115
115
|
try {
|
|
116
|
-
const res = await apiFetch(`/api/telegram/
|
|
116
|
+
const res = await apiFetch(`/api/telegram/endpoints/${encodeURIComponent(selectedEndpoint)}/poll`, {
|
|
117
117
|
method: 'POST',
|
|
118
118
|
headers: { 'Content-Type': 'application/json' },
|
|
119
119
|
body: JSON.stringify({ chat_id: chatId, question: pollQuestion, options: validOptions, is_anonymous: pollAnonymous, allows_multiple: pollMultiple }),
|
|
@@ -128,7 +128,7 @@ export default function TelegramDashboard() {
|
|
|
128
128
|
}
|
|
129
129
|
}
|
|
130
130
|
|
|
131
|
-
const
|
|
131
|
+
const onlineEndpoints = endpoints.filter((e) => e.connected)
|
|
132
132
|
|
|
133
133
|
return (
|
|
134
134
|
<div className="p-6 max-w-5xl mx-auto">
|
|
@@ -162,30 +162,30 @@ export default function TelegramDashboard() {
|
|
|
162
162
|
{/* Overview Tab */}
|
|
163
163
|
{tab === 'overview' && (
|
|
164
164
|
<>
|
|
165
|
-
{!loading && !
|
|
166
|
-
<div className="text-center text-gray-500 py-12">暂无 Telegram
|
|
165
|
+
{!loading && !endpoints.length && !error && (
|
|
166
|
+
<div className="text-center text-gray-500 py-12">暂无 Telegram Endpoint 实例</div>
|
|
167
167
|
)}
|
|
168
168
|
<div className="grid gap-4 md:grid-cols-2">
|
|
169
|
-
{
|
|
170
|
-
<div key={
|
|
169
|
+
{endpoints.map((endpoint) => (
|
|
170
|
+
<div key={endpoint.name} className="border rounded-lg p-4 bg-card shadow-sm">
|
|
171
171
|
<div className="flex items-center justify-between mb-3">
|
|
172
|
-
<span className="font-medium text-lg">{
|
|
173
|
-
{
|
|
172
|
+
<span className="font-medium text-lg">{endpoint.name}</span>
|
|
173
|
+
{endpoint.connected
|
|
174
174
|
? <span className="flex items-center gap-1 text-green-600 text-sm"><Wifi className="w-4 h-4" /> 在线</span>
|
|
175
175
|
: <span className="flex items-center gap-1 text-gray-400 text-sm"><WifiOff className="w-4 h-4" /> 离线</span>}
|
|
176
176
|
</div>
|
|
177
|
-
{
|
|
177
|
+
{endpoint.botInfo && <div className="text-sm text-gray-500 mb-2">@{endpoint.botInfo.username} ({endpoint.botInfo.firstName})</div>}
|
|
178
178
|
<div className="text-sm text-gray-600 mb-3">
|
|
179
|
-
<div className="flex justify-between"><span>模式</span><span className="font-mono">{
|
|
179
|
+
<div className="flex justify-between"><span>模式</span><span className="font-mono">{endpoint.mode}</span></div>
|
|
180
180
|
</div>
|
|
181
181
|
<button
|
|
182
|
-
onClick={() => toggleConnect(
|
|
183
|
-
disabled={actionLoading[
|
|
184
|
-
className={`flex items-center gap-1 px-3 py-1.5 rounded text-sm text-white ${
|
|
185
|
-
{actionLoading[
|
|
182
|
+
onClick={() => toggleConnect(endpoint.name, endpoint.connected)}
|
|
183
|
+
disabled={actionLoading[endpoint.name]}
|
|
184
|
+
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`}>
|
|
185
|
+
{actionLoading[endpoint.name]
|
|
186
186
|
? <Loader2 className="w-3.5 h-3.5 animate-spin" />
|
|
187
|
-
:
|
|
188
|
-
{
|
|
187
|
+
: endpoint.connected ? <PowerOff className="w-3.5 h-3.5" /> : <Power className="w-3.5 h-3.5" />}
|
|
188
|
+
{endpoint.connected ? '断开' : '连接'}
|
|
189
189
|
</button>
|
|
190
190
|
</div>
|
|
191
191
|
))}
|
|
@@ -196,14 +196,14 @@ export default function TelegramDashboard() {
|
|
|
196
196
|
{/* Quick Actions Tab */}
|
|
197
197
|
{tab === 'actions' && (
|
|
198
198
|
<div className="space-y-6">
|
|
199
|
-
{/*
|
|
199
|
+
{/* Endpoint + Chat selector */}
|
|
200
200
|
<div className="flex flex-wrap items-end gap-3">
|
|
201
201
|
<div>
|
|
202
202
|
<label className="block text-xs text-gray-500 mb-1">机器人</label>
|
|
203
|
-
<select value={
|
|
203
|
+
<select value={selectedEndpoint} onChange={(e) => setSelectedEndpoint(e.target.value)}
|
|
204
204
|
className="border rounded px-2 py-1.5 text-sm min-w-[140px]">
|
|
205
205
|
<option value="">--</option>
|
|
206
|
-
{
|
|
206
|
+
{onlineEndpoints.map((e) => <option key={e.name} value={e.name}>{e.name}</option>)}
|
|
207
207
|
</select>
|
|
208
208
|
</div>
|
|
209
209
|
<div>
|
|
@@ -213,9 +213,9 @@ export default function TelegramDashboard() {
|
|
|
213
213
|
</div>
|
|
214
214
|
</div>
|
|
215
215
|
|
|
216
|
-
{!
|
|
216
|
+
{!onlineEndpoints.length && <div className="text-center text-gray-500 py-4">暂无在线 Endpoint</div>}
|
|
217
217
|
|
|
218
|
-
{
|
|
218
|
+
{selectedEndpoint && chatId && (
|
|
219
219
|
<div className="grid gap-4 md:grid-cols-2">
|
|
220
220
|
{/* Invite Link */}
|
|
221
221
|
<div className="border rounded-lg p-4 bg-card shadow-sm">
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{useEffect as He,useState as r,useCallback as Ge}from"react";var oe="zhin_api_token",xe="zhin_api_base";function Ce(){let o=localStorage.getItem(xe)?.trim();return o?o.replace(/\/$/,""):typeof window<"u"?window.location.origin:""}function he(){return localStorage.getItem(oe)}async function g(o,l){let f=he(),i=new Headers(l?.headers);f&&i.set("Authorization",`Bearer ${f}`);let L=Ce(),s=typeof o=="string"&&o.startsWith("/")?`${L}${o}`:o,I=await fetch(s,{...l,headers:i});return I.status===401&&(localStorage.removeItem(oe),window.dispatchEvent(new CustomEvent("zhin:auth-required"))),I}import{forwardRef as Pe,createElement as Ae}from"react";var G=(...o)=>o.filter((l,f,i)=>!!l&&l.trim()!==""&&i.indexOf(l)===f).join(" ").trim();var ue=o=>o.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();var de=o=>o.replace(/^([A-Z])|[\s-_]+(\w)/g,(l,f,i)=>i?i.toUpperCase():f.toLowerCase());var z=o=>{let l=de(o);return l.charAt(0).toUpperCase()+l.slice(1)};import{forwardRef as we,createElement as fe}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 le=o=>{for(let l in o)if(l.startsWith("aria-")||l==="role"||l==="title")return!0;return!1};import{createContext as ge,useContext as Se,useMemo as Je,createElement as je}from"react";var ke=ge({});var se=()=>Se(ke);var re=we(({color:o,size:l,strokeWidth:f,absoluteStrokeWidth:i,className:L="",children:s,iconNode:I,...k},q)=>{let{size:C=24,strokeWidth:n=2,absoluteStrokeWidth:V=!1,color:p="currentColor",className:E=""}=se()??{},w=i??V?Number(f??n)*24/Number(l??C):f??n;return fe("svg",{ref:q,...W,width:l??C??W.width,height:l??C??W.height,stroke:o??p,strokeWidth:w,className:G("lucide",E,L),...!s&&!le(k)&&{"aria-hidden":"true"},...k},[...I.map(([v,U])=>fe(v,U)),...Array.isArray(s)?s:[s]])});var u=(o,l)=>{let f=Pe(({className:i,...L},s)=>Ae(re,{ref:s,iconNode:l,className:G(`lucide-${ue(z(o))}`,`lucide-${o}`,i),...L}));return f.displayName=z(o),f};var Be=[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]],x=u("chart-column",Be);var Me=[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]],A=u("link-2",Me);var Fe=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],m=u("loader-circle",Fe);var De=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],B=u("plus",De);var ye=[["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"}]],M=u("power-off",ye);var Re=[["path",{d:"M12 2v10",key:"mnfbl"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04",key:"obofu9"}]],F=u("power",Re);var Te=[["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"}]],D=u("refresh-cw",Te);var be=[["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"}]],y=u("server",be);var qe=[["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"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],R=u("shield-check",qe);var ve=[["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"}]],T=u("wifi-off",ve);var Ue=[["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"}]],b=u("wifi",Ue);var Oe=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],S=u("x",Oe);import{Fragment as We,jsx as a,jsxs as t}from"react/jsx-runtime";function X(){let[o,l]=r([]),[f,i]=r(!0),[L,s]=r(""),[I,k]=r("overview"),[q,C]=r({}),[n,V]=r(""),[p,E]=r(""),[w,v]=r(""),[U,K]=r([]),[Z,Q]=r(!1),[O,ie]=r(""),[h,N]=r(["",""]),[_,ce]=r(!0),[J,ne]=r(!1),[j,$]=r(""),[Y,ee]=r(!1),H=Ge(async()=>{i(!0),s("");try{let d=await(await g("/api/telegram/bots")).json();d.success?l(d.data):s(d.error||"\u83B7\u53D6\u6570\u636E\u5931\u8D25")}catch{s("\u65E0\u6CD5\u8FDE\u63A5\u670D\u52A1\u5668")}finally{i(!1)}},[]);He(()=>{H()},[H]);let pe=async(e,d)=>{C(c=>({...c,[e]:!0}));try{let c=d?"disconnect":"connect",te=await(await g(`/api/telegram/bots/${encodeURIComponent(e)}/${c}`,{method:"POST"})).json();te.success||s(te.error||"\u64CD\u4F5C\u5931\u8D25"),await H()}catch{s("\u64CD\u4F5C\u5931\u8D25")}finally{C(c=>({...c,[e]:!1}))}},me=async()=>{if(!(!n||!p)){v("");try{let d=await(await g(`/api/telegram/bots/${encodeURIComponent(n)}/invite`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({chat_id:p})})).json();d.success&&d.data?.invite_link?v(d.data.invite_link):s(d.error||"\u521B\u5EFA\u5931\u8D25")}catch{s("\u521B\u5EFA\u9080\u8BF7\u94FE\u63A5\u5931\u8D25")}}},Le=async()=>{if(!(!n||!p)){Q(!0),K([]);try{let d=await(await g(`/api/telegram/bots/${encodeURIComponent(n)}/admins?chat_id=${encodeURIComponent(p)}`)).json();d.success&&Array.isArray(d.data)?K(d.data):s(d.error||"\u83B7\u53D6\u7BA1\u7406\u5458\u5931\u8D25")}catch{s("\u83B7\u53D6\u7BA1\u7406\u5458\u5931\u8D25")}finally{Q(!1)}}},Ie=async()=>{if(!n||!p||!O)return;let e=h.filter(d=>d.trim());if(e.length<2){s("\u81F3\u5C11\u9700\u8981 2 \u4E2A\u9009\u9879");return}ee(!0),$("");try{let c=await(await g(`/api/telegram/bots/${encodeURIComponent(n)}/poll`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({chat_id:p,question:O,options:e,is_anonymous:_,allows_multiple:J})})).json();c.success?$(`\u6295\u7968\u5DF2\u53D1\u9001 (ID: ${c.data?.message_id??"\u672A\u77E5"})`):s(c.error||"\u53D1\u9001\u5931\u8D25")}catch{s("\u53D1\u9001\u6295\u7968\u5931\u8D25")}finally{ee(!1)}},ae=o.filter(e=>e.connected);return t("div",{className:"p-6 max-w-5xl mx-auto",children:[t("div",{className:"flex items-center justify-between mb-6",children:[t("h1",{className:"text-2xl font-bold flex items-center gap-2",children:[a(y,{className:"w-6 h-6"})," Telegram \u673A\u5668\u4EBA"]}),t("button",{onClick:H,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(D,{className:`w-4 h-4 ${f?"animate-spin":""}`})," \u5237\u65B0"]})]}),L&&t("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:L}),a("button",{onClick:()=>s(""),className:"text-red-400 hover:text-red-600",children:a(S,{className:"w-4 h-4"})})]}),t("div",{className:"flex gap-1 mb-6 border-b",children:[a("button",{onClick:()=>k("overview"),className:`px-4 py-2 text-sm font-medium border-b-2 transition-colors ${I==="overview"?"border-sky-500 text-sky-600":"border-transparent text-gray-500 hover:text-gray-700"}`,children:"\u6982\u89C8"}),a("button",{onClick:()=>k("actions"),className:`px-4 py-2 text-sm font-medium border-b-2 transition-colors ${I==="actions"?"border-sky-500 text-sky-600":"border-transparent text-gray-500 hover:text-gray-700"}`,children:"\u5FEB\u6377\u64CD\u4F5C"})]}),I==="overview"&&t(We,{children:[!f&&!o.length&&!L&&a("div",{className:"text-center text-gray-500 py-12",children:"\u6682\u65E0 Telegram \u673A\u5668\u4EBA\u5B9E\u4F8B"}),a("div",{className:"grid gap-4 md:grid-cols-2",children:o.map(e=>t("div",{className:"border rounded-lg p-4 bg-card shadow-sm",children:[t("div",{className:"flex items-center justify-between mb-3",children:[a("span",{className:"font-medium text-lg",children:e.name}),e.connected?t("span",{className:"flex items-center gap-1 text-green-600 text-sm",children:[a(b,{className:"w-4 h-4"})," \u5728\u7EBF"]}):t("span",{className:"flex items-center gap-1 text-gray-400 text-sm",children:[a(T,{className:"w-4 h-4"})," \u79BB\u7EBF"]})]}),e.botInfo&&t("div",{className:"text-sm text-gray-500 mb-2",children:["@",e.botInfo.username," (",e.botInfo.firstName,")"]}),a("div",{className:"text-sm text-gray-600 mb-3",children:t("div",{className:"flex justify-between",children:[a("span",{children:"\u6A21\u5F0F"}),a("span",{className:"font-mono",children:e.mode})]})}),t("button",{onClick:()=>pe(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(m,{className:"w-3.5 h-3.5 animate-spin"}):e.connected?a(M,{className:"w-3.5 h-3.5"}):a(F,{className:"w-3.5 h-3.5"}),e.connected?"\u65AD\u5F00":"\u8FDE\u63A5"]})]},e.name))})]}),I==="actions"&&t("div",{className:"space-y-6",children:[t("div",{className:"flex flex-wrap items-end gap-3",children:[t("div",{children:[a("label",{className:"block text-xs text-gray-500 mb-1",children:"\u673A\u5668\u4EBA"}),t("select",{value:n,onChange:e=>V(e.target.value),className:"border rounded px-2 py-1.5 text-sm min-w-[140px]",children:[a("option",{value:"",children:"--"}),ae.map(e=>a("option",{value:e.name,children:e.name},e.name))]})]}),t("div",{children:[a("label",{className:"block text-xs text-gray-500 mb-1",children:"Chat ID"}),a("input",{value:p,onChange:e=>E(e.target.value),placeholder:"-100xxxxxxxxxx",className:"border rounded px-2 py-1.5 text-sm w-[180px]"})]})]}),!ae.length&&a("div",{className:"text-center text-gray-500 py-4",children:"\u6682\u65E0\u5728\u7EBF\u673A\u5668\u4EBA"}),n&&p&&t("div",{className:"grid gap-4 md:grid-cols-2",children:[t("div",{className:"border rounded-lg p-4 bg-card shadow-sm",children:[t("h3",{className:"font-medium flex items-center gap-2 mb-3",children:[a(A,{className:"w-4 h-4 text-sky-500"})," \u521B\u5EFA\u9080\u8BF7\u94FE\u63A5"]}),a("button",{onClick:me,className:"px-3 py-1.5 rounded bg-sky-500 text-white text-sm hover:bg-sky-600",children:"\u751F\u6210\u94FE\u63A5"}),w&&a("div",{className:"mt-2 p-2 bg-gray-50 rounded text-sm break-all",children:a("a",{href:w,target:"_blank",rel:"noreferrer",className:"text-sky-600 hover:underline",children:w})})]}),t("div",{className:"border rounded-lg p-4 bg-card shadow-sm",children:[t("h3",{className:"font-medium flex items-center gap-2 mb-3",children:[a(R,{className:"w-4 h-4 text-sky-500"})," \u7BA1\u7406\u5458\u5217\u8868"]}),t("button",{onClick:Le,disabled:Z,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:[Z&&a(m,{className:"w-3.5 h-3.5 animate-spin"})," \u67E5\u8BE2"]}),U.length>0&&a("div",{className:"mt-2 space-y-1",children:U.map(e=>t("div",{className:"flex items-center justify-between text-sm py-1 border-b last:border-0",children:[t("span",{children:[e.first_name," ",e.username?`(@${e.username})`:""]}),a("span",{className:"text-xs text-gray-400",children:e.status})]},e.user_id))})]}),t("div",{className:"border rounded-lg p-4 bg-card shadow-sm md:col-span-2",children:[t("h3",{className:"font-medium flex items-center gap-2 mb-3",children:[a(x,{className:"w-4 h-4 text-sky-500"})," \u53D1\u8D77\u6295\u7968"]}),t("div",{className:"space-y-2",children:[a("input",{value:O,onChange:e=>ie(e.target.value),placeholder:"\u6295\u7968\u95EE\u9898",className:"border rounded px-2 py-1.5 text-sm w-full"}),h.map((e,d)=>t("div",{className:"flex items-center gap-2",children:[a("input",{value:e,onChange:c=>{let P=[...h];P[d]=c.target.value,N(P)},placeholder:`\u9009\u9879 ${d+1}`,className:"border rounded px-2 py-1.5 text-sm flex-1"}),h.length>2&&a("button",{onClick:()=>N(h.filter((c,P)=>P!==d)),className:"text-gray-400 hover:text-red-500",children:a(S,{className:"w-4 h-4"})})]},d)),t("button",{onClick:()=>N([...h,""]),className:"flex items-center gap-1 text-sm text-sky-500 hover:text-sky-600",children:[a(B,{className:"w-3.5 h-3.5"})," \u6DFB\u52A0\u9009\u9879"]}),t("div",{className:"flex items-center gap-4 text-sm text-gray-600",children:[t("label",{className:"flex items-center gap-1",children:[a("input",{type:"checkbox",checked:_,onChange:e=>ce(e.target.checked)})," \u533F\u540D"]}),t("label",{className:"flex items-center gap-1",children:[a("input",{type:"checkbox",checked:J,onChange:e=>ne(e.target.checked)})," \u591A\u9009"]})]}),t("button",{onClick:Ie,disabled:Y||!O,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:[Y&&a(m,{className:"w-3.5 h-3.5 animate-spin"})," \u53D1\u9001\u6295\u7968"]}),j&&a("div",{className:"text-sm text-green-600",children:j})]})]})]})]})]})}function et(o){o.addRoute({path:"/telegram",name:"Telegram",element:o.React.createElement(X,{hostReact:o.React})}),o.addTool({id:"telegram",name:"Telegram",path:"/telegram"})}export{et as register};
|
|
1
|
+
import{useEffect as He,useState as r,useCallback as Ge}from"react";var oe="zhin_api_token",xe="zhin_api_base";function Ce(){let o=localStorage.getItem(xe)?.trim();return o?o.replace(/\/$/,""):typeof window<"u"?window.location.origin:""}function he(){return localStorage.getItem(oe)}async function g(o,l){let f=he(),i=new Headers(l?.headers);f&&i.set("Authorization",`Bearer ${f}`);let L=Ce(),s=typeof o=="string"&&o.startsWith("/")?`${L}${o}`:o,I=await fetch(s,{...l,headers:i});return I.status===401&&(localStorage.removeItem(oe),window.dispatchEvent(new CustomEvent("zhin:auth-required"))),I}import{forwardRef as Pe,createElement as Ae}from"react";var G=(...o)=>o.filter((l,f,i)=>!!l&&l.trim()!==""&&i.indexOf(l)===f).join(" ").trim();var ue=o=>o.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();var de=o=>o.replace(/^([A-Z])|[\s-_]+(\w)/g,(l,f,i)=>i?i.toUpperCase():f.toLowerCase());var z=o=>{let l=de(o);return l.charAt(0).toUpperCase()+l.slice(1)};import{forwardRef as we,createElement as fe}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 le=o=>{for(let l in o)if(l.startsWith("aria-")||l==="role"||l==="title")return!0;return!1};import{createContext as ge,useContext as Se,useMemo as Je,createElement as je}from"react";var ke=ge({});var se=()=>Se(ke);var re=we(({color:o,size:l,strokeWidth:f,absoluteStrokeWidth:i,className:L="",children:s,iconNode:I,...k},q)=>{let{size:C=24,strokeWidth:n=2,absoluteStrokeWidth:E=!1,color:p="currentColor",className:V=""}=se()??{},w=i??E?Number(f??n)*24/Number(l??C):f??n;return fe("svg",{ref:q,...W,width:l??C??W.width,height:l??C??W.height,stroke:o??p,strokeWidth:w,className:G("lucide",V,L),...!s&&!le(k)&&{"aria-hidden":"true"},...k},[...I.map(([v,U])=>fe(v,U)),...Array.isArray(s)?s:[s]])});var u=(o,l)=>{let f=Pe(({className:i,...L},s)=>Ae(re,{ref:s,iconNode:l,className:G(`lucide-${ue(z(o))}`,`lucide-${o}`,i),...L}));return f.displayName=z(o),f};var Be=[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]],x=u("chart-column",Be);var Me=[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]],A=u("link-2",Me);var Fe=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],m=u("loader-circle",Fe);var De=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],B=u("plus",De);var ye=[["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"}]],M=u("power-off",ye);var Re=[["path",{d:"M12 2v10",key:"mnfbl"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04",key:"obofu9"}]],F=u("power",Re);var be=[["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"}]],D=u("refresh-cw",be);var Te=[["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"}]],y=u("server",Te);var qe=[["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"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],R=u("shield-check",qe);var ve=[["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=u("wifi-off",ve);var Ue=[["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"}]],T=u("wifi",Ue);var Oe=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],S=u("x",Oe);import{Fragment as We,jsx as a,jsxs as t}from"react/jsx-runtime";function X(){let[o,l]=r([]),[f,i]=r(!0),[L,s]=r(""),[I,k]=r("overview"),[q,C]=r({}),[n,E]=r(""),[p,V]=r(""),[w,v]=r(""),[U,K]=r([]),[Z,Q]=r(!1),[O,ie]=r(""),[h,N]=r(["",""]),[_,ce]=r(!0),[J,ne]=r(!1),[j,$]=r(""),[Y,ee]=r(!1),H=Ge(async()=>{i(!0),s("");try{let d=await(await g("/api/telegram/endpoints")).json();d.success?l(d.data):s(d.error||"\u83B7\u53D6\u6570\u636E\u5931\u8D25")}catch{s("\u65E0\u6CD5\u8FDE\u63A5\u670D\u52A1\u5668")}finally{i(!1)}},[]);He(()=>{H()},[H]);let pe=async(e,d)=>{C(c=>({...c,[e]:!0}));try{let c=d?"disconnect":"connect",te=await(await g(`/api/telegram/endpoints/${encodeURIComponent(e)}/${c}`,{method:"POST"})).json();te.success||s(te.error||"\u64CD\u4F5C\u5931\u8D25"),await H()}catch{s("\u64CD\u4F5C\u5931\u8D25")}finally{C(c=>({...c,[e]:!1}))}},me=async()=>{if(!(!n||!p)){v("");try{let d=await(await g(`/api/telegram/endpoints/${encodeURIComponent(n)}/invite`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({chat_id:p})})).json();d.success&&d.data?.invite_link?v(d.data.invite_link):s(d.error||"\u521B\u5EFA\u5931\u8D25")}catch{s("\u521B\u5EFA\u9080\u8BF7\u94FE\u63A5\u5931\u8D25")}}},Le=async()=>{if(!(!n||!p)){Q(!0),K([]);try{let d=await(await g(`/api/telegram/endpoints/${encodeURIComponent(n)}/admins?chat_id=${encodeURIComponent(p)}`)).json();d.success&&Array.isArray(d.data)?K(d.data):s(d.error||"\u83B7\u53D6\u7BA1\u7406\u5458\u5931\u8D25")}catch{s("\u83B7\u53D6\u7BA1\u7406\u5458\u5931\u8D25")}finally{Q(!1)}}},Ie=async()=>{if(!n||!p||!O)return;let e=h.filter(d=>d.trim());if(e.length<2){s("\u81F3\u5C11\u9700\u8981 2 \u4E2A\u9009\u9879");return}ee(!0),$("");try{let c=await(await g(`/api/telegram/endpoints/${encodeURIComponent(n)}/poll`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({chat_id:p,question:O,options:e,is_anonymous:_,allows_multiple:J})})).json();c.success?$(`\u6295\u7968\u5DF2\u53D1\u9001 (ID: ${c.data?.message_id??"\u672A\u77E5"})`):s(c.error||"\u53D1\u9001\u5931\u8D25")}catch{s("\u53D1\u9001\u6295\u7968\u5931\u8D25")}finally{ee(!1)}},ae=o.filter(e=>e.connected);return t("div",{className:"p-6 max-w-5xl mx-auto",children:[t("div",{className:"flex items-center justify-between mb-6",children:[t("h1",{className:"text-2xl font-bold flex items-center gap-2",children:[a(y,{className:"w-6 h-6"})," Telegram \u673A\u5668\u4EBA"]}),t("button",{onClick:H,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(D,{className:`w-4 h-4 ${f?"animate-spin":""}`})," \u5237\u65B0"]})]}),L&&t("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:L}),a("button",{onClick:()=>s(""),className:"text-red-400 hover:text-red-600",children:a(S,{className:"w-4 h-4"})})]}),t("div",{className:"flex gap-1 mb-6 border-b",children:[a("button",{onClick:()=>k("overview"),className:`px-4 py-2 text-sm font-medium border-b-2 transition-colors ${I==="overview"?"border-sky-500 text-sky-600":"border-transparent text-gray-500 hover:text-gray-700"}`,children:"\u6982\u89C8"}),a("button",{onClick:()=>k("actions"),className:`px-4 py-2 text-sm font-medium border-b-2 transition-colors ${I==="actions"?"border-sky-500 text-sky-600":"border-transparent text-gray-500 hover:text-gray-700"}`,children:"\u5FEB\u6377\u64CD\u4F5C"})]}),I==="overview"&&t(We,{children:[!f&&!o.length&&!L&&a("div",{className:"text-center text-gray-500 py-12",children:"\u6682\u65E0 Telegram Endpoint \u5B9E\u4F8B"}),a("div",{className:"grid gap-4 md:grid-cols-2",children:o.map(e=>t("div",{className:"border rounded-lg p-4 bg-card shadow-sm",children:[t("div",{className:"flex items-center justify-between mb-3",children:[a("span",{className:"font-medium text-lg",children:e.name}),e.connected?t("span",{className:"flex items-center gap-1 text-green-600 text-sm",children:[a(T,{className:"w-4 h-4"})," \u5728\u7EBF"]}):t("span",{className:"flex items-center gap-1 text-gray-400 text-sm",children:[a(b,{className:"w-4 h-4"})," \u79BB\u7EBF"]})]}),e.botInfo&&t("div",{className:"text-sm text-gray-500 mb-2",children:["@",e.botInfo.username," (",e.botInfo.firstName,")"]}),a("div",{className:"text-sm text-gray-600 mb-3",children:t("div",{className:"flex justify-between",children:[a("span",{children:"\u6A21\u5F0F"}),a("span",{className:"font-mono",children:e.mode})]})}),t("button",{onClick:()=>pe(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(m,{className:"w-3.5 h-3.5 animate-spin"}):e.connected?a(M,{className:"w-3.5 h-3.5"}):a(F,{className:"w-3.5 h-3.5"}),e.connected?"\u65AD\u5F00":"\u8FDE\u63A5"]})]},e.name))})]}),I==="actions"&&t("div",{className:"space-y-6",children:[t("div",{className:"flex flex-wrap items-end gap-3",children:[t("div",{children:[a("label",{className:"block text-xs text-gray-500 mb-1",children:"\u673A\u5668\u4EBA"}),t("select",{value:n,onChange:e=>E(e.target.value),className:"border rounded px-2 py-1.5 text-sm min-w-[140px]",children:[a("option",{value:"",children:"--"}),ae.map(e=>a("option",{value:e.name,children:e.name},e.name))]})]}),t("div",{children:[a("label",{className:"block text-xs text-gray-500 mb-1",children:"Chat ID"}),a("input",{value:p,onChange:e=>V(e.target.value),placeholder:"-100xxxxxxxxxx",className:"border rounded px-2 py-1.5 text-sm w-[180px]"})]})]}),!ae.length&&a("div",{className:"text-center text-gray-500 py-4",children:"\u6682\u65E0\u5728\u7EBF Endpoint"}),n&&p&&t("div",{className:"grid gap-4 md:grid-cols-2",children:[t("div",{className:"border rounded-lg p-4 bg-card shadow-sm",children:[t("h3",{className:"font-medium flex items-center gap-2 mb-3",children:[a(A,{className:"w-4 h-4 text-sky-500"})," \u521B\u5EFA\u9080\u8BF7\u94FE\u63A5"]}),a("button",{onClick:me,className:"px-3 py-1.5 rounded bg-sky-500 text-white text-sm hover:bg-sky-600",children:"\u751F\u6210\u94FE\u63A5"}),w&&a("div",{className:"mt-2 p-2 bg-gray-50 rounded text-sm break-all",children:a("a",{href:w,target:"_blank",rel:"noreferrer",className:"text-sky-600 hover:underline",children:w})})]}),t("div",{className:"border rounded-lg p-4 bg-card shadow-sm",children:[t("h3",{className:"font-medium flex items-center gap-2 mb-3",children:[a(R,{className:"w-4 h-4 text-sky-500"})," \u7BA1\u7406\u5458\u5217\u8868"]}),t("button",{onClick:Le,disabled:Z,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:[Z&&a(m,{className:"w-3.5 h-3.5 animate-spin"})," \u67E5\u8BE2"]}),U.length>0&&a("div",{className:"mt-2 space-y-1",children:U.map(e=>t("div",{className:"flex items-center justify-between text-sm py-1 border-b last:border-0",children:[t("span",{children:[e.first_name," ",e.username?`(@${e.username})`:""]}),a("span",{className:"text-xs text-gray-400",children:e.status})]},e.user_id))})]}),t("div",{className:"border rounded-lg p-4 bg-card shadow-sm md:col-span-2",children:[t("h3",{className:"font-medium flex items-center gap-2 mb-3",children:[a(x,{className:"w-4 h-4 text-sky-500"})," \u53D1\u8D77\u6295\u7968"]}),t("div",{className:"space-y-2",children:[a("input",{value:O,onChange:e=>ie(e.target.value),placeholder:"\u6295\u7968\u95EE\u9898",className:"border rounded px-2 py-1.5 text-sm w-full"}),h.map((e,d)=>t("div",{className:"flex items-center gap-2",children:[a("input",{value:e,onChange:c=>{let P=[...h];P[d]=c.target.value,N(P)},placeholder:`\u9009\u9879 ${d+1}`,className:"border rounded px-2 py-1.5 text-sm flex-1"}),h.length>2&&a("button",{onClick:()=>N(h.filter((c,P)=>P!==d)),className:"text-gray-400 hover:text-red-500",children:a(S,{className:"w-4 h-4"})})]},d)),t("button",{onClick:()=>N([...h,""]),className:"flex items-center gap-1 text-sm text-sky-500 hover:text-sky-600",children:[a(B,{className:"w-3.5 h-3.5"})," \u6DFB\u52A0\u9009\u9879"]}),t("div",{className:"flex items-center gap-4 text-sm text-gray-600",children:[t("label",{className:"flex items-center gap-1",children:[a("input",{type:"checkbox",checked:_,onChange:e=>ce(e.target.checked)})," \u533F\u540D"]}),t("label",{className:"flex items-center gap-1",children:[a("input",{type:"checkbox",checked:J,onChange:e=>ne(e.target.checked)})," \u591A\u9009"]})]}),t("button",{onClick:Ie,disabled:Y||!O,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:[Y&&a(m,{className:"w-3.5 h-3.5 animate-spin"})," \u53D1\u9001\u6295\u7968"]}),j&&a("div",{className:"text-sm text-green-600",children:j})]})]})]})]})]})}function et(o){o.addRoute({path:"/telegram",name:"Telegram",element:o.React.createElement(X,{hostReact:o.React})}),o.addTool({id:"telegram",name:"Telegram",path:"/telegram"})}export{et 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,17 +2,18 @@
|
|
|
2
2
|
* Telegram 适配器
|
|
3
3
|
*/
|
|
4
4
|
import { Adapter, Plugin } from "zhin.js";
|
|
5
|
-
import {
|
|
6
|
-
import type {
|
|
7
|
-
export declare class TelegramAdapter extends Adapter<
|
|
5
|
+
import { TelegramEndpoint } from "./endpoint.js";
|
|
6
|
+
import type { TelegramEndpointConfig } from "./types.js";
|
|
7
|
+
export declare class TelegramAdapter extends Adapter<TelegramEndpoint> {
|
|
8
|
+
static readonly capabilities: readonly ["inbound", "outbound"];
|
|
8
9
|
constructor(plugin: Plugin);
|
|
9
|
-
|
|
10
|
-
kickMember(
|
|
11
|
-
unbanMember(
|
|
12
|
-
muteMember(
|
|
13
|
-
setAdmin(
|
|
14
|
-
setGroupName(
|
|
15
|
-
getGroupInfo(
|
|
10
|
+
createEndpoint(config: TelegramEndpointConfig): TelegramEndpoint;
|
|
11
|
+
kickMember(endpointId: string, sceneId: string, userId: string): Promise<boolean>;
|
|
12
|
+
unbanMember(endpointId: string, sceneId: string, userId: string): Promise<boolean>;
|
|
13
|
+
muteMember(endpointId: string, sceneId: string, userId: string, duration?: number): Promise<boolean>;
|
|
14
|
+
setAdmin(endpointId: string, sceneId: string, userId: string, enable?: boolean): Promise<boolean>;
|
|
15
|
+
setGroupName(endpointId: string, sceneId: string, name: string): Promise<boolean>;
|
|
16
|
+
getGroupInfo(endpointId: string, sceneId: string): Promise<any>;
|
|
16
17
|
start(): Promise<void>;
|
|
17
18
|
}
|
|
18
19
|
//# sourceMappingURL=adapter.d.ts.map
|
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,EACL,OAAO,EACP,MAAM,EACP,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../src/adapter.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EACL,OAAO,EACP,MAAM,EACP,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AAEzD,qBAAa,eAAgB,SAAQ,OAAO,CAAC,gBAAgB,CAAC;IAC5D,gBAAyB,YAAY,mCAAoC;gBAE7D,MAAM,EAAE,MAAM;IAI1B,cAAc,CAAC,MAAM,EAAE,sBAAsB,GAAG,gBAAgB;IAM1D,UAAU,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;IAM9D,WAAW,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;IAM/D,UAAU,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,SAAM;IAM9E,QAAQ,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,UAAO;IAM3E,YAAY,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM;IAM9D,YAAY,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM;IAQhD,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;CAG7B"}
|
package/lib/adapter.js
CHANGED
|
@@ -2,50 +2,51 @@
|
|
|
2
2
|
* Telegram 适配器
|
|
3
3
|
*/
|
|
4
4
|
import { Adapter, } from "zhin.js";
|
|
5
|
-
import {
|
|
5
|
+
import { TelegramEndpoint } from "./endpoint.js";
|
|
6
6
|
export class TelegramAdapter extends Adapter {
|
|
7
|
+
static capabilities = ['inbound', 'outbound'];
|
|
7
8
|
constructor(plugin) {
|
|
8
9
|
super(plugin, "telegram", []);
|
|
9
10
|
}
|
|
10
|
-
|
|
11
|
-
return new
|
|
11
|
+
createEndpoint(config) {
|
|
12
|
+
return new TelegramEndpoint(this, config);
|
|
12
13
|
}
|
|
13
14
|
// ── IGroupManagement 标准群管方法 ──────────────────────────────────
|
|
14
|
-
async kickMember(
|
|
15
|
-
const
|
|
16
|
-
if (!
|
|
17
|
-
throw new Error(`
|
|
18
|
-
return
|
|
19
|
-
}
|
|
20
|
-
async unbanMember(
|
|
21
|
-
const
|
|
22
|
-
if (!
|
|
23
|
-
throw new Error(`
|
|
24
|
-
return
|
|
25
|
-
}
|
|
26
|
-
async muteMember(
|
|
27
|
-
const
|
|
28
|
-
if (!
|
|
29
|
-
throw new Error(`
|
|
30
|
-
return
|
|
31
|
-
}
|
|
32
|
-
async setAdmin(
|
|
33
|
-
const
|
|
34
|
-
if (!
|
|
35
|
-
throw new Error(`
|
|
36
|
-
return
|
|
37
|
-
}
|
|
38
|
-
async setGroupName(
|
|
39
|
-
const
|
|
40
|
-
if (!
|
|
41
|
-
throw new Error(`
|
|
42
|
-
return
|
|
43
|
-
}
|
|
44
|
-
async getGroupInfo(
|
|
45
|
-
const
|
|
46
|
-
if (!
|
|
47
|
-
throw new Error(`
|
|
48
|
-
return
|
|
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.kickMember(Number(sceneId), Number(userId));
|
|
20
|
+
}
|
|
21
|
+
async unbanMember(endpointId, sceneId, userId) {
|
|
22
|
+
const endpoint = this.endpoints.get(endpointId);
|
|
23
|
+
if (!endpoint)
|
|
24
|
+
throw new Error(`Endpoint ${endpointId} 不存在`);
|
|
25
|
+
return endpoint.unbanMember(Number(sceneId), Number(userId));
|
|
26
|
+
}
|
|
27
|
+
async muteMember(endpointId, sceneId, userId, duration = 600) {
|
|
28
|
+
const endpoint = this.endpoints.get(endpointId);
|
|
29
|
+
if (!endpoint)
|
|
30
|
+
throw new Error(`Endpoint ${endpointId} 不存在`);
|
|
31
|
+
return endpoint.muteMember(Number(sceneId), Number(userId), duration);
|
|
32
|
+
}
|
|
33
|
+
async setAdmin(endpointId, sceneId, userId, enable = true) {
|
|
34
|
+
const endpoint = this.endpoints.get(endpointId);
|
|
35
|
+
if (!endpoint)
|
|
36
|
+
throw new Error(`Endpoint ${endpointId} 不存在`);
|
|
37
|
+
return endpoint.setAdmin(Number(sceneId), Number(userId), enable);
|
|
38
|
+
}
|
|
39
|
+
async setGroupName(endpointId, sceneId, name) {
|
|
40
|
+
const endpoint = this.endpoints.get(endpointId);
|
|
41
|
+
if (!endpoint)
|
|
42
|
+
throw new Error(`Endpoint ${endpointId} 不存在`);
|
|
43
|
+
return endpoint.setChatTitle(Number(sceneId), name);
|
|
44
|
+
}
|
|
45
|
+
async getGroupInfo(endpointId, sceneId) {
|
|
46
|
+
const endpoint = this.endpoints.get(endpointId);
|
|
47
|
+
if (!endpoint)
|
|
48
|
+
throw new Error(`Endpoint ${endpointId} 不存在`);
|
|
49
|
+
return endpoint.getChatInfo(Number(sceneId));
|
|
49
50
|
}
|
|
50
51
|
// ── 生命周期 ───────────────────────────────────────────────────────
|
|
51
52
|
async start() {
|
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,EACL,OAAO,GAER,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"adapter.js","sourceRoot":"","sources":["../src/adapter.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EACL,OAAO,GAER,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAGjD,MAAM,OAAO,eAAgB,SAAQ,OAAyB;IAC5D,MAAM,CAAmB,YAAY,GAAG,CAAC,SAAS,EAAE,UAAU,CAAU,CAAC;IAEzE,YAAY,MAAc;QACxB,KAAK,CAAC,MAAM,EAAE,UAAU,EAAE,EAAE,CAAC,CAAC;IAChC,CAAC;IAED,cAAc,CAAC,MAA8B;QAC3C,OAAO,IAAI,gBAAgB,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IAC5C,CAAC;IAED,gEAAgE;IAEhE,KAAK,CAAC,UAAU,CAAC,UAAkB,EAAE,OAAe,EAAE,MAAc;QAClE,MAAM,QAAQ,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;QAChD,IAAI,CAAC,QAAQ;YAAE,MAAM,IAAI,KAAK,CAAC,YAAY,UAAU,MA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CAAC;IAED,KAAK,CAAC,YAAY,CAAC,UAAkB,EAAE,OAAe,EAAE,IAAY;QAClE,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,OAAO,QAAQ,CAAC,YAAY,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,IAAI,CAAC,CAAC;IACtD,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,OAAO,QAAQ,CAAC,WAAW,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC;IAC/C,CAAC;IAED,kEAAkE;IAElE,KAAK,CAAC,KAAK;QACT,MAAM,KAAK,CAAC,KAAK,EAAE,CAAC;IACtB,CAAC"}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Telegram
|
|
2
|
+
* Telegram Endpoint 实现
|
|
3
3
|
*/
|
|
4
4
|
import { Telegraf } from "telegraf";
|
|
5
5
|
import type { Message as TelegramMessage, ChatMember } from "telegraf/types";
|
|
6
|
-
import {
|
|
7
|
-
import type {
|
|
6
|
+
import { Endpoint, Message, SendOptions, type QuotedMessagePayload } from "zhin.js";
|
|
7
|
+
import type { TelegramEndpointConfig } from "./types.js";
|
|
8
8
|
import type { TelegramAdapter } from "./adapter.js";
|
|
9
|
-
export declare class
|
|
9
|
+
export declare class TelegramEndpoint extends Telegraf implements Endpoint<TelegramEndpointConfig, TelegramMessage> {
|
|
10
10
|
adapter: TelegramAdapter;
|
|
11
|
-
$config:
|
|
11
|
+
$config: TelegramEndpointConfig;
|
|
12
12
|
$connected: boolean;
|
|
13
13
|
/** message_id -> chat_id,用于在仅有 message_id 的场景执行 reaction 操作 */
|
|
14
14
|
private readonly messageChatMap;
|
|
@@ -16,9 +16,11 @@ export declare class TelegramBot extends Telegraf implements Bot<TelegramBotConf
|
|
|
16
16
|
private readonly quotedPayloadCache;
|
|
17
17
|
get pluginLogger(): import("zhin.js").Logger;
|
|
18
18
|
get $id(): string;
|
|
19
|
-
constructor(adapter: TelegramAdapter, $config:
|
|
19
|
+
constructor(adapter: TelegramAdapter, $config: TelegramEndpointConfig);
|
|
20
20
|
$connect(): Promise<void>;
|
|
21
21
|
$disconnect(): Promise<void>;
|
|
22
|
+
private chatMemberCache;
|
|
23
|
+
private enrichGroupSender;
|
|
22
24
|
private handleTelegramMessage;
|
|
23
25
|
$formatMessage(msg: TelegramMessage): Message<TelegramMessage>;
|
|
24
26
|
$getMsg(messageId: string): Promise<QuotedMessagePayload>;
|
|
@@ -146,4 +148,4 @@ export declare class TelegramBot extends Telegraf implements Bot<TelegramBotConf
|
|
|
146
148
|
can_manage_topics?: boolean;
|
|
147
149
|
}): Promise<boolean>;
|
|
148
150
|
}
|
|
149
|
-
//# sourceMappingURL=
|
|
151
|
+
//# 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,EAAE,QAAQ,EAAmC,MAAM,UAAU,CAAC;AACrE,OAAO,KAAK,EAAE,OAAO,IAAI,eAAe,EAAyB,UAAU,EAAE,MAAM,gBAAgB,CAAC;AACpG,OAAO,EACL,QAAQ,EACR,OAAO,EACP,WAAW,EAIX,KAAK,oBAAoB,EAC1B,MAAM,SAAS,CAAC;AACjB,OAAO,KAAK,EAAE,sBAAsB,EAAsB,MAAM,YAAY,CAAC;AAC7E,OAAO,KAAK,EAAE,eAAe,EAAE,MAA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