feat: added capability for clawdbot to react

This commit is contained in:
Bohdan Podvirnyi
2026-01-13 21:34:40 +02:00
committed by Peter Steinberger
parent d05c3d0659
commit 0e1dcf9cb4
12 changed files with 503 additions and 56 deletions

View File

@@ -33,6 +33,11 @@ export function createTelegramRunnerOptions(cfg: ClawdbotConfig): RunOptions<unk
fetch: {
// Match grammY defaults
timeout: 30,
// Request reaction updates from Telegram
allowed_updates: [
"message",
"message_reaction",
],
},
// Suppress grammY getUpdates stack traces; we log concise errors ourselves.
silent: true,
@@ -112,6 +117,21 @@ export async function monitorTelegramProvider(opts: MonitorTelegramOpts = {}) {
},
});
// When using polling mode, ensure no webhook is active
if (!opts.useWebhook) {
try {
const webhookInfo = await bot.api.getWebhookInfo();
if (webhookInfo.url) {
await bot.api.deleteWebhook({ drop_pending_updates: false });
log(`telegram: deleted webhook to enable polling`);
}
} catch (err) {
(opts.runtime?.error ?? console.error)(
`telegram: failed to check/delete webhook: ${String(err)}`,
);
}
}
if (opts.useWebhook) {
await startTelegramWebhook({
token,