Forum teuk.org

Partyline overhaul: Eggdrop-style features

in Mediabot · started by TeuK · 1w ago

TeuK · 1w ago

Partyline overhaul: Eggdrop-style features

Branch: master (3.2-dev) · Next release: 3.3

This session is a significant step toward making the Mediabot Partyline feel like a proper Eggdrop partyline. Seven features were added or reworked across Partyline.pm, Mediabot.pm, Log.pm and mediabot.pl.


Chat broadcast

Anything typed on the partyline that does not start with a . is now broadcast to all authenticated users, Eggdrop-style:

<teuk> hello from the partyline

The sender receives their own message echoed back. Join and part events are announced to everyone:

*** teuk joined the partyline. ***
*** gwen left the partyline. ***
*** gwen left the partyline (disconnected). ***

.console [0-5|off] — log redirect

Each partyline session can now subscribe to the bot’s log stream at a configurable verbosity level.

.console        → show current level (or "Console is OFF")
.console 0      → INFO only ([LIVE] channel events, joins, parts…)
.console 4      → all debug up to DEBUG4
.console off    → disable

Implemented via a hook API added to Mediabot::Log. Each session registers a callback with add_console_hook($id, $level, $cb); the hook is removed automatically on disconnect. Multiple sessions can run at different levels simultaneously.


.boot <handle> — kick a partyline user (Owner)

Sends You have been booted by <nick>. to the target, closes their stream, and announces the event to remaining users. Cannot boot yourself.


.motd [text|clear] — message of the day

Displayed automatically after each successful login. Configurable from mediabot.conf:

PARTYLINE_MOTD=Welcome to the Mediabot partyline.

Owners can update or clear the MOTD at runtime with .motd <text> and .motd clear. Supports \n as a line separator in the config value for multi-line MOTDs.


.restart — IRC reconnect without killing the Partyline

This is the most significant architectural change. Previously .restart forked a new process and killed the current one, taking the Partyline with it. Now:

  1. .restart [reason] calls restart_irc() in Mediabot.pm
  2. restart_irc() sends QUIT to the IRC server, detaches the IRC object from the IO::Async loop, and sets $mediabot->{irc} = undef
  3. on_timer_tick detects $irc = undef on its next tick and calls reconnect() through the normal reconnect path
  4. reconnect() reuses the same IO::Async loop — it no longer creates a fresh IO::Async::Loop->new on each reconnect
  5. The Partyline listener is attached to that same loop and is never touched during the cycle

All partyline sessions survive the IRC reconnect. Users see:

*** IRC restarting — bot will reconnect shortly. ***

The distinction between .restart (IRC reconnect, Partyline stays up) and .die (full process termination) is now clearly documented in .help.


.whom — list partyline users (auto-displayed on join)

Partyline users (2):
  Nick            Level           Socket  Console
  ------------------------------------------------------------
  teuk            Owner           fd=11   console:0  *
  gwen            Master          fd=14   console:off

* marks your own session. Displayed automatically immediately after login — you always know who else is connected when you join.


.match <handle> — user lookup with wildcard support

Queries the USER table directly. Accepts Eggdrop-style wildcards (* → SQL %, ?_).

.match teuk
.match t*
.match *@*.epiknet.org

Output per match:

  Handle  : teuk
  Level   : Owner (0)
  Status  : logged in
  Hosts   : *!teuk@teuk.org *!teuk@*.teuk.org
  Info1   : teuk.org admin

Limited to 20 results.


Files changed

Mediabot/Log.pm        add_console_hook / remove_console_hook API
Mediabot/Partyline.pm  chat broadcast, .console, .boot, .motd, .restart,
                       .whom (+ auto on join), .match
Mediabot/Mediabot.pm   restart_irc() — in-process IRC reconnect
mediabot.pl            reconnect() reuses loop, on_timer_tick $irc sync,
                       PARTYLINE_MOTD wiring
mediabot.sample.conf   PARTYLINE_MOTD entry

Commit: 🧙 The Room of Requirement — partyline chat broadcast, .console log redirect, .boot, .motd, IRC restart without killing partyline process, .whom auto-display on join, .match handle lookup with wildcard support

You must be logged in to reply.