feat: telegram bot (grammy webhook) — full parity channel

- pairing (admin code -> chat link), bundling of forwarded images via drafts+quiet-window sweeper
- recipe pick via inline keyboard, job (origin=telegram) creation, one summary reply with result files + links
- compressed-photo detection/flag; /start /help /rezepte /status
- webhook route (secret token), admin pairing-code + links endpoints, AdminApp telegram section
- worker notifies chat on completion; migration 002 adds jobs.telegram_chat_id; setupTelegram on init
This commit is contained in:
2026-07-23 17:39:49 +00:00
parent 26c3e0ef07
commit d680b3f67a
8 changed files with 342 additions and 4 deletions
+9 -1
View File
@@ -56,6 +56,14 @@ async function maybeComplete(jobId: string): Promise<void> {
[jobId]);
// Picdrop-Auslieferung für alle offenen Positionen anstoßen.
try { await deliverPendingForJob(jobId); } catch (e) { console.error('[worker] Auslieferung:', e); }
// TODO: Benachrichtigung (Telegram/n8n).
// Telegram-Rückmeldung, wenn der Auftrag aus einem Chat kam.
const jt = await one<{ origin: string; telegram_chat_id: string | null }>(
'SELECT origin, telegram_chat_id FROM jobs WHERE id=$1', [jobId]);
if (jt?.origin === 'telegram' && jt.telegram_chat_id) {
try {
const { notifyJobDone } = await import('./lib/telegram');
await notifyJobDone(Number(jt.telegram_chat_id), jobId);
} catch (e) { console.error('[worker] Telegram-Notify:', e); }
}
}
}