fix: let extra bots see peer music state for !similar/!tags
Some checks failed
CI / gitleaks (push) Failing after 3s
CI / lint (push) Failing after 23s
CI / test (3.11) (push) Has been skipped
CI / test (3.12) (push) Has been skipped
CI / test (3.13) (push) Has been skipped
CI / build (push) Has been skipped

_current_meta now checks registry._bots for peer bot music state
when the current bot has nothing playing. Fixes merlin reporting
"Nothing playing" while derp is actively streaming.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
user
2026-02-23 22:17:29 +01:00
parent ad12843e75
commit c851e82990
2 changed files with 41 additions and 8 deletions

View File

@@ -307,6 +307,31 @@ class TestCurrentMeta:
}
assert _mod._current_meta(bot) == ("Tool", "Lateralus")
def test_peer_bot_music_state(self):
"""Extra bot sees music state from peer bot via shared registry."""
music_bot = _FakeBot()
music_bot._pstate["music"] = {
"current": _FakeTrack(title="Tool - Lateralus"),
}
extra_bot = _FakeBot()
# No music state on extra_bot
# Share registry with _bots index
shared_reg = _FakeRegistry()
shared_reg._bots = {"derp": music_bot, "merlin": extra_bot}
music_bot.registry = shared_reg
extra_bot.registry = shared_reg
assert _mod._current_meta(extra_bot) == ("Tool", "Lateralus")
def test_peer_bot_no_music(self):
"""Returns empty when no bot has music state."""
bot_a = _FakeBot()
bot_b = _FakeBot()
shared_reg = _FakeRegistry()
shared_reg._bots = {"a": bot_a, "b": bot_b}
bot_a.registry = shared_reg
bot_b.registry = shared_reg
assert _mod._current_meta(bot_a) == ("", "")
# ---------------------------------------------------------------------------
# TestFmtMatch