Avoid spamming #firemc (#6)

Co-authored-by: Firepup Sixfifty <firepyp650@gmail.com>
Reviewed-on: #6
Reviewed-by: Firepup650 <firepup650@noreply.localhost>
This commit is contained in:
Firepup Sixfifty 2024-04-30 20:45:53 -05:00
parent 617be6f79f
commit d1ee11f84a
Signed by: Firepup650
GPG key ID: 7C92E2ABBBFAB9BA
3 changed files with 8 additions and 14 deletions

View file

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

View file

@ -172,6 +172,11 @@ def PART(bot: bare.bot, msg: str) -> tuple[None, None]:
bot.channels.pop(channel, None) bot.channels.pop(channel, None)
return None, None return None, None
def QUIT(bot: bare.bot, msg: str) -> tuple[None, None]:
if bot.server == "replirc":
if msg.split("!", 1)[0][1:] == "FireMCBot":
bot.send("TOPIC #firemc :FireMC Relay channel (offline)\n")
return None, None
def NULL(bot: bare.bot, msg: str) -> tuple[None, None]: def NULL(bot: bare.bot, msg: str) -> tuple[None, None]:
return None, None return None, None
@ -186,4 +191,5 @@ handles: dict[
"PART": PART, "PART": PART,
"MODE": NULL, "MODE": NULL,
"TOPIC": NULL, "TOPIC": NULL,
"QUIT": QUIT
} }

View file

@ -112,18 +112,6 @@ def radio(instance: bare.bot) -> NoReturn:
instance.log("Thread while loop broken", "FATAL") instance.log("Thread while loop broken", "FATAL")
exit(1) exit(1)
def mcDown(instance: bare.bot) -> None:
instance.sendraw("TOPIC #firemc :FireMC Relay channel (offline)")
data: dict[str, dict[str, Any]] = { data: dict[str, dict[str, Any]] = {
"radio": {"noWrap": True, "func": radio, "passInstance": True}, "radio": {"noWrap": True, "func": radio, "passInstance": True}
"mc-down": {
"noWrap": False,
"func": mcDown,
"passInstance": True,
"interval": 60,
"ignoreErrors": True,
},
} }