The dashboard's own WS connection was being counted as a bot subscriber,
causing "1 bot connected" with no bots actually present. Now WS clients
send a role ("bot" or "viewer") in the subscribe message. Only bots count
toward the subscriber total. Bot plugins also send a configurable client_id
so the dashboard shows which specific bots are connected.
Made-with: Cursor
73 lines
1.5 KiB
Python
73 lines
1.5 KiB
Python
from supybot import conf, registry
|
|
|
|
|
|
def configure(advanced):
|
|
conf.registerPlugin("NtrPlaylist", True)
|
|
|
|
|
|
NtrPlaylist = conf.registerPlugin("NtrPlaylist")
|
|
|
|
conf.registerGlobalValue(
|
|
NtrPlaylist,
|
|
"apiBaseUrl",
|
|
registry.String(
|
|
"http://127.0.0.1:8000",
|
|
"""Base URL for the NtR SoundCloud Fetcher API (no trailing slash).""",
|
|
),
|
|
)
|
|
|
|
conf.registerGlobalValue(
|
|
NtrPlaylist,
|
|
"adminToken",
|
|
registry.String(
|
|
"",
|
|
"""Bearer token for admin API endpoints.""",
|
|
private=True,
|
|
),
|
|
)
|
|
|
|
conf.registerGlobalValue(
|
|
NtrPlaylist,
|
|
"adminNicks",
|
|
registry.SpaceSeparatedListOfStrings(
|
|
[],
|
|
"""IRC nicknames allowed to run admin commands (space-separated).""",
|
|
),
|
|
)
|
|
|
|
conf.registerGlobalValue(
|
|
NtrPlaylist,
|
|
"displayTimezone",
|
|
registry.String(
|
|
"America/New_York",
|
|
"""IANA timezone for displaying dates in IRC (e.g. America/New_York, America/Chicago).""",
|
|
),
|
|
)
|
|
|
|
conf.registerGlobalValue(
|
|
NtrPlaylist,
|
|
"wsUrl",
|
|
registry.String(
|
|
"ws://127.0.0.1:8000/ws/announce",
|
|
"""WebSocket URL for receiving announce commands from the dashboard.""",
|
|
),
|
|
)
|
|
|
|
conf.registerGlobalValue(
|
|
NtrPlaylist,
|
|
"announceChannel",
|
|
registry.String(
|
|
"#sewerchat",
|
|
"""IRC channel to send announce messages to.""",
|
|
),
|
|
)
|
|
|
|
conf.registerGlobalValue(
|
|
NtrPlaylist,
|
|
"clientId",
|
|
registry.String(
|
|
"limnoria",
|
|
"""Identifier for this bot when connecting to the announce WebSocket.""",
|
|
),
|
|
)
|