Forum teuk.org

🧭 The Marauder’s Map of Activity: Mediabot v3 Gets Sharper Stats and Smarter Runtime Feedback

in Mediabot · started by TeuK · 4w ago

TeuK · 4w ago

This update is a usability and polish pass over existing Mediabot v3 features.

No big architectural rewrite this time. No new database schema. No risky refactor. The goal was simpler and more practical: make the bot’s existing commands more useful, less silent, and more accurate during day-to-day IRC usage.

The work focused mainly on activity statistics, karma feedback, scheduler visibility, Partyline output, and a few edge cases discovered during live testing.

Better schedule visibility

The Partyline scheduler output is now more informative.

.schedule list, .schedule status, and .timers now provide clearer runtime information, especially around the next expected execution time.

This makes scheduled tasks easier to inspect from the Partyline without guessing whether a timer is alive, stuck, or simply waiting for its next run.

A subtle restart-related issue was also corrected: when a task is stopped and started again, its start_time is refreshed. Partyline now bases “next run” calculations on the latest relevant timestamp between last_tick and start_time.

That avoids misleading output after a task restart.

Cleaner karma behavior

Karma feedback was improved in several small but visible ways.

!karma no longer stays silent when used on an unregistered channel. Explicit karma voting such as:

!karma + nick
!karma - nick

now refuses clearly when used in private message or on a channel that is not registered.

This prevents the frustrating “nothing happened” behavior and gives users a proper explanation.

!karmainfo also gained more deterministic output for top-voter display, and !karmahist behaves better when used in private message.

More accurate user statistics

The m stats / !stats output was improved and hardened.

One live issue was especially misleading: when a user asked for their own stats, the command itself could become the user’s latest activity. That meant the result could always show something like:

last msg: ... (0h ago)
last seen: ... (0h ago)

which was technically explainable, but not very useful.

The stats command now avoids counting the current stats command itself as the latest meaningful message. For self-stats, misleading last seen output is hidden when it would simply point to the command that was just typed.

The result is cleaner and closer to what users actually expect: “when did this person last really talk here?”

Word count output is more useful

!wordcount now filters short words before selecting the top words.

Previously, common short tokens could occupy the top positions first and then be discarded afterwards, leaving the final top-word list empty or incomplete.

The ranking now filters first, sorts second.

That gives more useful output without changing the command’s purpose.

More robust edge cases

A few defensive fixes were added while reviewing the new behavior:

  • !stats no longer risks dereferencing an empty USER_SEEN row.
  • Partyline .top closes DBI statement handles properly on small error paths.
  • Scheduler “next run” information remains sensible after task stop/start cycles.
  • Karma vote paths now fail loudly and clearly when the context is invalid.

These are not flashy changes, but they are exactly the kind of small corrections that make a long-running IRC bot feel solid.

Validation

The patched files were checked with Perl syntax validation:

perl -I. -c Mediabot/Scheduler.pm
perl -I. -c Mediabot/Partyline.pm
perl -I. -c Mediabot/UserCommands.pm
perl -c mediabot.pl

Runtime checks were also performed around:

.schedule list
.schedule status
.timers
m stats
m stats <nick>
!karma
!karma + <nick>
!wordcount
.top

Result

This update makes Mediabot v3 more pleasant to use and easier to understand while running.

The bot now gives better feedback, cleaner stats, more reliable schedule visibility, and fewer silent edge cases.

It is another small but important step toward making Mediabot feel less like an old magical artifact that only its creator understands, and more like a proper maintained IRC companion.

The Marauder’s Map is clearer now.

You must be logged in to reply.