claude-telegram-bot 0.2.1 → 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 +1 -0
- package/README.md +4 -0
- package/bot.mjs +9 -0
- package/package.json +1 -1
package/README.ko.md
CHANGED
|
@@ -136,6 +136,7 @@ config에 `schedule` 배열을 두면 정해진 시각에 프롬프트를 자동
|
|
|
136
136
|
- **`cron`** — 표준 5필드 `분 시 일 월 요일` (예: `0 9 * * 1-5` = 평일 09:00). `*`, 목록(`1,3,5`), 범위(`1-5`), 스텝(`*/15`)을 지원합니다. 요일 `0`과 `7`은 둘 다 일요일. 시각은 **호스트의 로컬 시간대** 기준입니다. 외부 의존성 없이 파서가 `bot.mjs` 안에 들어 있습니다.
|
|
137
137
|
- **`prompt`**(필수) — Claude에게 보낼 메시지. **`label`**(선택) — 답장 푸터와 `/cron` 목록에 표시되는 짧은 이름.
|
|
138
138
|
- **새 세션** — 예약 작업은 **독립된 세션**으로 돌아가서 내 대화 맥락을 오염시키지 않습니다(`state.json`은 내 것 그대로). 단일 작업 락을 공유하므로, 발사 시점에 다른 작업이 진행 중이면 그 회차는 **건너뜁니다**(로그 남김).
|
|
139
|
+
- **조용한 작업(조건부 알림)** — Claude의 출력이 **비었거나 정확히 `SKIP`**이면 그 회차는 텔레그램으로 **아무것도 보내지 않습니다**. "조건이 맞을 때만 알리고 평소엔 조용히" 하고 싶을 때, 프롬프트에 *"조건이 아니면 다른 말 없이 `SKIP`만 출력해"* 라고 적으면 됩니다. 자주 도는 작업(예: 5분마다)도 스팸 없이 쓸 수 있습니다.
|
|
139
140
|
|
|
140
141
|
**채팅에서 자연어로 추가하기**
|
|
141
142
|
|
package/README.md
CHANGED
|
@@ -231,6 +231,10 @@ checks, reminders. Each entry runs the prompt and sends the result to `allowedCh
|
|
|
231
231
|
- **Fresh session**: scheduled jobs run in their **own session** so they never pollute your
|
|
232
232
|
interactive conversation context (`state.json` stays yours). They share the single-task lock,
|
|
233
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.
|
|
234
238
|
|
|
235
239
|
**Add jobs from the chat — in plain language:**
|
|
236
240
|
|
package/bot.mjs
CHANGED
|
@@ -435,6 +435,15 @@ async function runScheduled(job) {
|
|
|
435
435
|
const started = Date.now();
|
|
436
436
|
try {
|
|
437
437
|
const res = await runClaude(job.prompt, undefined); // 새 세션 (state 미저장)
|
|
438
|
+
// 조용한 예약 작업: 출력이 비었거나 정확히 "SKIP"이면 전송하지 않는다.
|
|
439
|
+
// (예: "조건 충족 시에만 알리고, 아니면 SKIP만 출력해" 식의 조건부 알림용)
|
|
440
|
+
if (res.ok) {
|
|
441
|
+
const body = (res.text || "").trim();
|
|
442
|
+
if (!body || /^skip$/i.test(body)) {
|
|
443
|
+
console.log(`Scheduled job suppressed (empty/SKIP): ${job.label || job.cron}`);
|
|
444
|
+
return;
|
|
445
|
+
}
|
|
446
|
+
}
|
|
438
447
|
const secs = Math.round((Date.now() - started) / 1000);
|
|
439
448
|
const label = job.label || job.cron;
|
|
440
449
|
const footer = res.ok
|
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": {
|