Formatting

This commit is contained in:
Firepup Sixfifty 2023-11-17 21:24:10 -06:00
parent cc4a4d0e1f
commit 426011bf4e
Signed by: Firepup650
GPG key ID: 7C92E2ABBBFAB9BA
5 changed files with 13 additions and 5 deletions

4
bot.py
View file

@ -90,7 +90,9 @@ class bot(bare.bot):
for subchan in chans: for subchan in chans:
self.join(subchan, origin) self.join(subchan, origin)
return 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": if origin != "null":
self.msg(f"Refusing to join channel {chan} (protected)", origin) self.msg(f"Refusing to join channel {chan} (protected)", origin)
return return

View file

@ -169,6 +169,7 @@ def nowplaying(bot: bare.bot, chan: str, name: str, message: str) -> None:
chan, chan,
) )
def whoami(bot: bare.bot, chan: str, name: str, message: str) -> None: def whoami(bot: bare.bot, chan: str, name: str, message: str) -> None:
bot.msg(f"I think you are {name}", chan) 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, "amiadmin": isAdmin,
"ping": ping, "ping": ping,
"op me": op, "op me": op,
"whoami": whoami "whoami": whoami,
} }

View file

@ -13,7 +13,7 @@ threads = {}
servers = [ servers = [
"ircnow", "ircnow",
"replirc", "replirc",
#"efnet", # "efnet",
"backupbox", "backupbox",
] ]

View file

@ -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") (name.startswith("saxjax") and bot.server == "efnet")
or (name == "ReplIRC" and bot.server == "replirc") or (name == "ReplIRC" and bot.server == "replirc")
or (name == "FirePyLink_" and bot.server == "ircnow") 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: if "<" in msg and ">" in msg:
bridge = True bridge = True
@ -151,12 +151,14 @@ def PRIVMSG(bot: bare.bot, msg: str) -> tuple[Union[None, str], Union[None, str]
mm.close() mm.close()
return None, None return None, None
def NICK(bot: bare.bot, msg: str) -> tuple[Union[None, str], Union[None, str]]: def NICK(bot: bare.bot, msg: str) -> tuple[Union[None, str], Union[None, str]]:
name = msg.split("!", 1)[0][1:] name = msg.split("!", 1)[0][1:]
if name == bot.nick: if name == bot.nick:
bot.nick = msg.split("NICK", 1)[1].split(":", 1)[1].strip() bot.nick = msg.split("NICK", 1)[1].split(":", 1)[1].strip()
return None, None return None, None
def KICK(bot: bare.bot, msg: str) -> tuple[Union[None, str], Union[None, str]]: 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(" ") important = msg.split("KICK", 1)[1].split(":", 1)[0].strip().split(" ")
channel = important[0] 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) bot.channels.pop(channel, None)
return None, None return None, None
def PART(bot: bare.bot, msg: str) -> tuple[Union[None, str], Union[None, str]]: def PART(bot: bare.bot, msg: str) -> tuple[Union[None, str], Union[None, str]]:
parted = msg.split("!", 1)[0][1:] 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: if parted == bot.nick:
bot.channels.pop(channel, None) bot.channels.pop(channel, None)
return None, None return None, None
handles = { handles = {
"PRIVMSG": PRIVMSG, "PRIVMSG": PRIVMSG,
"NICK": NICK, "NICK": NICK,

View file

@ -6,6 +6,7 @@ _T = TypeVar("_T")
bbytes = bbytes bbytes = bbytes
class bytes(bbytes): class bytes(bbytes):
"""Local override of builtin bytes class to add "lazy_decode" """Local override of builtin bytes class to add "lazy_decode"