Perl, Python and Tcl plugins are no longer a fragile side quest. They are becoming a real extension layer.
Over the last development passes, Mediabot v3 received a serious round of hardening around its external plugin system.
The goal was simple: make it safer and cleaner to let IRC commands call external scripts written in Perl, Python, or Tcl, without letting malformed configuration values, weird Perl references, broken JSON, or unsafe command tokens leak into the runtime.
In Hogwarts terms: the spellbook is still open, but the pages now have proper protective charms. πͺ
Mediabot can now be extended with small external scripts instead of putting every feature directly inside the main Perl bot.
That means you can start building lightweight command plugins such as:
hello, pyhello, or tclhello to validate the whole chain;The important part is that the plugin layer is no longer just βit works if everything is perfectβ. It now has a stronger contract between Mediabot and external scripts.
The current direction is intentionally simple:
STDIN.So instead of hardcoding every new idea directly into the bot core, you can move small features into scripts and let Mediabot act as the guarded gateway.
That opens the door to cleaner experiments: new commands can be tested without turning the main bot into a giant cauldron of mixed responsibilities. π§ͺ
This development series focused on contracts, guards, and predictable behavior.
The script runner now refuses malformed language values instead of accidentally accepting Perl references that stringify into strange values like ARRAY(...) or HASH(...).
This matters because language selection is security-sensitive: perl, python, and tcl must be real, deliberate values β not magical smoke from Perl internals.
The constructor now protects script_dir handling. Invalid values fall back safely instead of being treated as usable paths.
That helps keep plugin discovery predictable and avoids surprising behavior when configuration values are malformed.
A command name can no longer quietly contain spaces, control characters, newlines, or NUL bytes.
For example, malformed values like these are rejected:
hello world
hello\nworld
hello\rworld
hello\0world
This is important because the command name is used for routing. A command must be a clean token, not a cursed parchment with hidden characters in it. π
If a user types a command with extra spaces, prefixes, or uppercase letters, Mediabot normalizes it before sending it to the plugin.
So the external script receives the command Mediabot actually authorized and routed, not the raw noisy input.
That makes script behavior much easier to understand and debug.
The external plugin bridge now insists on a clean JSON object envelope.
It rejects unsafe or invalid payload shapes such as:
[]
"hello"
42
A plugin should receive an object, not a random scalar or array. This gives plugin authors a stable shape to work with.
The data field sent to external scripts is now normalized.
Simple scalar values are preserved. Arrays of simple scalars are preserved. Arbitrary Perl references, nested objects, and overload tricks are removed or converted safely.
This prevents accidental leakage of Perl internals into external scripts.
Several runtime-related values now reject Perl references before numeric conversion. Top-level script errors are also checked as real scalar diagnostics.
That means fewer warnings, fewer weird overload surprises, and clearer failure messages.
The action layer now behaves less like a cursed mirror and more like a proper Ministry-approved dispatch desk. π¦
If you write a Mediabot plugin now, you can reason about the bridge more safely:
STDIN;This is exactly the kind of boring reliability that makes fun features possible.
Nobody wants to debug a Python plugin only to discover the real problem was a Perl HASH(...) ghost sneaking through the wall. π»
This hardening makes the next steps much more realistic:
The big win is architectural: Mediabot can keep its Perl core stable while still allowing small, focused external commands to grow around it.
That is how a bot stops being a monolith and starts becoming a platform. π°
Mediabot v3 can now call external plugins more safely.
Perl, Python, and Tcl scripts can be used as command helpers, with cleaner command normalization and stronger JSON contracts.
The recent work mostly hardened the bridge: less weird input, less Perl reference leakage, fewer unsafe edge cases, and more predictable behavior for plugin authors.
In short: the plugin system is becoming ready for real use, not just laboratory magic.
πͺ Mediabot v3 external plugins: safer commands, cleaner JSON, stronger runtime wards.
You must be logged in to reply.