Skip to content

Commit 3d32fd9

Browse files
author
ukgorclawbot-stack
committed
Add CI and bilingual install guide
1 parent 633f637 commit 3d32fd9

File tree

3 files changed

+297
-16
lines changed

3 files changed

+297
-16
lines changed

.github/workflows/ci.yml

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
pull_request:
6+
7+
jobs:
8+
syntax-and-generate:
9+
runs-on: macos-latest
10+
11+
steps:
12+
- name: Checkout
13+
uses: actions/checkout@v4
14+
15+
- name: Set up Python
16+
uses: actions/setup-python@v5
17+
with:
18+
python-version: "3.11"
19+
20+
- name: Python syntax check
21+
run: |
22+
python3 -m py_compile \
23+
bootstrap_bot_stack.py \
24+
configure_stack.py \
25+
reverse_export_bot_stack.py \
26+
make_migration_ready_stack.py \
27+
bot.py \
28+
group_bot.py \
29+
xhs_adapter.py \
30+
memory_store.py \
31+
routing.py \
32+
runners.py \
33+
task_registry.py
34+
35+
- name: Shell syntax check
36+
run: |
37+
bash -n install.sh
38+
bash -n configure.sh
39+
bash -n apply_stack.sh
40+
bash -n health_check.sh
41+
bash -n scripts/shared-memory-write.sh
42+
zsh -n bootstrap_bot_stack.sh
43+
zsh -n run_role_bot.sh
44+
zsh -n run_group_bot.sh
45+
46+
- name: Generate local config for CI
47+
run: |
48+
printf '%s\n%s\n%s\n%s\n%s\n' \
49+
"$HOME" \
50+
"123456789" \
51+
"com.example.telegrambots" \
52+
"Y" \
53+
"N" \
54+
| python3 configure_stack.py
55+
56+
- name: Generate stack from CI config
57+
run: |
58+
python3 bootstrap_bot_stack.py --config bot_stack.bootstrap.toml
59+
60+
- name: Build migration-ready template
61+
run: |
62+
python3 reverse_export_bot_stack.py \
63+
--source-repo "$PWD" \
64+
--launch-agents-dir "$PWD/.ci-launchagents" \
65+
--output "$PWD/bot_stack.reverse_exported.toml"
66+
python3 make_migration_ready_stack.py \
67+
--source "$PWD/bot_stack.reverse_exported.toml" \
68+
--output "$PWD/bot_stack.migration_ready.toml" \
69+
--target-home "/Users/your_user"

INSTALL.md

Lines changed: 194 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
1-
# 安装说明
1+
# 安装说明 / Installation Guide
22

3-
这份说明是给第一次接触这套框架的人准备的。
3+
这份说明是给第一次接触这套框架的人准备的。
4+
This guide is written for first-time users.
45

5-
## 1. 你需要准备什么
6+
---
7+
8+
## 中文
9+
10+
### 1. 你需要准备什么
611

712
在开始之前,请先准备:
813

@@ -21,7 +26,7 @@ git --version
2126

2227
如果其中任意一条报错,先安装对应软件,再继续下面步骤。
2328

24-
## 2. 如何创建 Telegram bot
29+
### 2. 如何创建 Telegram bot
2530

2631
在 Telegram 里搜索 `@BotFather`,然后按下面步骤做:
2732

@@ -32,14 +37,14 @@ git --version
3237

3338
如果你要用推荐的 6 bot 结构,就需要准备 6 个 token。
3439

35-
## 3. 下载项目
40+
### 3. 下载项目
3641

3742
```bash
3843
git clone https://github.com/ukgorclawbot-stack/telegram-multi-bot-stack.git
3944
cd telegram-multi-bot-stack
4045
```
4146

42-
## 4. 一键安装依赖
47+
### 4. 一键安装依赖
4348

4449
```bash
4550
bash ./install.sh
@@ -52,7 +57,7 @@ bash ./install.sh
5257
- 初始化本地目录
5358
- 准备配置模板
5459

55-
## 5. 一键生成配置
60+
### 5. 一键生成配置
5661

5762
```bash
5863
bash ./configure.sh
@@ -66,7 +71,7 @@ bash ./configure.sh
6671

6772
如果你不知道自己的 `user_id`,可以先用任意临时 bot 或现有 bot 的 `/whoami` 来查。
6873

69-
## 6. 写入 token
74+
### 6. 写入 token
7075

7176
如果你在配置向导里没有直接输入 token,就手动编辑:
7277

@@ -87,7 +92,7 @@ TG_GEMINI_PRIVATE_TOKEN=
8792
TG_CODEX_PRIVATE_TOKEN=
8893
```
8994

90-
## 7. 启动
95+
### 7. 启动
9196

9297
```bash
9398
bash ./apply_stack.sh
@@ -100,7 +105,7 @@ bash ./apply_stack.sh
100105
- 生成正式 launchd plist
101106
- 自动加载并启动服务
102107

103-
## 8. 只想先试运行
108+
### 8. 只想先试运行
104109

105110
如果你还不想真正启动,只想先看会生成什么:
106111

@@ -114,7 +119,7 @@ bash ./bootstrap_bot_stack.sh generate
114119
- `generated/bot-stack/launchd/`
115120
- `generated/bot-stack/STACK_SUMMARY.md`
116121

117-
## 9. 安装完成后怎么检查是否成功
122+
### 9. 安装完成后怎么检查是否成功
118123

119124
直接执行:
120125

@@ -123,11 +128,12 @@ bash ./health_check.sh
123128
```
124129

125130
如果安装成功,你会看到:
131+
126132
- Telegram API 检查结果
127133
- bot 服务状态
128134
- 监控和晨报状态
129135

130-
## 10. 推荐给零基础用户的完整顺序
136+
### 10. 推荐给零基础用户的完整顺序
131137

132138
按这个顺序照做最稳:
133139

@@ -141,21 +147,21 @@ bash ./apply_stack.sh
141147
bash ./health_check.sh
142148
```
143149

144-
## 11. 常见问题
150+
### 11. 常见问题
145151

146-
### 11.1 提示没找到 Python
152+
#### 11.1 提示没找到 Python
147153

148154
先安装 Python 3,再重试:
149155

150156
```bash
151157
python3 --version
152158
```
153159

154-
### 11.2 提示 token 没提供
160+
#### 11.2 提示 token 没提供
155161

156162
说明 `.bot_tokens.env` 还没写完整。
157163

158-
### 11.3 机器人没响应
164+
#### 11.3 机器人没响应
159165

160166
先检查 launchd 是否在线:
161167

@@ -168,3 +174,175 @@ launchctl list | grep telegram
168174
```bash
169175
tail -n 100 generated/bot-stack/logs/*.log
170176
```
177+
178+
---
179+
180+
## English
181+
182+
### 1. What You Need
183+
184+
Before you start, prepare:
185+
186+
1. A macOS computer
187+
2. `Python 3` installed
188+
3. `Git` installed
189+
4. `Telegram` installed
190+
5. Telegram bot tokens you plan to use
191+
192+
If you are not sure whether `Python 3` and `Git` are installed, run:
193+
194+
```bash
195+
python3 --version
196+
git --version
197+
```
198+
199+
If either command fails, install the missing software first.
200+
201+
### 2. How to Create Telegram Bots
202+
203+
In Telegram, search for `@BotFather` and follow these steps:
204+
205+
1. Send `/newbot`
206+
2. Pick a bot name
207+
3. Pick a bot username ending with `bot`
208+
4. Save the returned token
209+
210+
If you use the recommended 6-bot layout, prepare 6 tokens.
211+
212+
### 3. Clone the Project
213+
214+
```bash
215+
git clone https://github.com/ukgorclawbot-stack/telegram-multi-bot-stack.git
216+
cd telegram-multi-bot-stack
217+
```
218+
219+
### 4. Install Dependencies
220+
221+
```bash
222+
bash ./install.sh
223+
```
224+
225+
This script will automatically:
226+
227+
- create `.venv`
228+
- install Python dependencies
229+
- initialize local directories
230+
- prepare configuration templates
231+
232+
### 5. Configure the Stack
233+
234+
```bash
235+
bash ./configure.sh
236+
```
237+
238+
The wizard will ask for:
239+
240+
- your home directory
241+
- which Telegram user ID is allowed to use the bots
242+
- whether to use the recommended 6-bot layout
243+
244+
If you do not know your Telegram `user_id`, use any temporary bot or an existing bot command such as `/whoami`.
245+
246+
### 6. Fill in Bot Tokens
247+
248+
If you did not enter tokens during the wizard, edit the token file manually:
249+
250+
```bash
251+
open .bot_tokens.env
252+
```
253+
254+
Fill in one token per bot. This file is created automatically on first install.
255+
256+
For the recommended 6-bot layout, these are the main fields:
257+
258+
```bash
259+
TG_OPENCLAW_GROUP_TOKEN=
260+
TG_GEMINI_GROUP_TOKEN=
261+
TG_CODEX_GROUP_TOKEN=
262+
TG_OPENCLAW_PRIVATE_TOKEN=
263+
TG_GEMINI_PRIVATE_TOKEN=
264+
TG_CODEX_PRIVATE_TOKEN=
265+
```
266+
267+
### 7. Start the Stack
268+
269+
```bash
270+
bash ./apply_stack.sh
271+
```
272+
273+
This step will:
274+
275+
- load `.bot_tokens.env`
276+
- generate final env files
277+
- generate final launchd plist files
278+
- load and start the services automatically
279+
280+
### 8. Preview Only
281+
282+
If you do not want to start services yet and only want to preview generated files:
283+
284+
```bash
285+
bash ./bootstrap_bot_stack.sh generate
286+
```
287+
288+
Generated files will appear in:
289+
290+
- `generated/bot-stack/env/`
291+
- `generated/bot-stack/launchd/`
292+
- `generated/bot-stack/STACK_SUMMARY.md`
293+
294+
### 9. Verify the Installation
295+
296+
Run:
297+
298+
```bash
299+
bash ./health_check.sh
300+
```
301+
302+
If setup is successful, you will see:
303+
304+
- Telegram API status
305+
- bot service status
306+
- monitor and report status
307+
308+
### 10. Best Order for Beginners
309+
310+
Follow these steps in this exact order:
311+
312+
```bash
313+
git clone https://github.com/ukgorclawbot-stack/telegram-multi-bot-stack.git
314+
cd telegram-multi-bot-stack
315+
bash ./install.sh
316+
bash ./configure.sh
317+
open .bot_tokens.env
318+
bash ./apply_stack.sh
319+
bash ./health_check.sh
320+
```
321+
322+
### 11. Common Problems
323+
324+
#### 11.1 Python Not Found
325+
326+
Install Python 3 first, then retry:
327+
328+
```bash
329+
python3 --version
330+
```
331+
332+
#### 11.2 Token Missing
333+
334+
That means `.bot_tokens.env` is incomplete.
335+
336+
#### 11.3 Bots Are Not Responding
337+
338+
Check whether launchd services are loaded:
339+
340+
```bash
341+
launchctl list | grep telegram
342+
```
343+
344+
Then inspect logs:
345+
346+
```bash
347+
tail -n 100 generated/bot-stack/logs/*.log
348+
```

0 commit comments

Comments
 (0)