Add alias command to the interactive console

This commit is contained in:
cantyonion committed 2026-11-24 12:50:49 +08:00
1 parent 1497f114e6
commit 79ad7114b8
6 files changed
+131 -30

No files matched your search

+14
View File
@@ -111,6 +111,7 @@ bilicraft-bot [--server host:port] [--account cache-key]
| 命令 | 说明 |
| --- | --- |
| `alias [名称 [命令 参数...]]` | 定义或覆盖别名,单给名称查看定义,不带参数列出全部别名 |
| `run 路径.act` | 完整检查脚本及导入后入队,路径可用成对引号包裹 |
| `tasks` | 显示任务编号、状态、命令进度和等待剩余时间 |
| `help` | 显示终端帮助 |
@@ -118,6 +119,19 @@ bilicraft-bot [--server host:port] [--account cache-key]
游戏命令与脚本共用下文语法,但 `wait` 和 `import` 仅能写在操作文件中。单条交互游戏命令提交后,终端会等它完成或失败,再接收下一条输入。
### 命令别名
在终端输入 `alias 名称 命令 参数...` 保存快捷命令,定义时不会执行。调用时,名称后的参数会接在已保存的命令后面。例如:
```text
>>> alias tell sendmsg @Steve
>>> tell 收获完成
>>> alias demo run "../../actions/demo.act"
>>> demo
```
第二行等同于 `sendmsg @Steve 收获完成`,第四行会将示例脚本加入队列。别名仅在本次终端会话有效。支持引用其他别名,也可以用 `alias drop drop all` 给同名游戏命令预设参数。循环引用会报错。`alias` 本身是保留名称。
### 调度与退出
- 游戏操作在主线程串行执行。运行中的脚本会持续执行,直到完成、失败或遇到 `wait`;新任务不会抢占它。