Triggers
Triggers are a flexible system for automated moderation that allows you to configure rules for responding to specific content in user messages. Each trigger consists of three components: source, condition, and action.
Trigger Structure
A trigger works according to the following scheme:
[Source] → [Condition] → [Action]
Example: "Message text" → "Contains 'spam'" → "Delete message"
Data Sources
A trigger can analyze various sources of information:
Message Text
Analyzes the text of the message or the caption of a media file.
Additional option: - Trigger on edit: The trigger will check messages when they are edited by the user.
Application: Filtering unwanted content, spam, and advertising in messages.
User Name
Analyzes the user's first and last name.
Application: Blocking users with advertising or unwanted names.
User Bio
Analyzes the user's profile description (bio).
Application: Blocking users with advertising in their biography.
Linked Channel Name
Analyzes the name of the user's personal channel, if linked to the profile.
Application: Blocking users with advertising channels.
Condition Types
The condition determines how the content of the source will be checked.
Regular Expression
Uses regular expressions to search for patterns in text. The search is case-insensitive (flag i).
Format: Regular expression (e.g., (spam|advertising|selling))
Examples:
- https?://.* - any link
- @\w+ - mention of a user or channel
- \d{10,} - a sequence of 10+ digits (phone numbers)
Application: Complex patterns, flexible filtering.
Exact Match
Checks for a complete match of the text (case-insensitive and ignores spaces at the edges).
Format: Exact string (e.g., hello)
Example: The condition hello will match the message "Hello" or " hello ", but NOT "Hello everyone".
Application: Exact filtering of specific phrases.
Contains
Checks if the specified substring is contained in the text (case-insensitive).
Format: Substring (e.g., advertising)
Example: The condition advertising will match "This is advertising", "ADVERTISING here", "I don't need your advertising".
Application: Simple filtering by keywords.
Command
Checks if the message is one of the specified commands.
Format: List of commands through the interface (e.g., /start, /help, /spam)
Example: You can create a trigger that responds to custom commands /reputation, /karma.
Application: Creating custom commands, blocking specific commands.
Profanity - RU
Checks for the presence of Russian profanity using a built-in database.
Format: Does not require parameters.
Application: Automatically filtering profanity in Russian.
Contains Language
Checks if the text contains characters from a specific language/alphabet.
Format: Select a language from the list: - Arabic - Arabic characters - Chinese - Chinese characters (Hanzi) - Japanese - Japanese characters (Hiragana, Katakana, Kanji) - Korean - Korean characters (Hangul)
Examples: - Blocking messages in Arabic to protect against spam - Restricting the use of Chinese characters in a chat
Application: Filtering messages by language, protection against hieroglyphic spam.
Action Types
The action determines what will happen when the trigger is activated.
Notification
Sends a notification to the trigger channel with information about the trigger activation.
Parameters: Not required.
Notification format:
Trigger: [trigger name]
Text: [text that triggered the activation]
Chat: [link to the message]
Features: - Not applied to moderators - Requires a configured trigger channel - The message is NOT deleted
Application: Monitoring suspicious activity without punishing users.
Delete
Deletes the message that triggered the trigger.
Parameters: Not required.
Features: - Not applied to moderators - The user does not receive a notification.
Application: Silently deleting unwanted content.
Warning
Issues a warning to the user and deletes the message.
Parameters: Not required.
Features: - Not applied to moderators - Deletes the message - Sends a notification (if notifications about triggers are enabled) - Increases the user's warning count
Format: Automod: Trigger [trigger name]
Application: Punishing users with the possibility of tracking the number of violations.
Mute
Blocks the user from sending messages for a specified period and deletes the message.
Parameters: Duration (interval)
Examples of duration:
- 10m - 10 minutes
- 1h - 1 hour
- 1d - 1 day
- permanent - permanently
Features: - Not applied to moderators - Deletes the message - Sends a notification (if notifications about triggers are enabled)
Application: Temporary punishment for violations.
Ban
Excludes the user from the chat for a specified period and deletes the message.
Parameters: Duration (interval)
Examples of duration:
- 7d - 7 days
- 30d - 30 days
- permanent - permanently
Features: - Not applied to moderators - Deletes the message - Sends a notification (if notifications about triggers are enabled)
Application: Strict punishment for serious violations.
Message
Sends a custom message to the chat in response to the trigger.
Parameters: Message text
Supported variables:
- {mention} - mention of the sender (with username or link)
- {replied_mention} - mention of the user from the replied message (or the sender, if there is no reply)
- {random_mention} - random chat participant
- {title} - chat name
Examples:
- Hi, {mention}! Welcome to {title}!
- {replied_mention}, thanks for the question!
- Random participant: {random_mention}
Features: - The message is sent in response to the trigger message - If auto-deletion of bot messages is enabled, the message will be deleted after the specified time Application: Auto-responders, greetings, custom commands
Reputation
Changes the user's reputation by the specified value.
Parameters: - Receiver: sender (sender) or replier (user from the replied message) - Value: integer (-2147483646 to 2147483646)
Examples of values:
- 1 - increase reputation by 1
- -5 - decrease reputation by 5
- 10 - increase reputation by 10
Features: - If "replier" is selected, the trigger will not work if there is no replied message - You cannot change your own reputation (for "replier") - Sends a notification about the reputation change
Application: Karma systems, user commands /thanks, /+rep
Usage Examples
Example 1: Blocking spam in messages
- Source: message_text (Message text)
- Condition: contains →
buy subscribers - Action: ban →
permanent
With this setting, any message containing the phrase "buy subscribers" will result in an immediate ban.
Example 2: Warning for profanity
- Source: message_text (Message text)
- Condition: badwords (Profanity - RU)
- Action: warn
The user will receive a warning for each message containing profanity.
Example 3: Auto-responder for a command
- Source: message_text (Message text)
- Condition: command →
/rules,/help - Action: message →
{mention}, please read the chat rules: [link]
When the /rules or /help command is sent, the bot will send a message mentioning the user.
Example 4: Reputation system
- Source: message_text (Message text)
- Condition: command →
/thanks - Action: reputation → replier, +1
The user can thank another participant by replying to their message with the /thanks command and increase their reputation.
Example 5: Blocking advertising names
- Source: name_text (User name)
- Condition: regex →
(advertising|selling|buying|@\w+) - Action: ban →
7d
Users with advertising in their names will be automatically banned for 7 days.
Example 6: Monitoring links
- Source: message_text (Message text)
- Trigger on edit: Yes
- Condition: regex →
https?://.* - Action: notify
Administrators will receive notifications about all messages with links, including edited ones.
Example 7: Greeting new participants
- Source: message_text (Message text)
- Condition: match →
hello - Action: message →
Hi, {mention}! Welcome to {title}! 👋
When the message "hello" is sent, the bot will send a welcome message.
Example 8: Blocking users with advertising channels
- Source: linked_channel_text (Linked channel name)
- Condition: contains →
advertising - Action: ban →
permanent
Users with the word "advertising" in the name of their personal channel will be banned.
Managing Triggers
Creating a trigger
- Go to the "Triggers" section in the automation settings.
- Click "Add".
- Enter a name for the trigger (for your convenience).
- Select the source of data.
- For
message_text, select whether to trigger on edits. - Select the condition type.
- Enter the condition value (for regex, match, contains) or add commands (for command).
- Select the action type.
- For
reputation, select the receiver. - Enter the action parameters (message text, duration, reputation value).
Viewing triggers
All triggers are displayed in the format:
ID) Name → Action
For example:
- 1) Block spam → ban
- 2) Profanity filter → warn
- 3) Rules command → message
Editing a trigger
- Select a trigger from the list.
- Choose what you want to change:
- Edit source - change the data source and trigger-on-edit settings.
- Edit condition - change the condition type and value.
- Edit action - change the action type and parameters.
Deleting a trigger
- Select a trigger from the list.
- Click "Delete".
Important Notes
- Moderators are exempt from all triggers (except for notifications, messages, and reputation).
- Triggers are processed in the order they were created.
- When a trigger with a delete/warn/mute/ban action is triggered, further processing of the message is stopped.
- A trigger with a notification action does not block further processing.
- The built-in database is used only for the Russian language for profanity.
- When editing a message, the trigger will only trigger if the content has changed (the text hash and message type are checked).
- The variables
{mention},{replied_mention},{random_mention}, and{title}only work in the message action. - The reputation value is limited to the range -2,147,483,646 to 2,147,483,646.
Practical Tips
- Use notifications to test new triggers before applying penalties.
- Name triggers clearly (e.g., "Block links", "Profanity filter").
- Start with mild punishments (warning) before moving to blocking.
- Test regex on special websites (e.g., regex101.com) before adding them.
- Use "contains" for simple cases instead of complex regular expressions.
- Review triggered messages regularly to ensure triggers are working as intended.
Limitations
- Maximum command length: 24 characters
- Number of commands in one trigger: unlimited
- Number of triggers per chat: unlimited
- Notification message text length: up to 3500 characters
- Regex is executed with the i flag (case-insensitive)