diff --git a/bot.py b/bot.py index 9070fe4..afc8f3a 100644 --- a/bot.py +++ b/bot.py @@ -191,6 +191,11 @@ class bot(bare.bot): if origin != "null": self.msg(f"I'm banned from {chan}.", origin) break + elif code == 475: + self.log(f"Joining {chan} failed (+k without/with bad key)") + if origin != "null": + self.msg(f"{chan} is +k, and either you didn't give me a key, or you gave me the wrong one.", origin) + break elif code == 480: self.log(f"Joining {chan} failed (+S)", "WARN") if origin != "null": diff --git a/commands.py b/commands.py index 90b7396..3ca3449 100644 --- a/commands.py +++ b/commands.py @@ -325,6 +325,48 @@ def slap(bot: bare.bot, chan: str, name: str, message: str) -> None: msg = name bot.msg(f"\x01ACTION slaps {msg} around a bit with {r.choice(['a firewall', 'a fireball', 'a large trout', 'a computer', 'an rpi4', 'an rpi5', 'firepi', name])}\x01", chan) +def morning(bot: bare.bot, chan: str, name: str, message: str) -> None: + msg = message.split(" ") + addresse = " ".join(msg[2:]).strip().lower() + postfix = "" + if addresse and addresse[-1] in ["!", ".", "?"]: + postfix = addresse[-1] + addresse = addresse[:-1] + elif message[-1] in ["!", ".", "?"]: + postfix = addresse[-1] + addresse = addresse[:-1] + if addresse not in ["everyone", "people", bot.nick.lower(), ""]: + return + bot.msg(f"Good morning {name}{postfix}", chan) + +def night(bot: bare.bot, chan: str, name: str, message: str) -> None: + msg = message.split(" ") + addresse = " ".join(msg[2:]).strip().lower() + postfix = "" + if addresse and addresse[-1] in ["!", ".", "?"]: + postfix = addresse[-1] + addresse = addresse[:-1] + elif message[-1] in ["!", ".", "?"]: + postfix = addresse[-1] + addresse = addresse[:-1] + if addresse not in ["everyone", "people", bot.nick.lower(), ""]: + return + bot.msg(f"Good night {name}{postfix}", chan) + +def afternoon(bot: bare.bot, chan: str, name: str, message: str) -> None: + msg = message.split(" ") + addresse = " ".join(msg[2:]).strip().lower() + postfix = "" + if addresse and addresse[-1] in ["!", ".", "?"]: + postfix = addresse[-1] + addresse = addresse[:-1] + elif message[-1] in ["!", ".", "?"]: + postfix = addresse[-1] + addresse = addresse[:-1] + if addresse not in ["everyone", "people", bot.nick.lower(), ""]: + return + bot.msg(f"Good afternoon {name}{postfix}", chan) + data: dict[str, dict[str, Any]] = { "!botlist": {"prefix": False, "aliases": []}, @@ -336,7 +378,7 @@ data: dict[str, dict[str, Any]] = { "aliases": ["reboot", "stop", "hardreload", "hr"], "check": checks.admin, }, - "uptime": {"prefix": True, "aliases": []}, + "uptime": {"prefix": True, "aliases": ["u"]}, "raw": {"prefix": True, "aliases": ["cmd "], "check": checks.admin}, "debug": {"prefix": True, "aliases": ["dbg", "d"], "check": checks.admin}, "debugInternal": { @@ -366,7 +408,10 @@ data: dict[str, dict[str, Any]] = { "setStatus": {"prefix": True, "aliases": ["sS"], "check": checks.admin}, "getStatus": {"prefix": True, "aliases": ["gS"]}, "check": {"prefix": True, "aliases": [], "check": checks.admin}, - "slap": {"prefix": True, "aliases": ["s"]} + "slap": {"prefix": True, "aliases": ["s"]}, + "good morning": {"prefix": False, "aliases": []}, + "good night": {"prefix": False, "aliases": []}, + "good afternoon": {"prefix": False, "aliases": []}, } regexes: list[str] = [conf.npbase, conf.su] call: dict[str, Callable[[bare.bot, str, str, str], None]] = { @@ -399,4 +444,7 @@ call: dict[str, Callable[[bare.bot, str, str, str], None]] = { "getStatus": getStatus, "check": check, "slap": slap, + "good morning": morning, + "good night": night, + "good afternoon": afternoon, } diff --git a/config.py b/config.py index 63e0e11..d0dac16 100644 --- a/config.py +++ b/config.py @@ -32,7 +32,7 @@ ipbl = DNSBLIpChecker(providers=providers) hsbl = DNSBLDomainChecker(providers=providers) load_dotenv() -__version__ = "v3.0.20" +__version__ = "v3.0.21" npbase: str = ( "\[\x0303last\.fm\x03\] [A-Za-z0-9_[\]{}\\|\-^]{1,$MAX} (is listening|last listened) to: \x02.+ - .*\x02( \([0-9]+ plays\)( \[.*\])?)?" # pyright: ignore [reportInvalidStringEscapeSequence] ) @@ -101,7 +101,7 @@ servers: dict[str, dict[str, Any]] = { "prefix": "!", }, } -admin_hosts: list[str] = ["firepup.firepi", "47.221.108.152"] +admin_hosts: list[str] = ["firepup.firepi", "47.221.98.52"] ESCAPE_SEQUENCE_RE = re.compile( r""" ( \\U........ # 8-digit hex escapes diff --git a/handlers.py b/handlers.py index b3eef84..b834e8a 100644 --- a/handlers.py +++ b/handlers.py @@ -15,7 +15,7 @@ def CTCP(bot: bare.bot, msg: str) -> bool: bot.log(f'Responding to CTCP "{kind}" from {sender}') if kind == "VERSION": bot.notice( - f"\x01VERSION FireBot {conf.__version__} (https://git.amcforum.wiki/Firepup650/fire-ircbot)\x01", + f"\x01VERSION FireBot {conf.__version__} (https://git.h.hackclub.app/Firepup650/FireBot)\x01", sender, True, ) @@ -25,7 +25,7 @@ def CTCP(bot: bare.bot, msg: str) -> bool: return True elif kind == "SOURCE": bot.notice( - "\x01SOURCE https://git.amcforum.wiki/Firepup650/fire-ircbot\x01", + "\x01SOURCE https://git.h.hackclub.app/Firepup650/FireBot\x01", sender, True, )