From 426011bf4e021c36432ea4df986eca33c80d68d2 Mon Sep 17 00:00:00 2001 From: Firepup Sixfifty Date: Fri, 17 Nov 2023 21:24:10 -0600 Subject: [PATCH] Formatting --- bot.py | 4 +++- commands.py | 3 ++- core.py | 2 +- handlers.py | 8 ++++++-- overrides.py | 1 + 5 files changed, 13 insertions(+), 5 deletions(-) diff --git a/bot.py b/bot.py index 60c8ad4..d9a3a23 100644 --- a/bot.py +++ b/bot.py @@ -90,7 +90,9 @@ class bot(bare.bot): for subchan in chans: self.join(subchan, origin) return - if chan.startswith("0") or (chan == "#main" and lock and self.server != "replirc"): + if chan.startswith("0") or ( + chan == "#main" and lock and self.server != "replirc" + ): if origin != "null": self.msg(f"Refusing to join channel {chan} (protected)", origin) return diff --git a/commands.py b/commands.py index 2e79951..144de08 100644 --- a/commands.py +++ b/commands.py @@ -169,6 +169,7 @@ def nowplaying(bot: bare.bot, chan: str, name: str, message: str) -> None: chan, ) + def whoami(bot: bare.bot, chan: str, name: str, message: str) -> None: bot.msg(f"I think you are {name}", chan) @@ -213,5 +214,5 @@ call: dict[str, Callable[[bare.bot, str, str, str], None]] = { "amiadmin": isAdmin, "ping": ping, "op me": op, - "whoami": whoami + "whoami": whoami, } diff --git a/core.py b/core.py index 7b871ed..179a10c 100644 --- a/core.py +++ b/core.py @@ -13,7 +13,7 @@ threads = {} servers = [ "ircnow", "replirc", - #"efnet", + # "efnet", "backupbox", ] diff --git a/handlers.py b/handlers.py index a2f5262..940720a 100644 --- a/handlers.py +++ b/handlers.py @@ -50,7 +50,7 @@ def PRIVMSG(bot: bare.bot, msg: str) -> tuple[Union[None, str], Union[None, str] (name.startswith("saxjax") and bot.server == "efnet") or (name == "ReplIRC" and bot.server == "replirc") or (name == "FirePyLink_" and bot.server == "ircnow") - or (name == "FirePyLink" and bot.server == "backupbox") + or (name == "FirePyLink" and bot.server == "backupbox") ): if "<" in msg and ">" in msg: bridge = True @@ -151,12 +151,14 @@ def PRIVMSG(bot: bare.bot, msg: str) -> tuple[Union[None, str], Union[None, str] mm.close() return None, None + def NICK(bot: bare.bot, msg: str) -> tuple[Union[None, str], Union[None, str]]: name = msg.split("!", 1)[0][1:] if name == bot.nick: bot.nick = msg.split("NICK", 1)[1].split(":", 1)[1].strip() return None, None + def KICK(bot: bare.bot, msg: str) -> tuple[Union[None, str], Union[None, str]]: important = msg.split("KICK", 1)[1].split(":", 1)[0].strip().split(" ") channel = important[0] @@ -165,13 +167,15 @@ def KICK(bot: bare.bot, msg: str) -> tuple[Union[None, str], Union[None, str]]: bot.channels.pop(channel, None) return None, None + def PART(bot: bare.bot, msg: str) -> tuple[Union[None, str], Union[None, str]]: parted = msg.split("!", 1)[0][1:] - channel = msg.split("PART", 1)[1].split(":", 1)[0].strip() + channel = msg.split("PART", 1)[1].split(":", 1)[0].strip() if parted == bot.nick: bot.channels.pop(channel, None) return None, None + handles = { "PRIVMSG": PRIVMSG, "NICK": NICK, diff --git a/overrides.py b/overrides.py index 2f8c810..b463c01 100644 --- a/overrides.py +++ b/overrides.py @@ -6,6 +6,7 @@ _T = TypeVar("_T") bbytes = bbytes + class bytes(bbytes): """Local override of builtin bytes class to add "lazy_decode"