#6283: feat(telegram): Add message content filtering
channel: telegram
Cluster:
Messaging Platform Improvements
Add MessageFilter class for content-based message filtering:
- Block patterns (denylist) for spam/noise
- Allow patterns (allowlist) for trigger-only mode
- Hybrid modes with exclude patterns (bypass list)
- Two evaluation modes: block-first or allowlist-first
Use cases:
- DD bots: Trigger-only mode (allow specific patterns)
- Support groups: FAQ/Help mode
- Hybrid: Block spam but allow commands
<!-- greptile_comment -->
<h2>Greptile Overview</h2>
<h3>Greptile Summary</h3>
Adds a new `MessageFilter` utility for the Telegram extension that compiles configurable allow/block/exclude regex patterns and evaluates incoming message text/captions in either "block-first" or "allowlist-first" mode. Also includes small helpers to construct the filter and detect/resolve per-group filter config.
The file is self-contained under `extensions/telegram/src/` and is intended to be called by the Telegram message handling pipeline before forwarding content to an agent.
<h3>Confidence Score: 3/5</h3>
- Generally safe to merge, but has a correctness bug around runtime config updates and a couple of behavior/logging surprises.
- The implementation is straightforward and isolated, but `compilePatterns()` can preserve old compiled regexes after `updateConfig()` changes, leading to incorrect filtering behavior. The other findings are lower severity but would likely confuse operators or callers.
- extensions/telegram/src/message-filter.ts
<!-- greptile_other_comments_section -->
<sub>(2/5) Greptile learns from your feedback when you react with thumbs up/down!</sub>
**Context used:**
- Context from `dashboard` - CLAUDE.md ([source](https://app.greptile.com/review/custom-context?memory=fd949e91-5c3a-4ab5-90a1-cbe184fd6ce8))
- Context from `dashboard` - AGENTS.md ([source](https://app.greptile.com/review/custom-context?memory=0d0c8278-ef8e-4d6c-ab21-f5527e322f13))
<!-- /greptile_comment -->
Most Similar PRs
#12950: feat: add Telegram pin/unpin message support
by alex-muradov · 2026-02-09
72.9%
#7058: feat(telegram): add channel_post handler for broadcast channels
by waifu7498173 · 2026-02-02
72.0%
#16483: feat(telegram): Process inbound edited_message events
by gabectl · 2026-02-14
71.6%
#7218: fix(telegram): skip empty text messages in threaded mode
by ArsalanShakil · 2026-02-02
71.1%
#11920: Telegram: create forum topics via message tool (thread-create)
by larsderidder · 2026-02-08
71.0%
#20155: feat(telegram): add tg-network-guard transcript status + reply flow
by artemgetmann · 2026-02-18
70.9%
#8310: feat(telegram): Add allowBots support for groups (parity with Disco...
by vishaltandale00 · 2026-02-03
70.5%
#7046: feat(telegram): add placeholder message while processing
by shanemort1982 · 2026-02-02
70.2%
#14419: feat(extensions): add telegram-files Mini App
by audichuang · 2026-02-12
70.2%
#15864: feat: add deliverOnlyToolMessages config for clean messaging channe...
by gandalf-the-engineer · 2026-02-14
70.1%