Over the last development pass, Mediabot v3 received a solid cleanup focused on reliability, safer external API handling, and better regression coverage.
This was not a flashy feature sprint. It was the kind of maintenance work that keeps a bot stable when real users, real IRC clients, and real network failures start throwing cursed objects around the castle.
Several UrlTitle handlers were cleaned up so that their visual badges keep their intended style, while the displayed title text is reset immediately afterward.
This prevents IRC background color leakage on clients/themes where a badge background could accidentally continue across the title text.
Affected handlers include:
The intended rule is now clear:
[Badge] -> may keep its styled background
Title -> must render with transparent/default background
Spotify handling was improved so Mediabot no longer settles for useless shell titles like:
Spotify – Web Player
The handler now tries richer metadata sources, including Spotify oEmbed, embed pages, standard page metadata, and Chromium-rendered DOM fallback when needed.
When available, Spotify output can include:
The YouTube rendering code was cleaned up and made more consistent.
A duplicate helper/import conflict around _yt_format_duration() was fixed. This removed the Perl warning at startup:
Subroutine _yt_format_duration redefined
YouTube helper ownership is now clearer: YouTube-specific formatting helpers live in Mediabot::External, not in Mediabot::Helpers.
The YouTube JSON dump was also moved from DEBUG4 to DEBUG5, because full API responses are too verbose for normal debugging.
Several network calls were hardened with local eval guards and clean fallback response hashes. This prevents DNS, SSL, proxy, or API exceptions from breaking command execution.
Hardened areas include:
Instead of letting raw network exceptions escape, Mediabot now logs or reports failures more cleanly.
Verbose ChatGPT logs were moved to DEBUG5:
That keeps DEBUG4 usable for flow debugging without flooding logs with large payloads.
TMDB output truncation was made safer by building the final IRC reply first and then truncating the complete message.
This avoids odd behavior when prefixes are long or MAIN_PROG_MAXLEN is configured too low.
TMDB errors also now go through the Mediabot logger instead of using direct warn output to STDERR.
A misleading copied comment before getFortniteId() was removed and replaced with a correct Fortnite-specific comment.
This kind of cleanup matters during refactoring: misleading comments are small traps that eventually waste time or cause wrong assumptions.
Several regression tests were added or adjusted to lock in the new behavior:
The goal is simple: when this code is touched again later, tests should catch the same class of mistakes before they reach the running bot.
Most of these changes are defensive, but they make a real difference in production-like IRC usage.
Mediabot talks to many external services: YouTube, Spotify, TMDB, OpenAI, country lookup APIs, and generic web pages. Any of those can fail, return junk, change their markup, or behave differently depending on the client/environment.
This pass makes Mediabot more resilient against those situations.
This update is mainly about reliability and polish:
A proper little defensive magic pass.
Mischief managed.
You must be logged in to reply.