mirror of
https://github.com/krau/SaveAny-Bot.git
synced 2026-05-25 02:00:24 +08:00
docs: Enhance documentation with new features, guidelines, and configuration details
This commit is contained in:
@@ -44,6 +44,15 @@ Stream mode is very useful for deployment environments with limited disk space,
|
||||
- `workers`: Number of tasks to process simultaneously, default is 3.
|
||||
- `threads`: Number of threads used when downloading files, default is 4. Only effective when Stream mode is not enabled.
|
||||
- `retry`: Number of retries when a task fails, default is 3.
|
||||
- `proxy`: Global proxy configuration. After setting this, all network connections inside the program will try to use this proxy. Optional.
|
||||
|
||||
```toml
|
||||
stream = false
|
||||
workers = 3
|
||||
threads = 4
|
||||
retry = 3
|
||||
proxy = "socks5://127.0.0.1:7890"
|
||||
```
|
||||
|
||||
### Telegram Configuration
|
||||
|
||||
@@ -54,6 +63,17 @@ Stream mode is very useful for deployment environments with limited disk space,
|
||||
- `proxy`: Proxy configuration, optional.
|
||||
- `enable`: Whether to enable the proxy.
|
||||
- `url`: Proxy address, only supports `socks5://`
|
||||
- `userbot`: Userbot configuration, optional.
|
||||
- `enable`: Enable userbot integration. Requires logging in with a user account; you should use your own API ID & Hash when enabling this.
|
||||
- `session`: Path to the userbot session file, default is `data/usersession.db`.
|
||||
|
||||
{{< hint warning >}}
|
||||
After enabling userbot integration, the bot can download files from private channels and groups, but there is an unavoidable risk of the account being banned.
|
||||
<br />
|
||||
On the first start after enabling userbot, you need to input phone number, 2FA and verification code in the terminal.
|
||||
<br />
|
||||
If you deploy with Docker, please run the container with `-it` for an interactive environment, then perform the login.
|
||||
{{< /hint >}}
|
||||
|
||||
```toml
|
||||
[telegram]
|
||||
@@ -65,6 +85,9 @@ rpc_retry = 5
|
||||
[telegram.proxy]
|
||||
enable = false
|
||||
url = "socks5://127.0.0.1:7890"
|
||||
[telegram.userbot]
|
||||
enable = false
|
||||
session = "data/usersession.db"
|
||||
```
|
||||
|
||||
### Storage Endpoints List
|
||||
@@ -131,6 +154,39 @@ storages = []
|
||||
blacklist = true
|
||||
```
|
||||
|
||||
### Events
|
||||
|
||||
Event hooks allow you to run custom commands based on task status while the bot is processing tasks. Currently only arbitrary command execution is supported, configured via `[hook.exec]`.
|
||||
|
||||
Supported event types:
|
||||
|
||||
- `task_before_start`: Before a task starts
|
||||
- `task_success`: After a task completes successfully
|
||||
- `task_fail`: After a task fails
|
||||
- `task_cancel`: After a task is cancelled
|
||||
|
||||
The configured value must be a full shell command line. The bot will execute this command when the event occurs. Example:
|
||||
|
||||
```toml
|
||||
[hook.exec]
|
||||
task_before_start = "echo 'task is about to start'"
|
||||
task_success = "bash /path/to/success_script.sh"
|
||||
task_fail = "curl -X POST https://example.com/api/notify -d 'task failed'"
|
||||
task_cancel = "bash /path/to/cancel_script.sh"
|
||||
```
|
||||
|
||||
### Parsers
|
||||
|
||||
Parsers give the bot the ability to handle non-Telegram files, such as downloading files from other websites. Configure them via `[parsers]`.
|
||||
|
||||
```toml
|
||||
[parsers]
|
||||
plugin_enable = true # Whether to enable parser plugins
|
||||
plugin_dirs = ["./plugins"] # Plugin directories, can be multiple
|
||||
```
|
||||
|
||||
The above settings only control JavaScript-based parser plugins. The bot also has built-in parsers implemented in Go, which are enabled by default.
|
||||
|
||||
### Miscellaneous
|
||||
|
||||
```toml
|
||||
|
||||
@@ -46,15 +46,29 @@ base_path = "/path/to/webdav" # Base path in WebDAV, all files will be stored un
|
||||
`type=s3`
|
||||
|
||||
```toml
|
||||
endpoint = "s3.example.com" # Endpoint for S3
|
||||
endpoint = "s3.example.com" # Endpoint for S3, defaults to AWS S3 endpoint if not set
|
||||
region = "us-east-1" # Region for S3
|
||||
access_key_id = "your_access_key_id" # Access key ID for S3
|
||||
secret_access_key = "your_secret_access_key" # Secret access key for S3
|
||||
bucket_name = "your_bucket_name" # Bucket name for S3
|
||||
use_ssl = true # Whether to use SSL, default is true
|
||||
base_path = "/path/to/s3" # Base path in S3, all files will be stored under this path
|
||||
virtual_host = false # Use virtual-host style URL, default is false
|
||||
```
|
||||
|
||||
Example of virtual-host-style URL:
|
||||
|
||||
```
|
||||
https://your_bucket_name.s3.example.com/path/to/s3/your_file
|
||||
```
|
||||
|
||||
Example of path-style URL (when `virtual_host` is false):
|
||||
|
||||
```
|
||||
https://s3.example.com/your_bucket_name/path/to/s3/your_file
|
||||
```
|
||||
|
||||
If you are using a third-party S3-compatible service, it usually uses path-style URLs. AWS S3 typically uses virtual-host-style URLs. Please refer to your S3-compatible service documentation for details.
|
||||
|
||||
## Telegram
|
||||
|
||||
`type=telegram`
|
||||
@@ -62,5 +76,8 @@ base_path = "/path/to/s3" # Base path in S3, all files will be stored under this
|
||||
Stream mode is not supported.
|
||||
|
||||
```toml
|
||||
chat_id = "123456789" # Telegram chat ID, the Bot will send files to this chat
|
||||
chat_id = "123456789" # Telegram chat ID, the bot will send files to this chat
|
||||
force_file = false # Force sending as file, default is false
|
||||
skip_large = false # Skip large files, default is false. If enabled, files exceeding Telegram's limit will not be uploaded.
|
||||
spilt_size_mb = 2000 # Split size in MB, default is 2000 MB (2 GB). Files larger than this will be split into multiple parts (zip format). Ignored when skip_large is true.
|
||||
```
|
||||
@@ -4,7 +4,7 @@ title: "Installation and Updates"
|
||||
|
||||
# Installation and Updates
|
||||
|
||||
## Deploy from Pre-compiled Files
|
||||
## Deploy from Pre-compiled Files (Recommended)
|
||||
|
||||
Download the binary file for your platform from the [Release](https://github.com/krau/SaveAny-Bot/releases) page.
|
||||
|
||||
@@ -129,17 +129,41 @@ docker run -d --name saveany-bot \
|
||||
ghcr.io/krau/saveany-bot:latest
|
||||
```
|
||||
|
||||
{{< hint info >}}
|
||||
About Docker image variants
|
||||
<br />
|
||||
<ul>
|
||||
<li>Default: Includes all features and dependencies, larger in size. Use this if you don't have special requirements.</li>
|
||||
<li>micro: Slimmed-down image with some optional dependencies removed, smaller in size.</li>
|
||||
<li>pico: Minimal image containing only core features, smallest in size.</li>
|
||||
</ul>
|
||||
You can pull different variants by specifying tags, for example: <code>ghcr.io/krau/saveany-bot:micro</code>
|
||||
<br />
|
||||
For more details about the variants, see the Dockerfile in the project root.
|
||||
{{< /hint >}}
|
||||
|
||||
## Updates
|
||||
|
||||
Use `upgrade` or `up` to upgrade to the latest version
|
||||
If you deployed from pre-compiled binaries, use the following CLI command to update:
|
||||
|
||||
```bash
|
||||
./saveany-bot upgrade
|
||||
./saveany-bot up
|
||||
```
|
||||
|
||||
(`upgrade` is also available as an alias.)
|
||||
|
||||
If you deployed with Docker, use the following commands to update:
|
||||
|
||||
docker:
|
||||
|
||||
```bash
|
||||
docker pull ghcr.io/krau/saveany-bot:latest
|
||||
docker restart saveany-bot
|
||||
```
|
||||
|
||||
docker compose:
|
||||
|
||||
```bash
|
||||
docker compose pull
|
||||
docker compose restart
|
||||
```
|
||||
Reference in New Issue
Block a user