claude-telegram-bot 0.2.0 → 0.2.2
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/README.ko.md +3 -0
- package/README.md +9 -0
- package/bot.mjs +0 -0
- package/config.example.json +6 -5
- package/package.json +1 -1
package/README.ko.md
CHANGED
|
@@ -93,6 +93,7 @@ claude-telegram-bot ~/botconfigs/myproj/config.json
|
|
|
93
93
|
| `claudeBin` | `which claude` 결과 (절대경로 권장) |
|
|
94
94
|
| `permissionMode` | `plan`(읽기·계획만) / `acceptEdits`(편집 자동 승인) / `bypassPermissions`(쉘 포함 전부 자동) |
|
|
95
95
|
| `model` | 비우면 기본 모델. `opus`, `sonnet` 등 |
|
|
96
|
+
| `lang` | (선택) UI 언어. 비우면 사용자별 자동 판별(기본 영어, 텔레그램이 한국어면 한국어). `"en"`/`"ko"`로 고정 가능 |
|
|
96
97
|
| `name` | (선택) `/help`에 표시되는 봇 이름. 여러 봇 구분용 |
|
|
97
98
|
| `persona` | (선택) 역할 시스템 프롬프트. 페르소나 봇 정의용 |
|
|
98
99
|
| `appendSystemPrompt` | (선택) 기본 "간결하게 답하기" 지침을 직접 덮어쓸 때 |
|
|
@@ -117,6 +118,7 @@ claude-telegram-bot ~/botconfigs/myproj/config.json
|
|
|
117
118
|
|
|
118
119
|
- **세션 유지** — 대화는 `--resume`으로 자동으로 이어집니다. 마지막 세션 ID가 `state.json`에 저장되므로 봇을 재시작해도 맥락이 남습니다. 새로 시작하려면 `/new`.
|
|
119
120
|
- **간결한 답변** — 텔레그램에 맞게 짧게 답하도록 시스템 프롬프트가 기본으로 붙습니다. 바꾸려면 `appendSystemPrompt`에 직접 넣으세요 (빈 문자열이면 끔).
|
|
121
|
+
- **언어** — 봇 자체 문구(`/help`, 명령 메뉴, 상태 메시지)는 **기본 영어**, 텔레그램이 한국어인 사용자에겐 한국어로 나옵니다. `lang`(`"en"`/`"ko"`)으로 고정할 수 있습니다. Claude의 실제 답변은 **사용자가 쓴 언어**를 따라갑니다. `/` 명령 메뉴는 `setMyCommands`로 언어별 등록됩니다.
|
|
120
122
|
- **서식 변환** — 답변의 마크다운(굵게·코드·표 등)을 텔레그램 HTML로 바꿔 보냅니다. 변환이 깨지는 경우엔 평문으로 다시 보냅니다.
|
|
121
123
|
- **첨부 파일** — 사진·문서·음성·영상을 보내면 `attachments/`에 내려받고, 그 경로를 Claude에게 전달합니다(캡션도 함께). 이미지는 Read로 열어볼 수 있습니다.
|
|
122
124
|
|
|
@@ -134,6 +136,7 @@ config에 `schedule` 배열을 두면 정해진 시각에 프롬프트를 자동
|
|
|
134
136
|
- **`cron`** — 표준 5필드 `분 시 일 월 요일` (예: `0 9 * * 1-5` = 평일 09:00). `*`, 목록(`1,3,5`), 범위(`1-5`), 스텝(`*/15`)을 지원합니다. 요일 `0`과 `7`은 둘 다 일요일. 시각은 **호스트의 로컬 시간대** 기준입니다. 외부 의존성 없이 파서가 `bot.mjs` 안에 들어 있습니다.
|
|
135
137
|
- **`prompt`**(필수) — Claude에게 보낼 메시지. **`label`**(선택) — 답장 푸터와 `/cron` 목록에 표시되는 짧은 이름.
|
|
136
138
|
- **새 세션** — 예약 작업은 **독립된 세션**으로 돌아가서 내 대화 맥락을 오염시키지 않습니다(`state.json`은 내 것 그대로). 단일 작업 락을 공유하므로, 발사 시점에 다른 작업이 진행 중이면 그 회차는 **건너뜁니다**(로그 남김).
|
|
139
|
+
- **조용한 작업(조건부 알림)** — Claude의 출력이 **비었거나 정확히 `SKIP`**이면 그 회차는 텔레그램으로 **아무것도 보내지 않습니다**. "조건이 맞을 때만 알리고 평소엔 조용히" 하고 싶을 때, 프롬프트에 *"조건이 아니면 다른 말 없이 `SKIP`만 출력해"* 라고 적으면 됩니다. 자주 도는 작업(예: 5분마다)도 스팸 없이 쓸 수 있습니다.
|
|
137
140
|
|
|
138
141
|
**채팅에서 자연어로 추가하기**
|
|
139
142
|
|
package/README.md
CHANGED
|
@@ -185,6 +185,7 @@ Edit `config.json`:
|
|
|
185
185
|
| `claudeBin` | Output of `which claude` (absolute path recommended) |
|
|
186
186
|
| `permissionMode` | `plan` / `acceptEdits` / `bypassPermissions` — see [Security](#security) |
|
|
187
187
|
| `model` | Empty = default. Or `opus` / `sonnet`, etc. |
|
|
188
|
+
| `lang` | (optional) UI language. Empty = auto-detect per user (English default, Korean for Korean Telegram clients). Force with `"en"` / `"ko"`. |
|
|
188
189
|
| `name` | (optional) Bot name shown in `/help` — handy for telling multiple bots apart |
|
|
189
190
|
| `persona` | (optional) Role system prompt — defines a persona (developer/planner/…). See below |
|
|
190
191
|
| `appendSystemPrompt` | (optional) Override the default "be concise for Telegram" instruction |
|
|
@@ -198,6 +199,10 @@ projects stay isolated.
|
|
|
198
199
|
|
|
199
200
|
- **Concise mode**: a `--append-system-prompt` is applied by default so replies stay short for
|
|
200
201
|
Telegram. Override it via `appendSystemPrompt` (empty string disables it).
|
|
202
|
+
- **Language**: the bot's own messages (`/help`, command menu, status text) are English by default
|
|
203
|
+
and switch to Korean for users whose Telegram client is Korean. Force one language with `lang`
|
|
204
|
+
(`"en"`/`"ko"`). Claude's actual replies follow the language you write in, regardless. The `/`
|
|
205
|
+
command menu is registered per-language via `setMyCommands`.
|
|
201
206
|
- **Formatting**: the reply's Markdown (bold/code/headings/tables) is converted to Telegram-safe
|
|
202
207
|
HTML. If conversion ever produces invalid HTML, the message is automatically resent as plain text.
|
|
203
208
|
- **Attachments**: send a photo/document/voice/video and it's downloaded into `attachments/`; the
|
|
@@ -226,6 +231,10 @@ checks, reminders. Each entry runs the prompt and sends the result to `allowedCh
|
|
|
226
231
|
- **Fresh session**: scheduled jobs run in their **own session** so they never pollute your
|
|
227
232
|
interactive conversation context (`state.json` stays yours). They share the single-task lock,
|
|
228
233
|
so a job is **skipped** (logged) if a task is already running when it fires.
|
|
234
|
+
- **Silent jobs (conditional alerts)**: if Claude's output is **empty or exactly `SKIP`**, that run
|
|
235
|
+
sends **nothing** to Telegram. To get "alert only when it matters, stay quiet otherwise," tell the
|
|
236
|
+
prompt to *output just `SKIP` when the condition isn't met*. This lets even frequent jobs (e.g.
|
|
237
|
+
every 5 minutes) run without spamming the chat.
|
|
229
238
|
|
|
230
239
|
**Add jobs from the chat — in plain language:**
|
|
231
240
|
|
package/bot.mjs
CHANGED
|
Binary file
|
package/config.example.json
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
{
|
|
2
|
-
"name": "
|
|
3
|
-
"token": "
|
|
2
|
+
"name": "Bot name (shown in /help, for telling bots apart; optional)",
|
|
3
|
+
"token": "BOT_TOKEN_FROM_BOTFATHER",
|
|
4
4
|
"allowedChatId": "",
|
|
5
5
|
"projectDir": "/ABSOLUTE/PATH/TO/PROJECT",
|
|
6
|
-
"claudeBin": "/
|
|
6
|
+
"claudeBin": "/ABSOLUTE/PATH/TO/claude",
|
|
7
7
|
"permissionMode": "bypassPermissions",
|
|
8
8
|
"model": "",
|
|
9
|
-
"
|
|
9
|
+
"lang": "",
|
|
10
|
+
"persona": "System prompt defining this bot's role/voice (optional). Used to differentiate persona bots (developer/planner/...).",
|
|
10
11
|
"appendSystemPrompt": "",
|
|
11
12
|
"env": {},
|
|
12
13
|
"schedule": [
|
|
13
|
-
{ "cron": "0 9 * * 1-5", "label": "
|
|
14
|
+
{ "cron": "0 9 * * 1-5", "label": "Morning brief", "prompt": "Summarize today's open issues and TODOs (optional; standard 5-field cron: min hour day month weekday)" }
|
|
14
15
|
]
|
|
15
16
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "claude-telegram-bot",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2",
|
|
4
4
|
"description": "Drive Claude Code from Telegram — messages run headless `claude -p` in a project dir and replies come back to the chat. Zero dependencies.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|