← Back to PRs

#6283: feat(telegram): Add message content filtering

by usvimal open 2026-02-01 13:46 View on GitHub →
channel: telegram
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