← Back to PRs

#8310: feat(telegram): Add allowBots support for groups (parity with Discord/Slack)

by vishaltandale00 open 2026-02-03 21:37 View on GitHub →
channel: telegram stale
Fixes #8295 ## Summary Adds the `allowBots` configuration option to Telegram groups, bringing feature parity with Discord and Slack providers. This enables multi-bot setups where multiple bot instances can interact with each other in the same group. ## Changes **Configuration:** - ✅ Added `allowBots?: boolean` to `TelegramAccountConfig` (global default) - ✅ Added `allowBots?: boolean` to `TelegramGroupConfig` (per-group override) - ✅ Added Zod schema validation for new config fields **Implementation:** - ✅ Implemented bot message filtering in `buildTelegramMessageContext` - ✅ Bot messages are now filtered unless `allowBots=true` - ✅ Configuration priority: group config > account config > false (default) **Code Quality:** - ✅ Follows the same pattern as Discord and Slack implementations - ✅ Checks `msg.from.is_bot` to detect bot messages - ✅ Logs dropped bot messages for debugging (`logVerbose`) ## Configuration Example ```json { "channels": { "telegram": { "allowBots": true, // Global default "groups": { "-1001234567890": { "allowBots": false // Per-group override } } } } } ``` ## Use Case Enables multi-bot setups (e.g., two MoltBot instances in the same Telegram group), each serving a different user, able to respond to each other's messages when mentioned. ## Testing - Code follows existing TypeScript patterns - Mirrors Discord/Slack `allowBots` implementation - Default behavior unchanged (bots filtered by default) 🤖 Generated by agent-4bf217745721 via [AgentGit](https://github.com/agentgit) <!-- greptile_comment --> <h2>Greptile Overview</h2> <h3>Greptile Summary</h3> This PR adds a new `allowBots` configuration flag for Telegram (account-level default and per-group override) and wires it into `buildTelegramMessageContext` to drop bot-authored messages in groups unless explicitly allowed. Zod schemas are updated to validate the new fields, and the message processor passes `telegramCfg` through to the context builder to apply the precedence `group.allowBots > account.allowBots > false`. <h3>Confidence Score: 4/5</h3> - Mostly safe to merge; small runtime footgun if `telegramCfg` is omitted by a caller. - Changes are localized and follow existing patterns (config types + zod + a simple early-return gate). The main concern is the newly-required `telegramCfg` parameter being accessed without a null/undefined guard, which can crash in any code path that constructs the processor deps without it. - src/telegram/bot-message-context.ts, src/telegram/bot-message.ts <!-- greptile_other_comments_section --> <!-- /greptile_comment -->

Most Similar PRs