Anti-Flood Protection
Intelligent spam prevention that detects flooding attacks and auto-mutes repeat offenders with configurable thresholds.
Overview
Anti-flood protection tracks message rates per user within a 60-second sliding window. When a user exceeds the configured message limit, the bot automatically takes action.
All flood messages can be automatically deleted, and the system supports warnings before taking punitive action.
How It Works
- 1.Bot tracks message count for each user in a 60-second window
- 2.When user exceeds the limit, all their flood messages are logged
- 3.If warnings are configured, user receives warnings first
- 4.After warnings exhausted, configured action is taken (mute/warn/kick/ban)
- 5.If enabled, all flood messages are deleted
Mini App Configuration
Open /app → Settings → Anti-Flood Protection
Enable Anti-Flood
Toggle to enable/disable flood protection.
Message Limit (per minute)
Maximum messages a user can send in 60 seconds before triggering:
| Parameter | Value |
|---|---|
| Minimum | 3 messages |
| Maximum | 100 messages |
| Default | 10 messages |
Action When Flooding
What happens when a user exceeds the limit:
| Action | Behavior |
|---|---|
| mute | Restrict user from sending messages temporarily |
| warn | Send warning message to user |
| kick | Remove user from group (can rejoin) |
| ban | Permanently ban user from group |
Mute Duration
When action is "mute", how long the user is restricted:
Default: 5 minutes (300 seconds)
Delete Flood Messages
When enabled, all messages sent during the flood attack are deleted. The bot tracks message IDs and deletes them in bulk.
Warnings Before Action
Number of warnings before the configured action is taken:
| Option | Behavior |
|---|---|
| 0 | No warnings, immediate action |
| 1 | 1 warning, then action |
| 2 | 2 warnings, then action |
| 3 | 3 warnings, then action |
Bot Commands
/antiflood onEnable anti-flood protection/antiflood offDisable anti-flood protection/antiflood limit 5Set message limit to 5 per minute/antiflood statusCheck current settingsTechnical Details
- • Window: 60-second sliding window per user per group
- • Tracking: Message IDs are stored for bulk deletion
- • Reset: Counter resets when window expires
- • Database: Uses FloodTracker model with group_id, telegram_id, message_count, window_start
- • Silent mode: Can be configured to suppress notifications (silent_automations)