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:
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

View file

@ -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,
}

View file

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

View file

@ -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,6 +167,7 @@ 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()
@ -172,6 +175,7 @@ def PART(bot: bare.bot, msg: str) -> tuple[Union[None, str], Union[None, str]]:
bot.channels.pop(channel, None)
return None, None
handles = {
"PRIVMSG": PRIVMSG,
"NICK": NICK,

View file

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