Documentation menu

Text Cleaner

Telegram Message Cleaner

A deterministic cleaning pass that strips URLs, Telegram invite links, @mentions, #hashtags, phone numbers and emojis before a post is delivered.

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

Overview

Forwarded messages from public channels frequently contain promotional links, sponsor @mentions, irrelevant hashtags, and support contact details. AutoTelegramForward provides a native Cleaner Module that strips these artifacts safely before publishing to destination chats.

Supported Cleaning Formats

🔗 URL & Link Stripping

Removes raw web URLs (https://..., http://...), t.me/... Telegram channel/invite links, and unwraps Markdown hyperlinks [text](url) into plain anchor text.

👤 @Mentions / Usernames

Matches and cleans Telegram usernames conforming to @[A-Za-z0-9_]{3,32}, ensuring third-party sponsors and channel handles are scrubbed.

#️⃣ Multi-Lingual #Hashtags

Unicode-compliant regex strips tags in English, Persian (#بیتکوین), Arabic, Russian, and numeric tags (#crypto2026).

😀 Emoji Removal

Removes UTF-8/UTF-16 emoji pictographs, symbols, and dingbats without corrupting Persian, Arabic, or European accent characters.

📞 Telephone Numbers

Strips international and local telephone patterns (+1-800..., 0912...) to prevent unauthorized advertiser contact.

📝 Custom Word Lists

Define task-specific lists of prohibited words or phrases (e.g. sponsor names, promotional slogans) for case-insensitive deletion.

Configuration via Telegram Bot

Cleaner options can be configured per forwarding rule directly from the Telegram control panel:

  1. Send /settings or /rules to your Telegram bot.
  2. Select the forwarding rule you wish to configure.
  3. Click 🧹 پاک‌کننده (Cleaner) to open the Cleaner menu.
  4. Toggle independent buttons for 🔗 لینک (URLs), 👤 منشن (Mentions), #️⃣ هشتگ (Hashtags), 😀 ایموجی (Emojis), or 📞 شماره تماس (Phones).
  5. Click 📝 کلمات سفارشی to type a comma-separated list of custom words to strip.

Input / Output Transformation Example

Incoming Message (Raw)
🚨 Breaking: Market surge!
Follow @crypto_daily for VIP alerts.
Chart: https://t.me/crypto_daily/8491
#Bitcoin #BTC #Crypto2026 🔥
Call +1-800-555-0199 for inquiries.
Transformed Output (Cleaned)
🚨 Breaking: Market surge!
Follow for VIP alerts.
Chart:

Safe Entity & Encoding Preservation

Pyrogram string objects often carry internal UTF-16 surrogate pairs. Direct string slicing in Python can trigger UnicodeDecodeError on emoji-heavy channels. AutoTelegramForward safely normalizes incoming text to standard Python str before regex execution, preventing pipeline crashes.