How to set up text replacement
The PosterBotWe tell you how to set up and use the new bot feature — Text replacement.
The text replacement function is available only for users with an active subscription for Telegram, VK, Instagram and Twitter sources.
What is text replacement
With Text replacement feature, the bot can automatically edit the text of messages according to your rules.
For example, you want messages not to contain a certain sentence or word — you specify this sentence in the source settings in the bot, and the next time the bot sends messages to your channel, the text you specified will be removed or replaced with your.
Almost everything can be replaced in this way — a word, phrase, sentence, or even a whole passage of text.
You can make it so that the word/expression is simply removed from the text, or you can specify a replacement for it.
How to setup
To configure text replacement, go to the Sources section, select the desired source, and then click Appearance and select Text Replacement.
Case sensitivity: if you enable this setting, then all your added words and expressions for replacement must exactly match the case of words and expressions in the source, otherwise they will be ignored.
By default, case sensitivity is disabled, so if you add the word «subscribe» for replacement, the bot will also process the word «Subscribe» in the original message, despite the capital letter.
- To proceed to creating a replacement, you need to click Add replacement. After that, the bot will ask you to send WHAT needs to be removed or replaced in the original message. As we wrote before, it can be a word, phrase or any other piece of text. It is important to note that you need to send the bot text without any formatting (even if the deleted text should contain a link or italic style) — the bot will automatically detect the formatting in the original message.
Let's give an example: you send the bot the text «subscribe to our channel», such a replacement will work even if the original message contains «Subscribe to our channel». - After you have sent the bot what needs to be replaced, there are two options: just remove the specified word/expression from the text, or replace it with your own word or expression. To simply delete a word or expression, you need to click on the Without Replacement button on the bot's keyboard. If you want the bot to replace the text with yours, you need to send the text, WHICH you want see instead the original one.
After adding a replacement, it will be displayed in the bot's Inline menu. If you want to delete a previously created replacement, just click on it in the menu.
You can create an unlimited number of replacements for each of your sources.
Regular expressions
Advanced users can also use regular expressions to fine tune text replacement.
Regular expressions should be used when you send the bot what needs to be replaced.
For example, you need the bot to remove all words starting with the letter P — for this you can send the following expression to the bot: P\S+
— this expression will work for any word, for example, «pay» and will allow you to remove it from the text or replace it on yours. \S
in this expression means any character other than a space, and +
means that there must be at least one (or more) such character.
You can learn more about regular expressions, as well as test and debug them, using the regex101 service.
Thus, with text replacement, you have the unlimited possibilities to customise how messages will look in your channels.