#8310: feat(telegram): Add allowBots support for groups (parity with Discord/Slack)
channel: telegram
stale
Cluster:
Messaging Platform Improvements
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
#7058: feat(telegram): add channel_post handler for broadcast channels
by waifu7498173 · 2026-02-02
80.0%
#14057: feat(telegram): add ignoreMediaTypes config to skip specific inboun...
by pavelsamoylenko · 2026-02-11
79.8%
#4337: fix(signal): add group-level allowlist support via groups config
by derekross · 2026-01-30
78.9%
#19616: feat(telegram): support custom apiRoot for Telegram Bot API
by CarloCPP · 2026-02-18
78.5%
#20818: feat(telegram): add draftMinInitialChars and initialDraftText confi...
by lingzhua77 · 2026-02-19
78.4%
#23067: feat(telegram): add disableAudioPreflight config for groups and topics
by yangnim21029 · 2026-02-22
78.3%
#18656: fix(signal): add missing groups field to Signal channel schema (#18...
by awkoy · 2026-02-16
76.9%
#6457: fix(telegram): register commands for group scope + preserve topic t...
by dae-sun · 2026-02-01
76.8%
#21029: Feature/telegram bot avatar clean
by aleonnet · 2026-02-19
76.7%
#19059: feat(telegram): add commands.include/exclude for selective menu reg...
by moxunjinmu · 2026-02-17
76.6%