Custom commands and your first rules
Create a command that shares useful information in your Telegram chat. Learn about events, All and Any conditions, and moderator commands.
In this article
Hello! People in a course chat ask where the recordings are every day. In support, they ask how to pay for a subscription. Moderators explain the job-posting rules again, while a project team keeps track of its tasks before a webinar.
Combot can handle some of these repetitive tasks. In Automation, you define a rule: what needs to happen and what the bot should do in response.
- EventA message appears in the chat
- ConditionsA payment question in Support
- ActionCombot sends instructions
For example: “If someone asks ‘how to pay’ in Support, send the instructions.” Or: “If a moderator replies to a helpful message with a command, give its author 25 XP.”
This guide explains the settings through everyday situations like these. The examples are for learning: replace topic names, links and messages with your own. Conditions and limits are explained alongside each example so the rule does what you intend.
If you have just opened the editor, start with a simple command. If you already have a task in mind, explore the 11 ready-made scenarios or find the setting you need in the contents.
The editor only shows fields relevant to the selected event. A chat question, a join request and a moderator command can therefore have different settings.
Prepare your chat
Imagine an online course chat. Every new student asks where the class recordings are, and the tutor looks for the same link again. Let's start by letting Combot send the information.
Add @combot to the chat. Open the Combot dashboard, select the chat and go to Automation.
Check two things: whether you can change the settings, and whether the bot can perform the action. Access to statistics, for example, does not necessarily let you create rules. And permission to send messages does not let the bot delete other people's messages.
Choose permissions to suit the task:
- Share information: the bot must be able to write in the selected chat or topic — a separate discussion area within a chat.
- Remove advertising: it needs permission to delete messages.
- Mute or ban members: it needs administrator permissions to restrict members.
- Approve join requests: it needs permission to invite users.
- Award XP or reputation: the corresponding feature must be enabled in Combot settings.
If a warning appears above the rule list, address it first. Saving a “25 XP for a helpful reply” rule, for example, will not make it work if XP is disabled in the chat.
Rules belong to the selected chat. If you already synchronize triggers across several chats, edit the shared set in the source chat. For example, you can update course information for several groups in the source chat; editing may be unavailable in the chats that inherit it.
Your first rule: share useful information
People in a course chat often ask, “Where are the recordings and assignments?” Let's create /course_info to answer that question. It neither deletes anything nor restricts anyone, so it makes a good starting point.
- Click Add trigger. Name the rule Course — recordings and assignments.
- Under Type, select Command. Add
/course_info. - Choose Plain command. Leave Triggered by open to everyone so any student can use it.
- In THEN, add Send message. You can use the text below and replace the topic names with your own.
- Keep Source chat and the current topic. Click Save action.
- Click Validate, then Save trigger. Make sure the rule is enabled.
- Send
/course_infoin Telegram. The information should appear. An ordinary “Hello, everyone!” should not trigger it.
Now the tutor can send one command instead of typing the explanation each time. Later, you can add a button linking to the materials; see Format the reply.
Validate looks for problems in the settings. It does not send the command for you or check the Telegram reply: you still need to do that last step yourself.
Explain what you want the bot to do
You can describe almost any rule in one sentence:
If someone asks “how to pay” in Support, send payment instructions.
The editor splits that sentence in two. Under IF, you explain what to respond to. Under THEN, you choose what to do.
The bot does not infer the task from the rule's name. Naming a rule “Help newcomers” does not enable anything by itself: you still need to choose new members, an event and an action.
All: every condition must match
Suppose payment instructions are only needed in Support. Set two conditions: the right topic and the phrase “how to pay”.
“How to pay for a subscription?” in Support matches. The same phrase in Off-topic does not. “How do I change my password?” in Support does not match either.
That is how All, or AND, works: every selected requirement must match.
Any: one matching option is enough
Some people write “how to pay”; others write “payment won't go through”. Both need the same instructions.
Where the editor offers Any, or OR, one matching option is enough. The person does not need to include both phrases in a single message.
Exclusions: leave people or messages out
In a jobs chat, you remind people about posting rules but do not want to reply to the team's own announcements. Add administrators to Exclude.
An exclusion does not remove someone from the chat or take away their permissions. It simply says, “This set of conditions does not match this person.”
User-condition exclusions also apply when you choose Any. For example, matching an activity condition does not override an administrator exclusion within the same set.
Several OR alternatives in one rule
Use Add OR option when different sets of conditions should lead to the same reply. For example:
- Someone writes “how to pay” in Support.
- Someone writes “where to buy a subscription” in Newcomer questions.
Describe both situations and write the instructions once. The event type is shared. Even if both alternatives match, this rule's action list runs just once.
Two separate rules work differently: each can send its own reply. That is why two similar rules sometimes produce duplicate messages.
OR alternatives are independent. If administrator messages must not match any alternative, add the exclusion to each one.
You can disable an individual alternative. For example, temporarily stop replying in Newcomer questions while keeping replies in Support. Disable the main rule to stop the whole scenario.
A useful habit: read the condition aloud before saving. “Reply to the word ‘payment’ anywhere” and “reply to a payment question only in Support” are different rules.
Custom commands for members and moderators
Two kinds of commands are useful in a chat. Some provide an answer: where to find the schedule, how to contact a tutor or where to submit work. Others help a moderator act on a particular member, such as issuing a warning or rewarding a helpful reply.
The command names in this guide are examples. Create them in the editor first; typing their names in the chat does not automatically add them to Combot.
Rule name, description and type
The Name appears in the Automation list. Choose something a colleague can understand at a glance: “Course — student information” or “Jobs — salary reminder”. You can use up to 80 characters.
The Description is a note for administrators, up to 280 characters. For example: “Show information to the new course cohort. Disable after the course ends.” The bot does not post this description in the chat.
Under Type, choose:
- Trigger if the bot should respond automatically to a matching situation, such as a “how to pay” question.
- Command if a person should explicitly run the rule, for example by sending
/course_info.
Several commands for the same reply
You can add /course_info and /course_help to one rule. Whichever name a member uses, they receive the same information.
Add each name separately. Use Latin letters, digits and underscores. Choose names that are not already used by built-in Combot commands or other bots in your chat.
Plain command: get information
Choose Plain command when a member needs a reply, not an action affecting a selected person.
For example, a student sends /course_info and the bot explains where the recordings are. There is no need to select anyone using Reply.
User actions are unavailable in this mode. A plain command cannot implement “everyone sends a command to award themselves XP”.
If you enable Delete command message, the /course_info message disappears from the conversation, while the bot's reply remains. This keeps command messages from cluttering the chat.
Reply command: select a person
Suppose Ilya breaks a chat rule and Anna, a moderator, wants to issue a warning.
- Anna selects Reply on Ilya's message.
- She sends
/team_warnas the reply. - Combot warns Ilya.
To set this up, choose Reply target for the command. Allow Telegram administrators under Triggered by and choose the replied-to user under the action's Apply to setting.
Anna is the command's author. Ilya wrote the message she replied to. Mixing them up in the settings changes the task completely.
The condition Applied to under IF limits who may be targeted by the command. Apply to inside each action selects who actually receives that action.
Where supported, an action can affect the command's author, the replied-to user or both. The warning in our example should affect only Ilya.
Permission to use your command does not make someone a Telegram administrator. Combot itself also needs permission to perform the action.
What gets deleted? If you add command-message deletion, /team_warn disappears, not Ilya's original message. Choosing who receives the warning does not change which message is deleted.
What the bot can respond to
When answers the question “What needs to happen?” For a trigger, choose an event from the list. A command is simpler: the message containing the command runs it.
Messages, comments and posts
Any chat message / Chat message. Use this for everyday group activity: a question about a lesson, a job posting or a document. For example, the bot spots “where is the recording” and sends the information.
Comments. Choose this for discussions of posts from a linked channel. For example, answer “how do I sign up” in comments on the school's posts.
Channel post. This refers to the linked channel's posts themselves. For example, when a post with #live appears, send prepared discussion guidelines to the chat. A condition for ordinary chat messages is not a substitute for a post condition.
Include edits. Imagine someone publishes a short job listing, then adds contact details. With this setting, Combot checks the edited message too. Actions can run again, so take particular care when combining edits with rewards.
Join requests, arrivals and departures
Join request. The person is still waiting for a decision. For example, event organizers want to approve requests through a particular invitation automatically.
New member. The person has already joined. Now you can welcome them: “Welcome! Start with the pinned message.”
Member leave. The person left voluntarily or was removed. For example, send a notification to the configured log channel where the team follows chat events. This event can involve two different people: the departing member and whoever removed them.
Requesting to join and joining are separate steps. A welcome on both can result in two messages. Choose the step where the information is actually useful.
Boosts
New boost. For example, after someone boosts a club chat, the bot posts a brief “Thanks for supporting the community!”
Removed boost. For example, the team gets a log notification about the change. It does not necessarily mean the person chose to withdraw the boost, so avoid accusatory wording.
Reactions
User reaction. Someone added, removed or replaced a reaction. For example, the team receives a notification about a matching reaction change in a work discussion.
Reaction count. Telegram sent an updated reaction count for a post from the linked channel. For example, the bot tells moderators about a post that currently has between 20 and 30 reactions of the selected types.
A reaction count does not say who left each reaction. And the same rule can run again on later updates. See Reactions and checklists for help setting up these filters without unexpected repeats.
Checklists
A team is preparing a webinar in its work chat. Someone creates a task list, adds an item or marks the presentation as done. There are three events for this:
- New checklist — a list appeared. You can tell the team a new plan is ready to use.
- Checklist tasks added — the list gained new items. For example, send a log notification.
- Checklist tasks done — tasks were marked as completed. You can invite colleagues to open the list and review the changes.
The last event does not mean “everything is ready for the webinar”: only one task may have been completed.