Forum teuk.org

πŸ“œπŸͺ„ MB707 β€” DansTonChat and BashFR Return as Native Mediabot Commands

in Mediabot Β· started by TeuK Β· 4d ago

TeuK Β· 4d ago

Version: 3.4dev-20260827_153545
Commit: c592159
Commit message: MB707: summon native DansTonChat and BashFR quotes β€” no Tcl relics required πŸ“œπŸͺ„

MB707 brings two familiar IRC commands back into Mediabot:

!dtc
!bashfr

They now run as a native Perl feature inside the current Mediabot architecture rather than depending on an Eggdrop/Tcl runtime.

🏰 One feature, two familiar commands

Both commands are aliases for the same DansTonChat feature and are protected by the opt-in channel setting:

+DansTonChat

The supported forms are:

!dtc
!bashfr

for a random quote,

!dtc <id>
!bashfr <id>

for a specific numeric quote,

and:

!dtc <search words>
!bashfr <search words>

for text search.

The aliases deliberately share one implementation so their behavior cannot silently drift apart over time.

βš™οΈ Native, asynchronous architecture

The historical behavior was useful, but the old execution model was not copied into the modern bot.

MB707 adds:

Mediabot/DTC/Source.pm
Mediabot/DTC/Commands.pm

and wires them into Mediabot’s existing command dispatch and asynchronous worker path.

Network activity therefore stays away from the IRC event loop.

There is no Tcl interpreter, no Eggdrop dependency and no line-by-line translation of a legacy script.

The old spellbook supplied the behavior; the new castle provides the machinery. πŸ§™β€β™‚οΈ

πŸ”Ž Random, direct ID and search

The source layer handles the three useful access modes:

  • random DansTonChat quote;
  • direct quote lookup by numeric ID;
  • text search.

Search uses bounded web discovery and DansTonChat fallback behavior rather than allowing arbitrary crawling.

The parser is deliberately constrained to the expected quote content and rejects malformed or unsuitable responses instead of emitting untrusted page fragments into IRC.

🎨 IRC presentation

The familiar quote presentation is retained:

[ID] quote content

with the established ID/quote color charter.

Output is bounded to avoid turning one command into a wall of IRC text.

Long quotes are limited to a maximum of ten displayed lines, with a link back to the original quote when the complete content does not fit comfortably on channel.

πŸ›‘οΈ Opt-in by design

MB707 adds the canonical reference entry:

DansTonChat

to CHANSET_LIST.

Upgrade migration:

install/migrations/20260827_danstonchat_chanset.sql

The migration is data-only and idempotent.

Most importantly, it does not enable the feature on any channel automatically.

An operator must explicitly choose:

+DansTonChat

for each channel where the commands are wanted.

πŸ§ͺ Validation

The dedicated DTC and shared async/HTTP regression block passed:

7 / 7 files
136 / 136 tests PASS

A historical migration-documentation invariant then caught one missing documentation entry.

That was repaired without changing runtime code, and its dedicated regression passed:

62 / 62 tests PASS

The fast validation lane then completed successfully:

365 / 365 files
6532 / 6532 tests PASS

🌐 Real DEV validation

The migration was applied to the development database:

DansTonChat id = 27
default enabled channels = 0

The DEV service restarted cleanly and the feature was explicitly enabled on the test channel.

Real IRC validation covered all four important paths:

!dtc
!bashfr
!dtc <numeric-id>
!bashfr <search words>

Random quote, alias behavior, direct ID lookup and text search all worked successfully in the live development runtime.

🧹 The full suite caught one old assumption

The first complete suite reached:

17477 / 17478 PASS

The only failure was not a DTC runtime defect.

An older MB704 regression assumed that the canonical VDM chanset, ID 26, would always be the final entry in the fresh schema:

(26, 'VDM');

MB707 correctly appends canonical ID 27:

(26, 'VDM'),
(27, 'DansTonChat');

The historical assertion was tightened to preserve the fact that VDM remains canonical ID 26 without requiring it to remain eternally last.

The focused repaired contract then passed:

7 / 7 tests PASS

The complete suite was rerun on the final tree:

872 / 872 files
17478 / 17478 tests PASS
218 seconds

🟒 Zero failures.

πŸ“¦ What landed

The final commit contains:

14 files changed
592 insertions
5 deletions

New project files include:

Mediabot/DTC/Commands.pm
Mediabot/DTC/Source.pm
install/migrations/20260827_danstonchat_chanset.sql
t/cases/986_mb707_dtc_foundation.t
t/cases/987_mb707_dtc_parser.t
t/cases/988_mb707_dtc_format_and_source.t
t/cases/989_mb707_dtc_dispatch_contract.t

✨ Result

A piece of classic French IRC culture is back, but the implementation belongs firmly to modern Mediabot:

!dtc
!bashfr

Native Perl, asynchronous network work, bounded output, explicit channel authorization and full regression coverage.

No Time-Turner was needed to bring this one back from the Tcl era. β³πŸ“œπŸͺ„

Mischief managed.

You must be logged in to reply.