claude-telegram-bot 0.3.3 → 0.3.5

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 +19 -2
  2. package/package.json +1 -1
package/bot.mjs CHANGED
@@ -315,6 +315,19 @@ function checkLocalLock() {
315
315
  }
316
316
  }
317
317
 
318
+ // ── npm 최신 버전 확인 (/status 에서 사용) ────────────────────────────────
319
+ async function fetchLatestVersion() {
320
+ try {
321
+ const r = await fetch("https://registry.npmjs.org/claude-telegram-bot/latest", {
322
+ signal: AbortSignal.timeout(5000),
323
+ });
324
+ if (!r.ok) return null;
325
+ return (await r.json()).version || null;
326
+ } catch {
327
+ return null;
328
+ }
329
+ }
330
+
318
331
  // ── 퍼시스턴트 메모리 ─────────────────────────────────────────────────────
319
332
  // /new 로 세션을 초기화해도 유지되는 메모리. runClaude 시 시스템 프롬프트에 주입.
320
333
  function loadMemory() {
@@ -777,10 +790,14 @@ async function handle(msg) {
777
790
  return;
778
791
  }
779
792
  if (text === "/status") {
793
+ const latest = await fetchLatestVersion();
794
+ const versionStr = !latest || latest === VERSION
795
+ ? VERSION
796
+ : `${VERSION} → ${latest} ✨`;
780
797
  await send(
781
798
  chatId,
782
799
  t(l, "status", {
783
- version: VERSION,
800
+ version: versionStr,
784
801
  name: cfg.name || "claude-telegram-bot",
785
802
  model: state.model || cfg.model || (l === "ko" ? "(기본값)" : "(default)"),
786
803
  hasSession: Boolean(state.sessionId),
@@ -978,7 +995,7 @@ async function main() {
978
995
  }
979
996
  for (const upd of res.result) {
980
997
  offset = upd.update_id + 1;
981
- if (upd.message) await handle(upd.message);
998
+ if (upd.message) handle(upd.message).catch((e) => console.error("Handle error:", e.message));
982
999
  }
983
1000
  } catch (e) {
984
1001
  console.error("Polling error:", e.message);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-telegram-bot",
3
- "version": "0.3.3",
3
+ "version": "0.3.5",
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": {