Rate limits are anti-flood rules. They delete messages after a user sends more than the allowed number of messages inside a time window.
Where to Configure
Dashboard path:
/rate_limit_rules
Visible navigation label: Rate limits.
What Rate Limits Do
For each assigned group, GramGroupsBot counts messages per Telegram user in fixed time windows.
If the user sends more than max_messages in window_seconds, messages over the limit are deleted.
Rate limits are checked last, after blocked users, stop words, links, and required words.
Fields
A rate-limit rule has:
- Name, max 100 characters.
- Max messages, integer greater than 0.
- Window seconds, integer greater than 0.
- Assigned groups.
- Active flag.
Default Form Values
The create form starts with:
Max messages: 5
Window seconds: 60
This means the sixth message from the same user in the same 60-second window is deleted.
Runtime Counter Behavior
Counters are stored in memory.
Important consequences:
- Counters reset when the application or bot runtime restarts.
- Counters are per group and per Telegram user.
- Counters are not shared across groups.
- Cleanup runs periodically to remove old counter windows.
Assignment Behavior
Each group can have one active rate-limit rule.
Assignments can be managed on the rate-limit rule form or on the Groups page.
Examples
Light Anti-Flood
Max messages: 8
Window seconds: 60
Allows normal conversation but catches bursts.
Strict Launch Chat
Max messages: 3
Window seconds: 30
Useful during launches or raids.
Slow Support Group
Max messages: 5
Window seconds: 300
Prevents repeated support spam over five minutes.
Limitations
Current rate limits do not:
- Ban, kick, or mute users.
- Persist counters across restarts.
- Share counters across groups.
- Exempt admins or approved users.