Formatting
This commit is contained in:
parent
cc4a4d0e1f
commit
426011bf4e
5 changed files with 13 additions and 5 deletions
4
bot.py
4
bot.py
|
@ -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
|
||||||
|
|
|
@ -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,
|
||||||
}
|
}
|
||||||
|
|
|
@ -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,6 +167,7 @@ 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()
|
||||||
|
@ -172,6 +175,7 @@ def PART(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
|
||||||
|
|
||||||
|
|
||||||
handles = {
|
handles = {
|
||||||
"PRIVMSG": PRIVMSG,
|
"PRIVMSG": PRIVMSG,
|
||||||
"NICK": NICK,
|
"NICK": NICK,
|
||||||
|
|
|
@ -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"
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue