頻道端點
最後更新
Telegram 與 Discord 通道的端點。
| Method | 路徑 | 說明 |
|---|---|---|
GET | /v1/channel | local — 一次讀取所有頻道:telegram 與 discord 各帶 {enabled, username, has_token},admin 帶 {channel, authorized, chats:[{value,type,id,name}]}。chats 來自 .telegram / .discord 授權檔(tg 在前、dc 在後),每個 value 可原樣回填;authorized 表示目前的轉發目標是否仍在清單上(手動輸入的 ID 會是 false) |
POST | /v1/channel/telegram · /v1/channel/discord | local — {action:"enable"|"disable", token?}。啟用必須帶 token(否則回 400);停用會從 keychain 刪除 token 並關閉旗標。啟用只儲存 token 並翻轉設定旗標;TUI 會做的 token 驗證(verifyTelegram 啟動 bot client 並讀取 username)在此刻意省略,因為 daemon 既有的設定檔 watcher 已會重連 bot 並補上 username |
GET | /v1/channel/:channel/chats | local — telegram / discord 已完成驗證的對話。只在 bot 執行時有意義,請在頻道回報 enabled 後再查 |
DELETE | /v1/channel/:channel/chat | local — {id}。從授權檔移除一筆對話;該對話需重新驗證 bot 才會回應,回傳 {ok, removed}。id 不在清單上、或尚無任何已授權對話時回 404 |
POST | /v1/channel/admin | local — {value:"tg@<chatID>"|"dc@<channelID>"|""}。設定新對話驗證碼的轉發目標,空字串為清除。value 為必填(省略回 400,避免空 body 靜默清除設定)。只驗證格式——未在授權清單中的 ID 會讓轉發只寫 log 並記一則警告 |