Documentation menu

Filters & Access Control

Whitelist, Blacklist & Media Filters

Deterministic forwarding filters: keyword matching with Unicode folding, media-type blocking, link detection and ReDoS-safe regex evaluation.

Verified against the checkout built for v2.2.4 · updated 20 Oct 2026

Overview

The FilterEngine in AutoTelegramForward executes deterministic, multi-stage inspection on incoming Telegram messages before any forwarding or copying occurs. If a message violates filtering criteria, it is dropped early with full diagnostic logging (e.g. [PIPELINE:FILTER_DROP]), saving network bandwidth and rate-limit quotas.

Supported Filter Capabilities

✅ Whitelist (Allow-Only Filter)

Required Match

When whitelist keywords or regex patterns are defined, a message must match at least one whitelist pattern to proceed. If none match, the message is quietly dropped.

⛔ Blacklist (Block Filter)

Immediate Rejection

If an incoming message matches any blacklisted word, phrase, or regular expression, forwarding is immediately aborted.

🔗 Link Detection Filter

filter_type: "link"

Specifically rejects any incoming message containing web URLs, IP addresses, or Telegram deep links, preventing external channel promotion.

🎬 Media Type Filter

Granular Toggles

Filter out specific categories of Telegram media while allowing others:

block_video
block_audio
block_stickers
block_voice
block_text

Filter Evaluation Pipeline Order

To prevent race conditions, the FilterEngine evaluates rules in strict order:

  1. Media Type Check: If the message media matches any active block_* rule, drop immediately.
  2. Link Check: If filter_type == "link" and any link is detected, drop immediately.
  3. Whitelist Check: If a whitelist exists and no match is found, drop.
  4. Blacklist Check: If any blacklist keyword or pattern matches, drop.
  5. Pass: Proceed to the Cleaner and Transformation stages.

ReDoS Prevention & Safe Regular Expressions

All regex patterns submitted via the Telegram Bot or Web API undergo strict compilation checks. Unbounded nested quantifiers (e.g. (a+)+$) that cause catastrophic backtracking are rejected with descriptive error messages. Furthermore, regex evaluations are executed with timeout bounds to protect worker threads.

Configuring Filters via Telegram Bot

  1. Send /settings and select your rule.
  2. Click 🔍 فیلترها (Filters).
  3. Click ⛔ بلک‌لیست (Blacklist) or ✅ وایت‌لیست (Whitelist) to enter keywords (one per line or comma-separated).
  4. Click 🎬 فیلتر رسانه to toggle blocking of Videos, Voice notes, Stickers, or Audio.