Skip to content

Handler Group Precedence

Which message watchers fire first and how propagation works in Alita Robot.

gotgbot dispatches incoming updates to handlers in ascending group number order. Lower group numbers fire first. Within the same group, handlers fire in registration order. A handler returning ext.EndGroups stops all further group processing for that update. ext.ContinueGroups allows downstream groups to continue firing.

This page documents every registered message watcher with its exact handler group number, verified from source code.

GroupModuleHandlerFilterReturn on MatchNotes
-10CaptchahandlePendingCaptchaMessagenil (all messages)EndGroupsIntercepts messages from users with pending captcha; stores and deletes message
-2Antispam(inline closure)message.AllEndGroupsRate-limits spamming users; passes through if not spamming
-1UserslogUsersmessage.AllContinueGroupsLogs user activity; never blocks propagation
0All modulesCommands, callbacksVariousvariesDefault group; standard command handlers
4AntifloodcheckFloodmessage.AllEndGroups on flood, ContinueGroups otherwiseFlood control; skips anon admins and media groups
5LockspermHandlermessage.AllEndGroups on violationPermission-based locks (can_send_messages, etc.)
6LocksrestHandlermessage.AllEndGroups on violationRestriction-based locks (stickers, animations, etc.)
7BlacklistsblacklistWatchernon-command, non-media-groupContinueGroups (always)Checks words against blacklist; action taken but processing continues
8Reports(handler)message.AllvariesReport tracking
9FiltersfiltersWatchernon-command, non-media-groupContinueGroups (always)Matches filter patterns; sends configured response but does not block
10Pins(handler)message.AllEndGroupsAnti-channel-pin watcher

Scenario 1: User with pending captcha sends a message

Section titled “Scenario 1: User with pending captcha sends a message”
  1. Captcha (group -10) intercepts the message, stores it in the pending queue, and deletes it from the chat.
  2. Returns EndGroups. Nothing else fires.
  3. After the user completes captcha verification, stored messages are replayed.

Scenario 2: User sends a flood of messages

Section titled “Scenario 2: User sends a flood of messages”
  1. Captcha (group -10) passes through (no pending captcha).
  2. Antispam (group -2) passes through (not yet rate-limited).
  3. Users (group -1) logs activity, continues.
  4. Commands (group 0) fire normally for earlier messages.
  5. Antiflood (group 4) triggers after the flood threshold is reached, returns EndGroups.
  6. Locks, blacklists, filters, and pins are all skipped for that message.

Scenario 3: Message matches both a blacklist word and a filter

Section titled “Scenario 3: Message matches both a blacklist word and a filter”
  1. Captcha (group -10) passes through.
  2. Antispam (group -2) passes through.
  3. Users (group -1) logs activity, continues.
  4. Commands (group 0) — not a command, passes.
  5. Antiflood (group 4) — not flooding, continues.
  6. Locks (groups 5-6) check permissions. Message passes (no lock violation).
  7. Blacklists (group 7) matches the word, takes configured action (e.g., warn user), returns ContinueGroups.
  8. Reports (group 8) tracks the message.
  9. Filters (group 9) matches the filter pattern, sends the configured response, returns ContinueGroups.
  10. Pins (group 10) checks for anti-channel-pin conditions.

Both the blacklist action and the filter response are triggered for the same message.