AnyBot/docs/feature-map/deliver.md

30 lines
2.6 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 交出結果:傳檔、打開、發佈網站
Bot 做好的東西用三種方式交給使用者:放進聊天變成檔案卡片、直接在使用者的螢幕上打開,或發佈成公開網站。傳到帳號裡另一台裝置見 [computers](computers.md)。
## 子功能
- 傳檔:`send_file` 把檔案放進聊天變成檔案卡片,點一下預覽、可以下載。
- 打開給使用者看:`open_for_person` 在使用者的螢幕上打開檔案或網址。
- 發佈網站:`publish_site` 把一個 .html 檔或有 index.html 的資料夾發佈成公開網站,回傳網址,同一個名字再發佈就取代。
- 傳到帳號裡另一台裝置是 `send_to_device`(見 [computers](computers.md))。
## 使用者怎麼到
- `send_file` 的檔案卡片在回覆裡,點一下預覽(「下載檔案」「用其他 App 打開」);右側面板「資料庫」也列出這個對話裡的檔案。
- `publish_site` 要先在 設定 › 一般 ›「手機與帳號」登入帳號才有([account](account.md))。
- 手機:聊天裡的檔案卡片,點了預覽([phone](phone.md))。
## 怎麼操作
- Bot:交結果用 `send_file`,不要只說檔案在哪;要使用者馬上看到用 `open_for_person`;要公開網址用 `publish_site`(path,name 只用英文字母、數字和 -)。`open_for_person`、`publish_site` 屬於「檔案與指令」能力,`send_file` 每個 Bot 都有。
- 驗證:請 Bot 在它自己的電腦寫一個 report.md 傳給你,聊天要出現檔案卡片,點開看得到內容。自動測試:`cargo test tools::`、`cargo test preview::`、`cargo test app::files_ui::`、`cargo test agent::`。
## 陷阱
- 機密檔案不能傳、打開或發佈([files](files.md))。
- `open_for_person` 不打開程式或指令檔(打開就會執行),改用 `send_file`;AnyBot 在伺服器上時,網址會在使用者正在用的那台電腦打開(不知道是哪台就打不開),檔案打不開,也改用 `send_file`。
- SSH 電腦上的檔案不能直接 `send_file`、`open_for_person` 或 `publish_site`;帳號裡其他電腦的檔案可以 `send_file`(最多 20 MB),但不能打開或發佈。先複製到 Bot 自己的電腦。
- `publish_site`:任何知道網址的人都看得到。每個網站名字第一次會問(工作資料夾外的每次都問);最多 500 個檔案、25 MB;點開頭的檔案、node_modules、機密檔案、指到資料夾外的連結會略過;一定要有 index.html。
- 「在這台電腦上執行」設成永不允許(或被管理員鎖住)時,這台的檔案也不能傳出去、打開或發佈。