Forum teuk.org

Command status fixes, schema alignment, and safer command handling

in Mediabot · started by TeuK · 3w ago

TeuK · 3w ago

Mediabot cleanup: command status fixes, schema alignment, and safer command handling

A new cleanup pass has just been completed on mediabot_v3, with a focus on reliability and consistency rather than new features.

What was fixed

This round of work mainly addressed command management and schema coherence:

  • added support for an active flag in PUBLIC_COMMANDS
  • aligned the SQL schema and the Perl code on that new field
  • ensured inactive public commands are no longer executed
  • improved showcmd so it now displays the command status (active or on hold)
  • cleaned up the related logic in DBCommands.pm

Why this matters

The goal was simple: make command handling more predictable and avoid inconsistencies between the code and the database schema.

Before these fixes, the code expected an active field that was not yet present in the SQL schema. That kind of mismatch is exactly the sort of thing that leads to annoying bugs, confusing behavior, and wasted debugging time.

Now the behavior is clearer:

  • active commands run normally
  • held commands stay disabled
  • showcmd reflects the real state of the command

Scope

This cleanup was intentionally limited to the core command/database logic.

The radio-related parts were left aside on purpose, so the review could stay focused on general Mediabot stability and maintainability.

Result

Nothing flashy here, just useful work:

  • fewer schema/code mismatches
  • cleaner command-state handling
  • more predictable behavior
  • a healthier base for future cleanup and refactoring

Sometimes the best magic is simply removing the hidden curses from the old code.

You must be logged in to reply.