Audit of snapshot 20260502. Six files touched across the ban system,
the DCC CHAT handler, and the Partyline. The new ChannelBan module
and CHANNEL_BAN table were already in place β this pass fixes the
edge cases and wires up the missing pieces.
process_expired_channel_bans() was sending MODE -b unconditionally
on ban expiry. If the bot was not present in the channel (or had parted),
the IRC server would silently refuse the unban while the DB record would
still be marked removed β leaving the ban active on IRC indefinitely.
The fix checks gethChannelsNicksOnChan before sending MODE -b. If the
bot is absent, the IRC command is skipped but the DB cleanup proceeds,
with a log entry explaining why.
accept_dcc_chat used $self->{bot} internally while
accept_dcc_chat_passive required $bot as an explicit parameter.
This made the two methods inconsistent and the caller in Mediabot.pm
was passing $self (the bot object) as the second argument.
Both methods now follow the same pattern: $self->{bot} is used
internally, and the caller no longer passes the bot reference.
parse_duration("0") silently created a zero-second timed banThe guard in ChannelBan::parse_duration was $minutes < 0, which
a \d+ regex match can never satisfy. A bare 0 would create a ban
with a duration of zero seconds β technically timed but expiring
immediately. Replaced with an explicit check: 0 now returns an error
pointing the user to use perm instead.
on_message_ctcp_DCC never matched incoming dataThe handler was reading $hints->{ctcp_args} which is undef in the
installed version of Net::Async::IRC. As a result, the DCC CHAT regex
never matched and every /dcc chat mediabotv3 silently fell through to
the private command dispatcher as chat.
The handler now:
ctcp_args, text, and ctcp_dataDCC prefix if presentThis will allow identifying the exact hints structure from the next test and writing a definitive fix without guessing.
process_expired_channel_bans() logged each expiry but did not expose
it to Prometheus. A mediabot_channel_bans_expired_total counter is
now incremented on each successful ban removal.
accept_dcc_chat_passiveaccept_dcc_chat_passive had a full copy of the IP resolution logic
already present in _resolve_dcc_public_ip. It now calls the shared
helper instead, ensuring config key lookup, env fallback, and IRC socket
detection are handled in one place.
!bans now shows human-readable time remainingThe ban list was displaying raw expires_at datetime strings from the
database. It now computes the remaining time via TIMESTAMPDIFF(SECOND, NOW(), expires_at) and formats it as 2d 3h 15m. Permanent bans still
display as permanent.
!ban and !kickbanThe error messages shown on bad usage now include concrete examples:
You must be logged in to reply.