From d1ee11f84a3e090e675cce6967707b845ce2ff87 Mon Sep 17 00:00:00 2001 From: Firepup Sixfifty Date: Tue, 30 Apr 2024 20:45:53 -0500 Subject: [PATCH] Avoid spamming #firemc (#6) Co-authored-by: Firepup Sixfifty Reviewed-on: https://git.h.hackclub.app/Firepup650/FireBot/pulls/6 Reviewed-by: Firepup650 --- config.py | 2 +- handlers.py | 6 ++++++ timers.py | 14 +------------- 3 files changed, 8 insertions(+), 14 deletions(-) diff --git a/config.py b/config.py index 415e088..0950eac 100644 --- a/config.py +++ b/config.py @@ -6,7 +6,7 @@ from typing import Optional, Any import bare, pylast load_dotenv() -__version__ = "v3.0.7" +__version__ = "v3.0.8" npbase: str = ( "\[\x0303last\.fm\x03\] [A-Za-z0-9_[\]{}\\|\-^]{1,$MAX} (is listening|last listened) to: \x02.+ - .*\x02( \([0-9]+ plays\)( \[.*\])?)?" # pyright: ignore [reportInvalidStringEscapeSequence] ) diff --git a/handlers.py b/handlers.py index 50e7f5b..ba7e32b 100644 --- a/handlers.py +++ b/handlers.py @@ -172,6 +172,11 @@ def PART(bot: bare.bot, msg: str) -> tuple[None, None]: bot.channels.pop(channel, 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]: return None, None @@ -186,4 +191,5 @@ handles: dict[ "PART": PART, "MODE": NULL, "TOPIC": NULL, + "QUIT": QUIT } diff --git a/timers.py b/timers.py index c155b85..25a6afe 100644 --- a/timers.py +++ b/timers.py @@ -112,18 +112,6 @@ def radio(instance: bare.bot) -> NoReturn: instance.log("Thread while loop broken", "FATAL") exit(1) - -def mcDown(instance: bare.bot) -> None: - instance.sendraw("TOPIC #firemc :FireMC Relay channel (offline)") - - data: dict[str, dict[str, Any]] = { - "radio": {"noWrap": True, "func": radio, "passInstance": True}, - "mc-down": { - "noWrap": False, - "func": mcDown, - "passInstance": True, - "interval": 60, - "ignoreErrors": True, - }, + "radio": {"noWrap": True, "func": radio, "passInstance": True} }