Two spells in one breath. Nox silences the floods β four new antiflood
guards protect every channel, especially #quebec. Lumos brings clarity
β seven intelligence features sharpen commands, responses, and operator
tools. Plus the usual audit, bug-hunting, and 15 new test cases.
βNox! The floods are silenced. Lumos! The bot shines brighter than ever.β π°β‘π
checkAntiFlood β Zero DB per Outgoing MessageThe old checkAntiFlood fired 6 SQL queries per outgoing message on
a +AntiFlood channel. The new version caches parameters in memory
(_af_params, TTL 60s) and tracks flood state in _af:
Before: SELECT β UPDATE β SELECT β UPDATE β ... (6 round-trips/msg)
After: one SELECT per channel every 60s β zero DB during floods
Silence state is stored as silenced_until β checked in < 1Β΅s.
checkNickFlood β User NotificationPreviously silent: a flooding nick was dropped without explanation.
Now the nick receives a NOTICE at most once every 30 seconds:
-mediabotv3- You are sending commands too fast. Please wait 3s.
checkNickFlood β Sliding WindowThe old fixed window allowed bursting: 4 cmds at t=4.9s + 4 at t=5.1s = 8 cmds undetected. The new implementation keeps a ring buffer of timestamps and prunes entries older than the window on every call β the burst is caught regardless of timing.
checkChanFlood β Global Per-Channel Input GuardBrand new sub. Counts all incoming commands on a channel, all nicks combined. If >8 commands in 10s β channel silenced for 30s.
Five nicks spam #quebec simultaneously
β checkChanFlood(#quebec) β 9 cmds/10s β SILENCED 30s
β checkNickFlood(nick, #quebec) β sliding window β NOTICE
β command processed
Configurable per channel from the Partyline:
.floodset #quebec 10 4 60 β window=10s, max=4, silence=60s
.cmdcooldown #quebec ai 20 β !ai cooldown 20s on #quebec
After triggering checkNickFlood three times in a row, the nick is
added to _nick_mute for 5 minutes β silently dropped with zero DB
interaction. Operators can lift it instantly:
.unmute spammer
AF7 mute lifted for spammer.
.floodstatus now shows all three layers at once:
--- Channel antiflood (AF1 β output guard) ---
#boulets 3 msgs in window
#quebec SILENCED (18s remaining)
--- Channel flood (AF4 β input guard) ---
#quebec SILENCED (18s remaining)
--- Temp mutes (CC3/AF7) ---
spammer muted (247s remaining)
--- Per-nick flood (AF3) ---
spammer 6 cmds in window
!ai and !trivia now have a default per-channel cooldown (10s and 5s
respectively). Configurable with .cmdcooldown:
<teuk> m ai explain IPv6
<mediabotv3> -teuk- !ai is cooling down on #boulets β wait 8s.
!trivia Named Categories20 named categories map to Open Trivia DB IDs:
<teuk> m trivia history
<mediabotv3> Trivia (History): Who was the first President of the United States?
<teuk> m trivia categories
<mediabotv3> Trivia categories: animals, anime, art, books, cartoons, celebrities, computers...
Full list: general science computers maths sports geography history politics art celebrities animals vehicles comics gadgets anime tv music film books mythology.
.top all [n] β All-Channel Leaderboard.top all 5
Top 5 speakers (all channels):
1. teuk 18,432 msgs
2. Boole 12,847 msgs
3. Poyan 9,201 msgs
The existing .top #chan [n] is unchanged. all is a new keyword.
!remindlist Enriched<teuk> m remindlist
<mediabotv3> 2 pending reminder(s) you have set:
<mediabotv3> #3 -> boole [in 2h 30m]: apporte les logs [URGENT]
<mediabotv3> #7 -> poyan [overdue 15m ago]: rΓ©union
Remaining time is shown in human-readable form (_seconds_to_human).
[URGENT] appears for reminders set with !remind ! nick msg.
Overdue reminders show how long ago they passed.
!ai Response Cache (60s)Identical prompts on the same channel return the cached answer instantly
(no API call) for 60 seconds. Uses the existing _claude_prompt_cache
hash (F53), extended to check before firing the API:
<teuk> m ai quel est le 6Γ¨me gaz noble ?
<mediabotv3> Le radon (Rn, numΓ©ro 86)...
<boole> m ai quel est le 6Γ¨me gaz noble ? β 30s later
<mediabotv3> [cache] Le radon (Rn, numΓ©ro 86)... β instant, no API call
!ai Persona Auto-Reset After 1h InactivityIf no !ai command has been issued on a channel for more than 1 hour,
the persona is automatically cleared. Prevents stale personas from
bleeding into new conversations long after the original user is gone.
Every dispatched IRC command increments
mediabot_command_total{cmd} via inc_label. Grafana can now show
which commands are most used, per time window.
Before: Time's up! The answer was: serendipity
After: Time's up! The answer was: serendipity (General Knowledge)
The category is stored in _trivia{$channel}{category} at question
start and appended to the timeout message.
!choose Deduplicates Options<teuk> m choose pizza | pizza | sushi
<mediabotv3> -teuk- Note: 1 duplicate option(s) removed.
<mediabotv3> teuk: I choose... sushi!
Deduplication is case-insensitive and preserves the first occurrence.
If more than 5 different votes target the same nick within 30 seconds, further votes are blocked and the channel is notified:
<mediabotv3> Karma brigade detected for teuk β votes temporarily blocked.
The ring buffer self-cleans when the 30s window expires.
A new memory_cleanup task runs every 300 seconds and evicts:
_nick_mute entries (CC3/AF7)_cmd_cooldown entries older than 1h (CC1)_chan_flood entries (AF4)_claude_prompt_cache entries > 120s (DD1/F53)_karma_brigade ring buffers (DD9)External.pm compilationDD1 and DD5 blocks referenced @args_remaining (undeclared) and
$hist_key (declared further down in the same sub). Fixed:
| Was | Is |
|---|---|
@args_remaining |
@args |
$hist_key |
$persona_key (already declared at insertion point) |
| File | Changes |
|---|---|
Helpers.pm |
AF1 (checkAntiFlood rewrite), AF2+AF3 (checkNickFlood), AF4 (checkChanFlood new), CC1 (checkCmdCooldown new), CC2 overrides, CC3 strikes+mute |
Mediabot.pm |
AF4+CC1 call sites, DD2 metrics |
Partyline.pm |
CC2 (.floodset, .cmdcooldown), CC3 (.unmute), CC6 (.top all), .floodstatus enriched |
UserCommands.pm |
CC4 trivia categories, CC7 remindlist, DD6 timeout category, DD8 choose dedup, DD9 karma brigade |
External.pm |
DD1 cache check, DD5 persona reset, fix @args/@persona_key |
Metrics.pm |
5 new counters (nickflood_mutes, cmdcooldown_blocks, karma_brigade_blocks, antiflood_blocks, chanflood_blocks) |
mediabot.pl |
DD10 memory_cleanup scheduler |
You must be logged in to reply.