mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 16:08:27 +00:00
feat: added capability for clawdbot to react
This commit is contained in:
committed by
Peter Steinberger
parent
d05c3d0659
commit
0e1dcf9cb4
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user