EN
Open CopyPost

Auto-Posting Filters: How to Remove Ads from Reposts

3 min readFiltersAuto-posting

Remove ads from Telegram reposts with filters — text matching, word boundaries, regular expressions and message-type filters, explained with examples.

Contents
  1. How filters work
  2. Text: words and letter case
  3. Regular expressions
  4. Message-type filters
  5. Albums
  6. Tip

A source channel doesn’t publish only useful content: there are sponsored posts, giveaways and links to other people’s bots. Pipeline filters decide which messages get passed on when you auto forward Telegram posts and which don’t.

How filters work #

Each filter has an action and a condition:

  • “Skip if” — the message is dropped if the condition is met;
  • “Only if” — the message goes through only if the condition is met.

A message is delivered when every filter lets it through. The order of filters doesn’t matter.

Text: words and letter case #

The simplest filter is “text contains”. Two settings make it precise:

  • “case-insensitive” — ad matches “Ad” and “AD”, including in Cyrillic;
  • word boundary: start of word, end of word or whole word.

Why a boundary? Without one, the filter “text contains cat” fires on “scat” and “category”. With “whole word”, it fires only on the standalone word “cat”. It works with symbols too: #ad as a whole word won’t fire on #adweek.

An example set against ads:

ActionCondition
Skip iftext contains “ad” (whole word, case-insensitive)
Skip iftext contains “#promo”
Skip iftext contains “erid”

Regular expressions #

When there are too many words, a single regular expression helps. CopyPost uses the Rust regex syntax: it never hangs on “bad” patterns, so even a complex expression is processed in linear time.

(?:giveaway|contest|raffle).{0,40}(?:subscri|repost)

This expression catches “subscribe and repost” giveaways in any word order within a phrase.

The panel shows errors in the expression when you save — a broken filter never goes live.

Message-type filters #

The “has any of” condition checks message attributes: photos, videos, voice messages, video notes, polls, stickers, links in the text, mentions, buttons, forwarded messages and more.

  • “Skip if it has buttons” — removes most ad posts with a “Go to” button.
  • “Only if it has a photo or video” — turns a news channel into a media feed.
  • “Skip if it is forwarded” — keeps only the source’s original content.

Albums #

An album is checked by its whole caption: if the caption contains an ad, not a single photo goes through. Media-type filters, however, look at each item: “photos only” will send only the photos from a mixed album.

Tip #

Start with two or three filters and watch the results for a few days. Filters can be changed in the panel on the fly — the pipeline picks up changes immediately.

Next step — replace the source’s links and signature with your own.