Actually pay attention if the song isn't playing

This commit is contained in:
Firepup Sixfifty 2024-04-09 12:46:43 -05:00
parent 016e5d2595
commit b356bfb19b
Signed by: Firepup650
GPG key ID: 7C92E2ABBBFAB9BA
3 changed files with 8 additions and 2 deletions

View file

@ -200,7 +200,7 @@ data: dict[str, dict[str, Any]] = {
"bugs bugs bugs": {"prefix": False, "aliases": []},
"hi $BOTNICK": {"prefix": False, "aliases": ["hello $BOTNICK"]},
# [npbase, su]
"restart": {"prefix": True, "aliases": ["reboot", "stop"], "check": checks.admin},
"restart": {"prefix": True, "aliases": ["reboot", "stop", "hardreload"], "check": checks.admin},
"uptime": {"prefix": True, "aliases": []},
"raw ": {"prefix": True, "aliases": ["cmd "], "check": checks.admin},
"debug": {"prefix": True, "aliases": ["dbg", "d"], "check": checks.admin},

View file

@ -6,7 +6,7 @@ from typing import Optional, Any
import bare, pylast
load_dotenv()
__version__ = "v3.0.2-dev"
__version__ = "v3.0.3"
npbase: str = (
"\[\x0303last\.fm\x03\] [A-Za-z0-9_[\]{}\\|\-^]{1,$MAX} (is listening|last listened) to: \x02.+ - .*\x02( \([0-9]+ plays\)( \[.*\])?)?" # pyright: ignore [reportInvalidStringEscapeSequence]
)

View file

@ -77,10 +77,12 @@ def threadManager(
def radio(instance: bare.bot) -> NoReturn:
lastTrack = ""
complained = False
while 1:
try:
newTrack = instance.lastfmLink.get_user("Firepup650").get_now_playing()
if newTrack:
complained = False
thisTrack = newTrack.__str__()
if thisTrack != lastTrack:
lastTrack = thisTrack
@ -88,6 +90,10 @@ def radio(instance: bare.bot) -> NoReturn:
instance.sendraw(
f"TOPIC #fp-radio :Firepup radio ({thisTrack}) - https://open.spotify.com/playlist/4ctNy3O0rOwhhXIKyLvUZM"
)
elif not complained:
instance.msg("Firepup seems to have stopped the music by mistake :/", "#fp-radio")
instance.sendraw("TOPIC #fp-radio :Firepup radio (Offline) - https://open.spotify.com/playlist/4ctNy3O0rOwhhXIKyLvUZM")
complained = True
except Exception:
Err = format_exc()
for line in Err.split("\n"):