claude-telegram-bot 0.3.29 → 0.3.30

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.
Files changed (2) hide show
  1. package/bot.mjs +1 -24
  2. package/package.json +1 -1
package/bot.mjs CHANGED
@@ -570,33 +570,11 @@ function classifyClaudeError(raw, code) {
570
570
  return `Execution error (exit ${code}):\n${raw}`;
571
571
  }
572
572
 
573
- // ── Claude CLI 버전 탐지 ──────────────────────────────────────────────────
574
- // --print=<value> 는 구버전 CLI에 없음. 시작 시 한 번 probe해서 폴백 결정.
575
- let claudePrintStyle = "new"; // "new" = --print=<val> | "old" = -p <val>
576
-
577
- function probeClaude() {
578
- return new Promise((resolve) => {
579
- const bin = cfg.claudeBin || "claude";
580
- const child = spawn(bin, ["--help"], { env: process.env });
581
- let out = "";
582
- child.stdout.on("data", (d) => (out += d));
583
- child.stderr.on("data", (d) => (out += d));
584
- child.on("close", () => {
585
- claudePrintStyle = out.includes("--print") ? "new" : "old";
586
- if (claudePrintStyle === "old")
587
- console.warn(`[warn] claude CLI does not support --print; falling back to -p (messages starting with '-' may fail)`);
588
- resolve();
589
- });
590
- child.on("error", () => resolve()); // 탐지 실패 시 기본값(new) 유지
591
- });
592
- }
593
-
594
573
  // ── Claude 실행 ───────────────────────────────────────────────────────────
595
574
  function runClaude(prompt, sessionId, opts = {}) {
596
575
  return new Promise((resolve) => {
597
- const printArgs = claudePrintStyle === "new" ? [`--print=${prompt}`] : ["-p", prompt];
598
576
  const args = [
599
- ...printArgs,
577
+ "-p" + prompt, // 붙여쓰기로 -로 시작하는 값도 플래그로 오해 안 함
600
578
  "--output-format",
601
579
  "json",
602
580
  "--permission-mode",
@@ -1285,7 +1263,6 @@ function dispatch(msg) {
1285
1263
  // ── 롱폴링 루프 ───────────────────────────────────────────────────────────
1286
1264
  async function main() {
1287
1265
  console.log("Bot started. Polling Telegram...");
1288
- await probeClaude();
1289
1266
  // /restart 로 재시작했으면 완료 알림 1회 (플래그는 즉시 비움)
1290
1267
  if (state.restartNotify) {
1291
1268
  const to = state.restartNotify;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-telegram-bot",
3
- "version": "0.3.29",
3
+ "version": "0.3.30",
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": {