mirror of
https://github.com/AstrBotDevs/AstrBot
synced 2026-07-01 18:20:16 +08:00
Compare commits
1 Commits
v4.26.0-be
...
codex/rest
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
53296fcc73 |
153
docs/en/use/cli.md
Normal file
153
docs/en/use/cli.md
Normal file
@@ -0,0 +1,153 @@
|
||||
# CLI Commands
|
||||
|
||||
The AstrBot CLI initializes instances, starts AstrBot, updates common config values, and manages plugins.
|
||||
|
||||
If you install AstrBot with `uv`:
|
||||
|
||||
```bash
|
||||
uv tool install astrbot --python 3.12
|
||||
```
|
||||
|
||||
`uv` creates the `astrbot` executable and puts it on `PATH`. You can inspect the path with:
|
||||
|
||||
::: code-group
|
||||
|
||||
```bash [Linux / macOS]
|
||||
which astrbot
|
||||
```
|
||||
|
||||
```powershell [Windows]
|
||||
where.exe astrbot
|
||||
```
|
||||
|
||||
:::
|
||||
|
||||
> [!TIP]
|
||||
> Run the commands below from the AstrBot working directory.
|
||||
|
||||
## Quick Start
|
||||
|
||||
Initialize the directory once, then start AstrBot:
|
||||
|
||||
```bash
|
||||
astrbot init
|
||||
astrbot run
|
||||
```
|
||||
|
||||
`astrbot init` creates the data directories and configuration files required by AstrBot. After initialization, use `astrbot run` for later starts.
|
||||
|
||||
## Top-Level Commands
|
||||
|
||||
| Command | Purpose |
|
||||
| --- | --- |
|
||||
| `astrbot init` | Initialize the current directory as an AstrBot working directory. |
|
||||
| `astrbot run` | Start AstrBot in the foreground. |
|
||||
| `astrbot conf` | Read or update common config values. |
|
||||
| `astrbot password` | Change the WebUI login password interactively. |
|
||||
| `astrbot plug` | Create, install, update, remove, or search plugins. |
|
||||
| `astrbot help` | Show CLI help. |
|
||||
| `astrbot --version` | Show the AstrBot CLI version. |
|
||||
|
||||
## Start AstrBot
|
||||
|
||||
```bash
|
||||
astrbot run
|
||||
```
|
||||
|
||||
Common options:
|
||||
|
||||
| Option | Purpose |
|
||||
| --- | --- |
|
||||
| `-p, --port <PORT>` | Set the WebUI port. |
|
||||
| `-r, --reload` | Enable plugin auto-reload for plugin development. |
|
||||
|
||||
Examples:
|
||||
|
||||
```bash
|
||||
astrbot run --port 6185
|
||||
astrbot run --reload
|
||||
```
|
||||
|
||||
## Config
|
||||
|
||||
`astrbot conf` reads and updates common config values.
|
||||
|
||||
```bash
|
||||
astrbot conf get
|
||||
astrbot conf get dashboard.port
|
||||
astrbot conf set dashboard.port 6185
|
||||
```
|
||||
|
||||
Supported keys:
|
||||
|
||||
| Key | Description |
|
||||
| --- | --- |
|
||||
| `timezone` | Time zone, for example `Asia/Shanghai`. |
|
||||
| `log_level` | Log level: `DEBUG`, `INFO`, `WARNING`, `ERROR`, or `CRITICAL`. |
|
||||
| `dashboard.port` | WebUI port. |
|
||||
| `dashboard.username` | WebUI username. |
|
||||
| `dashboard.password` | WebUI password. |
|
||||
| `callback_api_base` | Callback API base URL. Must start with `http://` or `https://`. |
|
||||
|
||||
Changing the dashboard password writes the current password hashes automatically:
|
||||
|
||||
```bash
|
||||
astrbot conf set dashboard.password "new-password"
|
||||
```
|
||||
|
||||
You can also use the dedicated interactive password command:
|
||||
|
||||
```bash
|
||||
astrbot password
|
||||
astrbot password --username admin
|
||||
```
|
||||
|
||||
## Plugins
|
||||
|
||||
`astrbot plug` manages plugins under `data/plugins`.
|
||||
|
||||
| Command | Purpose |
|
||||
| --- | --- |
|
||||
| `astrbot plug list` | List installed plugins. |
|
||||
| `astrbot plug list --all` | Also show uninstalled plugins. |
|
||||
| `astrbot plug search <QUERY>` | Search plugins. |
|
||||
| `astrbot plug install <NAME>` | Install a plugin. |
|
||||
| `astrbot plug update [NAME]` | Update one plugin, or all updatable plugins if no name is given. |
|
||||
| `astrbot plug remove <NAME>` | Remove an installed plugin. |
|
||||
| `astrbot plug new <NAME>` | Create a new plugin from the template. |
|
||||
|
||||
Use a GitHub proxy when installing or updating plugins:
|
||||
|
||||
```bash
|
||||
astrbot plug install example-plugin --proxy https://gh-proxy.example.com/
|
||||
astrbot plug update --proxy https://gh-proxy.example.com/
|
||||
```
|
||||
|
||||
Creating a new plugin asks for the author, description, version, and repository URL:
|
||||
|
||||
```bash
|
||||
astrbot plug new my-plugin
|
||||
```
|
||||
|
||||
## Help
|
||||
|
||||
Show general CLI help:
|
||||
|
||||
```bash
|
||||
astrbot help
|
||||
```
|
||||
|
||||
Show help for a specific command:
|
||||
|
||||
```bash
|
||||
astrbot help run
|
||||
astrbot run --help
|
||||
astrbot help conf
|
||||
astrbot plug --help
|
||||
```
|
||||
|
||||
Show the version:
|
||||
|
||||
```bash
|
||||
astrbot --version
|
||||
```
|
||||
153
docs/zh/use/cli.md
Normal file
153
docs/zh/use/cli.md
Normal file
@@ -0,0 +1,153 @@
|
||||
# CLI 指令
|
||||
|
||||
AstrBot CLI 用于初始化实例、启动 AstrBot、修改常用配置和管理插件。
|
||||
|
||||
如果你使用 `uv` 安装:
|
||||
|
||||
```bash
|
||||
uv tool install astrbot --python 3.12
|
||||
```
|
||||
|
||||
`uv` 会生成 `astrbot` 可执行文件,并把它放到 `PATH` 中。可以用下面的命令确认路径:
|
||||
|
||||
::: code-group
|
||||
|
||||
```bash [Linux / macOS]
|
||||
which astrbot
|
||||
```
|
||||
|
||||
```powershell [Windows]
|
||||
where.exe astrbot
|
||||
```
|
||||
|
||||
:::
|
||||
|
||||
> [!TIP]
|
||||
> 下面的命令都需要在 AstrBot 工作目录中执行。
|
||||
|
||||
## 快速开始
|
||||
|
||||
第一次部署时先初始化目录,再启动 AstrBot:
|
||||
|
||||
```bash
|
||||
astrbot init
|
||||
astrbot run
|
||||
```
|
||||
|
||||
`astrbot init` 会在当前目录创建 AstrBot 所需的数据目录和配置文件。初始化完成后,后续启动只需要执行 `astrbot run`。
|
||||
|
||||
## 顶层指令
|
||||
|
||||
| 指令 | 用途 |
|
||||
| --- | --- |
|
||||
| `astrbot init` | 初始化当前目录为 AstrBot 工作目录。 |
|
||||
| `astrbot run` | 在前台启动 AstrBot。 |
|
||||
| `astrbot conf` | 查看或修改常用配置项。 |
|
||||
| `astrbot password` | 交互式修改 WebUI 登录密码。 |
|
||||
| `astrbot plug` | 创建、安装、更新、删除或搜索插件。 |
|
||||
| `astrbot help` | 查看 CLI 帮助。 |
|
||||
| `astrbot --version` | 查看 AstrBot CLI 版本。 |
|
||||
|
||||
## 启动 AstrBot
|
||||
|
||||
```bash
|
||||
astrbot run
|
||||
```
|
||||
|
||||
常用选项:
|
||||
|
||||
| 选项 | 用途 |
|
||||
| --- | --- |
|
||||
| `-p, --port <PORT>` | 指定 WebUI 端口。 |
|
||||
| `-r, --reload` | 启用插件自动重载,适合插件开发调试。 |
|
||||
|
||||
示例:
|
||||
|
||||
```bash
|
||||
astrbot run --port 6185
|
||||
astrbot run --reload
|
||||
```
|
||||
|
||||
## 配置
|
||||
|
||||
`astrbot conf` 用于查看和修改常用配置项。
|
||||
|
||||
```bash
|
||||
astrbot conf get
|
||||
astrbot conf get dashboard.port
|
||||
astrbot conf set dashboard.port 6185
|
||||
```
|
||||
|
||||
支持的配置项:
|
||||
|
||||
| 配置项 | 说明 |
|
||||
| --- | --- |
|
||||
| `timezone` | 时区,例如 `Asia/Shanghai`。 |
|
||||
| `log_level` | 日志等级:`DEBUG`、`INFO`、`WARNING`、`ERROR`、`CRITICAL`。 |
|
||||
| `dashboard.port` | WebUI 端口。 |
|
||||
| `dashboard.username` | WebUI 用户名。 |
|
||||
| `dashboard.password` | WebUI 密码。 |
|
||||
| `callback_api_base` | 回调 API 基础地址,需要以 `http://` 或 `https://` 开头。 |
|
||||
|
||||
修改密码时会自动写入新版密码哈希:
|
||||
|
||||
```bash
|
||||
astrbot conf set dashboard.password "new-password"
|
||||
```
|
||||
|
||||
也可以使用专门的交互式密码指令:
|
||||
|
||||
```bash
|
||||
astrbot password
|
||||
astrbot password --username admin
|
||||
```
|
||||
|
||||
## 插件
|
||||
|
||||
`astrbot plug` 用于管理 `data/plugins` 下的插件。
|
||||
|
||||
| 指令 | 用途 |
|
||||
| --- | --- |
|
||||
| `astrbot plug list` | 查看已安装插件。 |
|
||||
| `astrbot plug list --all` | 同时显示未安装插件。 |
|
||||
| `astrbot plug search <QUERY>` | 搜索插件。 |
|
||||
| `astrbot plug install <NAME>` | 安装插件。 |
|
||||
| `astrbot plug update [NAME]` | 更新指定插件;不传名称时更新所有可更新插件。 |
|
||||
| `astrbot plug remove <NAME>` | 删除已安装插件。 |
|
||||
| `astrbot plug new <NAME>` | 基于模板创建新插件。 |
|
||||
|
||||
安装或更新插件时可以使用 GitHub 代理:
|
||||
|
||||
```bash
|
||||
astrbot plug install example-plugin --proxy https://gh-proxy.example.com/
|
||||
astrbot plug update --proxy https://gh-proxy.example.com/
|
||||
```
|
||||
|
||||
创建新插件会交互式询问作者、描述、版本和仓库地址:
|
||||
|
||||
```bash
|
||||
astrbot plug new my-plugin
|
||||
```
|
||||
|
||||
## 帮助
|
||||
|
||||
查看全部 CLI 帮助:
|
||||
|
||||
```bash
|
||||
astrbot help
|
||||
```
|
||||
|
||||
查看指定指令帮助:
|
||||
|
||||
```bash
|
||||
astrbot help run
|
||||
astrbot run --help
|
||||
astrbot help conf
|
||||
astrbot plug --help
|
||||
```
|
||||
|
||||
查看版本:
|
||||
|
||||
```bash
|
||||
astrbot --version
|
||||
```
|
||||
Reference in New Issue
Block a user