dsh-tg-bridge 1.19.6 → 1.19.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/QUICKSTART.md +138 -138
- package/cli.mjs +237 -231
- package/docs/REFACTORING.md +103 -0
- package/i18n/en.mjs +645 -0
- package/i18n/ru.mjs +645 -0
- package/i18n/zh.mjs +645 -0
- package/i18n.mjs +4 -1928
- package/install.ps1 +61 -61
- package/install.sh +118 -118
- package/package.json +6 -2
- package/setup.mjs +349 -347
- package/sync-runtime.mjs +27 -6
package/QUICKSTART.md
CHANGED
|
@@ -1,139 +1,139 @@
|
|
|
1
|
-
# Quickstart: from zero to a bot that answers
|
|
2
|
-
|
|
3
|
-
Written for someone who has never made a Telegram bot and does not know what a
|
|
4
|
-
profile is. Twelve minutes, most of it waiting for the bot to say hello.
|
|
5
|
-
|
|
6
|
-
If an AI agent is helping you, skip to [For agents](#for-agents): it can do
|
|
7
|
-
steps 2–5 for you and only needs your answers to three questions.
|
|
8
|
-
|
|
9
|
-
---
|
|
10
|
-
|
|
11
|
-
## 0. What you need before you start
|
|
12
|
-
|
|
13
|
-
- **Node.js
|
|
14
|
-
the command is missing, install Node from [nodejs.org](https://nodejs.org) first
|
|
15
|
-
— nothing below works without it.
|
|
16
|
-
- **A computer that stays on.** The bot runs on your machine, not in a cloud.
|
|
17
|
-
Laptop is fine; it answers only while awake.
|
|
18
|
-
- **DeepSeek Harness**, the app this bridge connects to Telegram.
|
|
19
|
-
- **Ten minutes and your phone.**
|
|
20
|
-
|
|
21
|
-
## 1. Make a bot in Telegram
|
|
22
|
-
|
|
23
|
-
1. Open Telegram and search for **@BotFather** (the one with the blue checkmark).
|
|
24
|
-
2. Press **Start**, then send `/newbot`.
|
|
25
|
-
3. It asks for a **name** — anything people will see: `My work bot`.
|
|
26
|
-
4. It asks for a **username**, which must end in `bot`:
|
|
27
|
-
`my_work_2026_bot`. If it says the name is taken, add a word.
|
|
28
|
-
5. BotFather answers with a line like
|
|
29
|
-
`Use this token to access the HTTP API: 123456789:AAH...` — that is your
|
|
30
|
-
**token**. Treat it like a password: anyone with it controls your bot.
|
|
31
|
-
|
|
32
|
-
Optional but recommended in the same chat:
|
|
33
|
-
|
|
34
|
-
- `/setprivacy` → **Disable** — only needed for groups; without it the bot sees
|
|
35
|
-
commands there but not ordinary text.
|
|
36
|
-
- `/setjoingroups` → **Enable** — if you want to use it in a group at all.
|
|
37
|
-
|
|
38
|
-
## 2. Tell the bridge about the token
|
|
39
|
-
|
|
40
|
-
```bash
|
|
41
|
-
npx dsh-tg-bridge@latest init --token <the token> --user <your id>
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
- **`<the token>`** — the line from step 1, in quotes if your shell needs it.
|
|
45
|
-
- **`<your id>`** — the number Telegram gives you. Don't know it? Send `/start`
|
|
46
|
-
to **@userinfobot** and copy the `Id:` line. The bridge answers only this
|
|
47
|
-
account; anyone else is ignored.
|
|
48
|
-
|
|
49
|
-
`init` writes the token to `~/.dsh/.credentials.yaml` (never to the project
|
|
50
|
-
folder) and your id to `~/.dsh/tg-bridge/config.json`. Add `--cwd D:\work` if your
|
|
51
|
-
projects live somewhere other than `~/Projects`, and `--dry-run` to see what it
|
|
52
|
-
would write without writing.
|
|
53
|
-
|
|
54
|
-
## 3. Start the bridge
|
|
55
|
-
|
|
56
|
-
```bash
|
|
57
|
-
npx dsh-tg-bridge@latest setup
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
This registers the bridge so it starts with your session and runs it once. It
|
|
61
|
-
ends with `ok new bridge pid <number>` — that number is the running bridge. A
|
|
62
|
-
failure here is almost always one of the three things in [If it does not
|
|
63
|
-
work](#if-it-does-not-work).
|
|
64
|
-
|
|
65
|
-
## 4. Say hello
|
|
66
|
-
|
|
67
|
-
1. In Telegram, open your bot (BotFather gives you a `t.me/...` link) and press
|
|
68
|
-
**Start**.
|
|
69
|
-
2. Send `hi`.
|
|
70
|
-
|
|
71
|
-
You should see two messages: a short "got it" and then the answer. If you see a
|
|
72
|
-
progress line with a spinner instead, it is working — the answer follows.
|
|
73
|
-
|
|
74
|
-
## 5. Make it yours
|
|
75
|
-
|
|
76
|
-
Everything below is typed in the chat, not in a terminal.
|
|
77
|
-
|
|
78
|
-
| What you want | Type |
|
|
79
|
-
|---|---|
|
|
80
|
-
| Work on a project folder | `/cd /path/to/project` |
|
|
81
|
-
| A separate space per project | turn on **Topics** in the group, one topic per project, `/cd` in each |
|
|
82
|
-
| Cheaper or stronger model | `/model` then pick, or `/model <id>` |
|
|
83
|
-
| More freedom for commands | `/permissions` |
|
|
84
|
-
| See what it is doing | it posts a live progress message; `/thoughts` toggles the 💭 notes |
|
|
85
|
-
| A plan you can tick off | `/goal <what done looks like>`, then `/task <step>`, then bare `/task` to tap items |
|
|
86
|
-
| Stop a long answer | `/stop` |
|
|
87
|
-
| Tell me about new versions, or stop | /update on / /update off — neither one installs anything |
|
|
88
|
-
| Install an update, then load it | /update confirm, then /restart confirm |
|
|
89
|
-
| Everything it can do | `/help` |
|
|
90
|
-
|
|
91
|
-
`/lang` pins the reply language; without it the bridge answers in the language your
|
|
92
|
-
write in (Russian, Chinese, otherwise English).
|
|
93
|
-
|
|
94
|
-
---
|
|
95
|
-
|
|
96
|
-
## If it does not work
|
|
97
|
-
|
|
98
|
-
| What you see | What it means |
|
|
99
|
-
|---|---|
|
|
100
|
-
| Nothing at all after `hi` | The id in `config.json` is not yours, or the bridge is not running: `npx dsh-tg-bridge@latest setup` again and read its output. |
|
|
101
|
-
| `401 Unauthorized` | The token is wrong or was revoked by BotFather. Run `init` again with a fresh token. |
|
|
102
|
-
| Works in private chat, silent in a group | Privacy mode is on: `/setprivacy` → Disable, then remove and re-add the bot to the group. |
|
|
103
|
-
| `Error [ERR_MODULE_NOT_FOUND]` on start | The running copy is older than the files it imports. A global install never updates itself: `npm i -g dsh-tg-bridge@latest`, then `/restart confirm` in the chat. With `npx` this cannot happen — `npx dsh-tg-bridge@latest` fetches the newest release on every launch. |
|
|
104
|
-
| Bot answers in the wrong language | `/lang ru` / `/lang en` / `/lang zh` — one command pins it for the topic. |
|
|
105
|
-
| Two answers to one message | Another copy of the bridge is running: `/status` shows the pid, kill the duplicate. |
|
|
106
|
-
|
|
107
|
-
Still stuck: `/doctor` in the chat, or `npx dsh-tg-bridge@latest check` in a
|
|
108
|
-
terminal — both print what is missing and how to fix it.
|
|
109
|
-
|
|
110
|
-
---
|
|
111
|
-
|
|
112
|
-
## For agents
|
|
113
|
-
|
|
114
|
-
An agent helping a person needs three answers, then can do the rest:
|
|
115
|
-
|
|
116
|
-
1. **What is the bot for** — a project folder, a chat with themselves, or a team
|
|
117
|
-
group? This decides `--cwd` and whether `--user` must be added to a group.
|
|
118
|
-
2. **Do they have a bot token already** — from [@BotFather](https://t.me/BotFather)?
|
|
119
|
-
If not, walk them through step 1 of this file; it cannot be automated.
|
|
120
|
-
3. **Which OS** — Windows, macOS or Linux; it changes where the background start
|
|
121
|
-
lives, not what the bridge does.
|
|
122
|
-
|
|
123
|
-
Then:
|
|
124
|
-
|
|
125
|
-
```bash
|
|
126
|
-
npx dsh-tg-bridge@latest check # what is missing right now
|
|
127
|
-
npx dsh-tg-bridge@latest init --token <token> --user <id> [--cwd <path>] [--dry-run]
|
|
128
|
-
npx dsh-tg-bridge@latest setup # register autostart and start
|
|
129
|
-
npx dsh-tg-bridge@latest menu # push the command menu to Telegram
|
|
130
|
-
```
|
|
131
|
-
|
|
132
|
-
Verify with a real message, not with logs: ask the person to send `hi` and wait
|
|
133
|
-
for the answer before declaring success. `check` reporting success only means the
|
|
134
|
-
files are in place.
|
|
135
|
-
|
|
136
|
-
Never echo the token into a transcript, a commit, or a file inside a repository:
|
|
137
|
-
`init` puts it in `~/.dsh/.credentials.yaml` and nothing else should hold it.
|
|
138
|
-
If you keep notes, keep them outside the repo — `scan-secrets.mjs` refuses tokens,
|
|
1
|
+
# Quickstart: from zero to a bot that answers
|
|
2
|
+
|
|
3
|
+
Written for someone who has never made a Telegram bot and does not know what a
|
|
4
|
+
profile is. Twelve minutes, most of it waiting for the bot to say hello.
|
|
5
|
+
|
|
6
|
+
If an AI agent is helping you, skip to [For agents](#for-agents): it can do
|
|
7
|
+
steps 2–5 for you and only needs your answers to three questions.
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## 0. What you need before you start
|
|
12
|
+
|
|
13
|
+
- **Node.js 24 or newer.** Check with `node --version`. If the number is lower or
|
|
14
|
+
the command is missing, install Node from [nodejs.org](https://nodejs.org) first
|
|
15
|
+
— nothing below works without it.
|
|
16
|
+
- **A computer that stays on.** The bot runs on your machine, not in a cloud.
|
|
17
|
+
Laptop is fine; it answers only while awake.
|
|
18
|
+
- **DeepSeek Harness**, the app this bridge connects to Telegram.
|
|
19
|
+
- **Ten minutes and your phone.**
|
|
20
|
+
|
|
21
|
+
## 1. Make a bot in Telegram
|
|
22
|
+
|
|
23
|
+
1. Open Telegram and search for **@BotFather** (the one with the blue checkmark).
|
|
24
|
+
2. Press **Start**, then send `/newbot`.
|
|
25
|
+
3. It asks for a **name** — anything people will see: `My work bot`.
|
|
26
|
+
4. It asks for a **username**, which must end in `bot`:
|
|
27
|
+
`my_work_2026_bot`. If it says the name is taken, add a word.
|
|
28
|
+
5. BotFather answers with a line like
|
|
29
|
+
`Use this token to access the HTTP API: 123456789:AAH...` — that is your
|
|
30
|
+
**token**. Treat it like a password: anyone with it controls your bot.
|
|
31
|
+
|
|
32
|
+
Optional but recommended in the same chat:
|
|
33
|
+
|
|
34
|
+
- `/setprivacy` → **Disable** — only needed for groups; without it the bot sees
|
|
35
|
+
commands there but not ordinary text.
|
|
36
|
+
- `/setjoingroups` → **Enable** — if you want to use it in a group at all.
|
|
37
|
+
|
|
38
|
+
## 2. Tell the bridge about the token
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
npx dsh-tg-bridge@latest init --token <the token> --user <your id>
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
- **`<the token>`** — the line from step 1, in quotes if your shell needs it.
|
|
45
|
+
- **`<your id>`** — the number Telegram gives you. Don't know it? Send `/start`
|
|
46
|
+
to **@userinfobot** and copy the `Id:` line. The bridge answers only this
|
|
47
|
+
account; anyone else is ignored.
|
|
48
|
+
|
|
49
|
+
`init` writes the token to `~/.dsh/.credentials.yaml` (never to the project
|
|
50
|
+
folder) and your id to `~/.dsh/tg-bridge/config.json`. Add `--cwd D:\work` if your
|
|
51
|
+
projects live somewhere other than `~/Projects`, and `--dry-run` to see what it
|
|
52
|
+
would write without writing.
|
|
53
|
+
|
|
54
|
+
## 3. Start the bridge
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
npx dsh-tg-bridge@latest setup
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
This registers the bridge so it starts with your session and runs it once. It
|
|
61
|
+
ends with `ok new bridge pid <number>` — that number is the running bridge. A
|
|
62
|
+
failure here is almost always one of the three things in [If it does not
|
|
63
|
+
work](#if-it-does-not-work).
|
|
64
|
+
|
|
65
|
+
## 4. Say hello
|
|
66
|
+
|
|
67
|
+
1. In Telegram, open your bot (BotFather gives you a `t.me/...` link) and press
|
|
68
|
+
**Start**.
|
|
69
|
+
2. Send `hi`.
|
|
70
|
+
|
|
71
|
+
You should see two messages: a short "got it" and then the answer. If you see a
|
|
72
|
+
progress line with a spinner instead, it is working — the answer follows.
|
|
73
|
+
|
|
74
|
+
## 5. Make it yours
|
|
75
|
+
|
|
76
|
+
Everything below is typed in the chat, not in a terminal.
|
|
77
|
+
|
|
78
|
+
| What you want | Type |
|
|
79
|
+
|---|---|
|
|
80
|
+
| Work on a project folder | `/cd /path/to/project` |
|
|
81
|
+
| A separate space per project | turn on **Topics** in the group, one topic per project, `/cd` in each |
|
|
82
|
+
| Cheaper or stronger model | `/model` then pick, or `/model <id>` |
|
|
83
|
+
| More freedom for commands | `/permissions` |
|
|
84
|
+
| See what it is doing | it posts a live progress message; `/thoughts` toggles the 💭 notes |
|
|
85
|
+
| A plan you can tick off | `/goal <what done looks like>`, then `/task <step>`, then bare `/task` to tap items |
|
|
86
|
+
| Stop a long answer | `/stop` |
|
|
87
|
+
| Tell me about new versions, or stop | /update on / /update off — neither one installs anything |
|
|
88
|
+
| Install an update, then load it | /update confirm, then /restart confirm |
|
|
89
|
+
| Everything it can do | `/help` |
|
|
90
|
+
|
|
91
|
+
`/lang` pins the reply language; without it the bridge answers in the language your
|
|
92
|
+
write in (Russian, Chinese, otherwise English).
|
|
93
|
+
|
|
94
|
+
---
|
|
95
|
+
|
|
96
|
+
## If it does not work
|
|
97
|
+
|
|
98
|
+
| What you see | What it means |
|
|
99
|
+
|---|---|
|
|
100
|
+
| Nothing at all after `hi` | The id in `config.json` is not yours, or the bridge is not running: `npx dsh-tg-bridge@latest setup` again and read its output. |
|
|
101
|
+
| `401 Unauthorized` | The token is wrong or was revoked by BotFather. Run `init` again with a fresh token. |
|
|
102
|
+
| Works in private chat, silent in a group | Privacy mode is on: `/setprivacy` → Disable, then remove and re-add the bot to the group. |
|
|
103
|
+
| `Error [ERR_MODULE_NOT_FOUND]` on start | The running copy is older than the files it imports. A global install never updates itself: `npm i -g dsh-tg-bridge@latest`, then `/restart confirm` in the chat. With `npx` this cannot happen — `npx dsh-tg-bridge@latest` fetches the newest release on every launch. |
|
|
104
|
+
| Bot answers in the wrong language | `/lang ru` / `/lang en` / `/lang zh` — one command pins it for the topic. |
|
|
105
|
+
| Two answers to one message | Another copy of the bridge is running: `/status` shows the pid, kill the duplicate. |
|
|
106
|
+
|
|
107
|
+
Still stuck: `/doctor` in the chat, or `npx dsh-tg-bridge@latest check` in a
|
|
108
|
+
terminal — both print what is missing and how to fix it.
|
|
109
|
+
|
|
110
|
+
---
|
|
111
|
+
|
|
112
|
+
## For agents
|
|
113
|
+
|
|
114
|
+
An agent helping a person needs three answers, then can do the rest:
|
|
115
|
+
|
|
116
|
+
1. **What is the bot for** — a project folder, a chat with themselves, or a team
|
|
117
|
+
group? This decides `--cwd` and whether `--user` must be added to a group.
|
|
118
|
+
2. **Do they have a bot token already** — from [@BotFather](https://t.me/BotFather)?
|
|
119
|
+
If not, walk them through step 1 of this file; it cannot be automated.
|
|
120
|
+
3. **Which OS** — Windows, macOS or Linux; it changes where the background start
|
|
121
|
+
lives, not what the bridge does.
|
|
122
|
+
|
|
123
|
+
Then:
|
|
124
|
+
|
|
125
|
+
```bash
|
|
126
|
+
npx dsh-tg-bridge@latest check # what is missing right now
|
|
127
|
+
npx dsh-tg-bridge@latest init --token <token> --user <id> [--cwd <path>] [--dry-run]
|
|
128
|
+
npx dsh-tg-bridge@latest setup # register autostart and start
|
|
129
|
+
npx dsh-tg-bridge@latest menu # push the command menu to Telegram
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
Verify with a real message, not with logs: ask the person to send `hi` and wait
|
|
133
|
+
for the answer before declaring success. `check` reporting success only means the
|
|
134
|
+
files are in place.
|
|
135
|
+
|
|
136
|
+
Never echo the token into a transcript, a commit, or a file inside a repository:
|
|
137
|
+
`init` puts it in `~/.dsh/.credentials.yaml` and nothing else should hold it.
|
|
138
|
+
If you keep notes, keep them outside the repo — `scan-secrets.mjs` refuses tokens,
|
|
139
139
|
personal ids and home paths on every commit.
|