Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/commands/telegram.ts
Original file line number Diff line number Diff line change
Expand Up @@ -952,6 +952,7 @@ async function registerBotCommands(token: string): Promise<void> {
// --- Polling loop ---

let running = true;
let isPolling = false;

async function poll(): Promise<void> {
const config = getSettings().telegram;
Expand Down Expand Up @@ -1030,12 +1031,15 @@ process.on("SIGINT", () => { running = false; });

/** Start polling in-process (called by start.ts when token is configured) */
export function startPolling(debug = false): void {
if (isPolling) return;
isPolling = true;
telegramDebug = debug;
(async () => {
await ensureProjectClaudeMd();
await poll();
})().catch((err) => {
console.error(`[Telegram] Fatal: ${err}`);
isPolling = false;
});
}

Expand Down