Our users often ask: How can I filter posts containing third-party links from my feed/channel?
If your goal is not to delete entire posts, but only to remove or replace links in them, read this article.
Let's look at an example. Let's say you're forwarding from Channel A to Channel B. You want to prevent posts from Channel A that contain at least one link from being forwarded.
This can be done in two ways:
Both methods are set up in Junction Bot forwarding filters — open it before you start.Оба способа настраиваются в фильтрах пересылки Junction Bot — откройте его перед началом.
This problem can be solved by creating filters using a regular expression. These filters will check for any clickable links (<a> tags and links beginning with http and https).
Open the forwarding you want to apply filtering to;
In the list of settings, find "Filters";
Create 2 filters :
Filter type: 🔍 Regular expression
Value (copy and paste): .*<a[^<]+</a>.*
Uncheck the box to the left of the magnifying glass icon
Filter type: 🔍 Regular expression
Value (copy and paste): .*https?:\/\/\S+.*
Uncheck the box to the left of the magnifying glass icon
Create a filter 🔍 By regular expression
Enter the value: uncheck the box and save the changes
Create a second filter .*https?:\/\/\S+.*
For @username (not added by the bot):
Filter type: 🔍 Regular expression
Value (copy and paste): .*@([a-zA-Z0-9=&_\-]+).*
Uncheck the box to the left of the magnifying glass icon
Enter the value: uncheck the box and save the changes
Method 2 needs the /track command, and that one runs inside the bot itself.Для Способа 2 понадобится команда /track — она работает в самом боте.