From 73b5f1b18e505b93277abbf3a78f889ce1034fc4 Mon Sep 17 00:00:00 2001
From: krau <71133316+krau@users.noreply.github.com>
Date: Mon, 16 Jun 2025 16:30:45 +0800
Subject: [PATCH] docs: add en translate
---
docs/content/en/_index.md | 31 ++++
docs/content/en/contribute/_index.md | 14 ++
docs/content/en/deployment/_index.md | 4 +
.../en/deployment/configuration/_index.md | 141 +++++++++++++++++
.../en/deployment/configuration/storages.md | 65 ++++++++
docs/content/en/deployment/installation.md | 145 ++++++++++++++++++
docs/content/en/help/_index.md | 18 +++
docs/content/en/usage/_index.md | 65 ++++++++
8 files changed, 483 insertions(+)
create mode 100644 docs/content/en/_index.md
create mode 100644 docs/content/en/contribute/_index.md
create mode 100644 docs/content/en/deployment/_index.md
create mode 100644 docs/content/en/deployment/configuration/_index.md
create mode 100644 docs/content/en/deployment/configuration/storages.md
create mode 100644 docs/content/en/deployment/installation.md
create mode 100644 docs/content/en/help/_index.md
create mode 100644 docs/content/en/usage/_index.md
diff --git a/docs/content/en/_index.md b/docs/content/en/_index.md
new file mode 100644
index 0000000..58fa52e
--- /dev/null
+++ b/docs/content/en/_index.md
@@ -0,0 +1,31 @@
+---
+title: Introduction
+---
+
+# Save Any Bot
+
+
+
+
+
+
+Save Any Bot is a tool that allows you to save files from Telegram to various storage backends.
+
+## Features
+
+- Supports documents/videos/images/stickers... and even Telegraph
+- Breaks restrictions on saving files
+- Batch download
+- Streaming
+- Multi-user
+- Automatic organization based on storage rules
+- Supports multiple storage backends:
+ - Alist
+ - Minio (S3 compatible)
+ - WebDAV
+ - Telegram (re-upload to specified chat)
+ - Local disk
+
+## [Contributors](https://github.com/krau/SaveAny-Bot/graphs/contributors)
+
+
diff --git a/docs/content/en/contribute/_index.md b/docs/content/en/contribute/_index.md
new file mode 100644
index 0000000..97679be
--- /dev/null
+++ b/docs/content/en/contribute/_index.md
@@ -0,0 +1,14 @@
+---
+title: "Contributing"
+weight: 20
+---
+
+# Contributing
+
+## Contributing New Storage Backend
+
+1. Fork this repository and clone it to your local machine.
+2. Add the new storage backend type in `pkg/enums/storage/storages.go` and run code generation.
+3. Define the storage backend configuration in the `config/storage` directory and add it to `config/storage/factory.go`.
+4. Create a new package in the `storage` directory, implement the storage backend, and import it in `storage/storage.go`.
+5. Update the documentation to include configuration details for the new storage backend.
\ No newline at end of file
diff --git a/docs/content/en/deployment/_index.md b/docs/content/en/deployment/_index.md
new file mode 100644
index 0000000..46f1cf5
--- /dev/null
+++ b/docs/content/en/deployment/_index.md
@@ -0,0 +1,4 @@
+---
+title: "Deployment Guide"
+weight: 5
+---
diff --git a/docs/content/en/deployment/configuration/_index.md b/docs/content/en/deployment/configuration/_index.md
new file mode 100644
index 0000000..360546f
--- /dev/null
+++ b/docs/content/en/deployment/configuration/_index.md
@@ -0,0 +1,141 @@
+---
+title: "Configuration Guide"
+---
+
+# Configuration Guide
+
+SaveAnyBot uses the toml format for its configuration files. You can learn more about toml syntax on the [TOML official website](https://toml.io/).
+
+SaveAnyBot needs to read a `config.toml` file in the working directory as its configuration file. If this file is missing, a default file will be created, and the bot will attempt to load configuration from environment variables.
+
+Here is an example of a minimal configuration file:
+
+```toml
+[telegram]
+token = "1234567890:ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+
+[[users]]
+# telegram user id
+id = 777000
+blacklist = true
+
+[[storages]]
+name = "Local Storage"
+type = "local"
+enable = true
+base_path = "./downloads"
+```
+
+## Detailed Configuration
+
+### Global Configuration
+
+- `stream`: Whether to enable Stream mode, default is `false`. When enabled, the Bot will stream files directly to storage endpoints (if supported), without downloading them locally.
+{{< hint warning >}}
+Stream mode is very useful for deployment environments with limited disk space, but it also has some drawbacks:
+
+
/etc/systemd/system/saveany-bot.service and write the following content:
+
+{{< codeblock >}}
+[Unit]
+Description=SaveAnyBot
+After=systemd-user-sessions.service
+
+[Service]
+Type=simple
+WorkingDirectory=/yourpath/
+ExecStart=/yourpath/saveany-bot
+Restart=on-failure
+
+[Install]
+WantedBy=multi-user.target
+{{< /codeblock >}}
+
+Enable startup on boot and start the service:
+
+{{< codeblock >}}
+systemctl enable --now saveany-bot
+{{< /codeblock >}}
+
+{{< /tab >}}
+
+{{< tab "procd (OpenWrt)" >}}
+
+/etc/init.d/saveanybot, refer to wrt_init and modify as needed:
+
+{{< codeblock >}}
+#!/bin/sh /etc/rc.common
+
+#This is the OpenWRT init.d script for SaveAnyBot
+
+START=99
+STOP=10
+description="SaveAnyBot"
+
+WORKING_DIR="/mnt/mmc1-1/SaveAnyBot"
+EXEC_PATH="$WORKING_DIR/saveany-bot"
+start() {
+ echo "Starting SaveAnyBot..."
+ cd $WORKING_DIR
+ $EXEC_PATH &
+}
+stop() {
+ echo "Stopping SaveAnyBot..."
+ killall saveany-bot
+}
+reload() {
+ stop
+ start
+}
+
+{{< /codeblock >}}
+
+Set permissions:
+
+{{< codeblock >}}
+chmod +x /etc/init.d/saveanybot
+{{< /codeblock >}}
+
+Then copy the file to /etc/rc.d and rename it to S99saveanybot, also set permissions:
+
+{{< codeblock >}}
+chmod +x /etc/rc.d/S99saveanybot
+{{< /codeblock >}}
+
+/usr/bin/sabot, refer to wrt_bin and modify as needed. Note that the file encoding here only supports ANSI 936.
+
+Then set permissions:
+
+{{< codeblock >}}
+chmod +x /usr/bin/sabot
+{{< /codeblock >}}
+
+Usage: sudo sabot start|stop|restart|status|enable|disable
+
+{{< /tab >}}
+{{< /tabs >}}
+
+
+## Deploy Using Docker
+
+### Docker Compose
+
+Download the [docker-compose.yml](https://github.com/krau/SaveAny-Bot/blob/main/docker-compose.yml) file, create a new `config.toml` file in the same directory, refer to [config.example.toml](https://github.com/krau/SaveAny-Bot/blob/main/config.example.toml) to edit the configuration file.
+
+Start:
+
+```bash
+docker compose up -d
+```
+
+### Docker
+
+```shell
+docker run -d --name saveany-bot \
+ -v /path/to/config.toml:/app/config.toml \
+ -v /path/to/downloads:/app/downloads \
+ ghcr.io/krau/saveany-bot:latest
+```
+
+## Updates
+
+Use `upgrade` or `up` to upgrade to the latest version
+
+```bash
+./saveany-bot upgrade
+```
+
+If you deployed with Docker, use the following commands to update:
+
+```bash
+docker pull ghcr.io/krau/saveany-bot:latest
+docker restart saveany-bot
+```
\ No newline at end of file
diff --git a/docs/content/en/help/_index.md b/docs/content/en/help/_index.md
new file mode 100644
index 0000000..f22b539
--- /dev/null
+++ b/docs/content/en/help/_index.md
@@ -0,0 +1,18 @@
+---
+title: "Frequently Asked Questions"
+weight: 15
+---
+
+# Frequently Asked Questions
+
+## Upload to AList shows success but actually fails
+
+Adjust the upload chunk size in the AList management page, and deploy AList in a more stable network environment to reduce the occurrence of this issue.
+
+## Bot indicates successful download but files don't show up in AList
+
+AList caches directory structures. Refer to the documentation to adjust cache expiration time.
+
+## Docker deployment still can't connect to Telegram despite proxy configuration (client initialization timeout)
+
+Docker cannot directly access the host network. If you're not familiar with its usage, please set the container to host mode.
\ No newline at end of file
diff --git a/docs/content/en/usage/_index.md b/docs/content/en/usage/_index.md
new file mode 100644
index 0000000..1863448
--- /dev/null
+++ b/docs/content/en/usage/_index.md
@@ -0,0 +1,65 @@
+---
+title: "Usage"
+weight: 10
+---
+
+# Usage
+
+## File Transfer
+
+The bot accepts two types of messages: files and links.
+
+Supported links:
+
+1. Telegram message links, for example: `https://t.me/acherkrau/1097`. **Even if the channel prohibits forwarding and saving, the bot can still download its files.**
+2. Telegra.ph article links, the bot will download all images within.
+
+## Silent Mode
+
+Use the `/silent` command to toggle silent mode.
+
+By default, silent mode is off, and the bot will ask you for the save location of each file.
+
+When silent mode is enabled, the bot will save files directly to the default location without confirmation.
+
+Before enabling silent mode, you need to set the default save location using the `/storage` command.
+
+
+## Storage Rules
+
+Allows you to set some redirection rules for the bot when uploading files to storage, for automatic organization of saved files.
+
+See: #28
+
+Currently supported rule types:
+
+1. FILENAME-REGEX
+2. MESSAGE-REGEX
+
+Basic syntax for adding rules:
+
+"Rule Type Rule Content Storage Name Path"
+
+Pay attention to the use of spaces; the bot can only parse correctly formatted syntax. Below is an example of a valid rule command:
+
+```
+/rule add FILENAME-REGEX (?i)\.(mp4|mkv|ts|avi|flv)$ MyAlist /videos
+```
+
+Additionally, if "CHOSEN" is used as the storage name in the rule, it means the file will be stored in the path of the storage selected via button click.
+
+Rule descriptions:
+
+### FILENAME-REGEX
+
+Matches based on filename regex. The rule content must be a valid regular expression, such as:
+
+```
+FILENAME-REGEX (?i)\.(mp4|mkv|ts|avi|flv)$ MyAlist /videos
+```
+
+This means files with extensions mp4, mkv, ts, avi, flv will be saved to the /videos directory in the storage named MyAlist (also affected by the `base_path` in the configuration file).
+
+### MESSAGE-REGEX
+
+Similar to the above, but matches based on the text content of the message itself.
\ No newline at end of file