Formatting

This commit is contained in:
Firepup Sixfifty 2023-11-20 20:18:48 -06:00
parent 478bcb9d04
commit e7acda43b4
Signed by: Firepup650
GPG key ID: 7C92E2ABBBFAB9BA
3 changed files with 21 additions and 7 deletions

View file

@ -4,7 +4,14 @@ import random as r
from typing import Any, Callable, Optional
import bare, re
def admin(bot: bare.bot, name: str, host: Optional[str] = "nul", chan: Optional[str] = "nul", cmd: Optional[str] = "nul") -> bool:
def admin(
bot: bare.bot,
name: str,
host: Optional[str] = "nul",
chan: Optional[str] = "nul",
cmd: Optional[str] = "nul",
) -> bool:
if (
name.lower() in conf.servers[bot.server]["admins"]
or host in conf.admin_hosts

View file

@ -50,7 +50,10 @@ def PRIVMSG(bot: bare.bot, msg: str) -> Union[tuple[None, None], tuple[str, str]
if (
(name.startswith("saxjax") and bot.server == "efnet")
or (name == "ReplIRC" and bot.server == "replirc")
or (name in ["FirePyLink_", "FirePyLink"] and bot.server in ["ircnow", "backupbox"])
or (
name in ["FirePyLink_", "FirePyLink"]
and bot.server in ["ircnow", "backupbox"]
)
):
if "<" in msg and ">" in msg:
bridge = True
@ -101,9 +104,7 @@ def PRIVMSG(bot: bare.bot, msg: str) -> Union[tuple[None, None], tuple[str, str]
triggers,
cmds.data[cmd]["prefix"],
):
if (
"check" in cmds.data[cmd] and cmds.data[cmd]["check"]
):
if "check" in cmds.data[cmd] and cmds.data[cmd]["check"]:
if cmds.data[cmd]["check"](bot, name, host, chan, cmd):
cmds.call[cmd](bot, chan, name, message)
else:
@ -138,7 +139,10 @@ def PRIVMSG(bot: bare.bot, msg: str) -> Union[tuple[None, None], tuple[str, str]
bot.channels[chan] = 0
with open("mastermessages.txt", "r") as mm:
sel = conf.decode_escapes(
str(r.sample(mm.readlines(), 1)).strip("[]'").replace("\\n", "").strip('"')
str(r.sample(mm.readlines(), 1))
.strip("[]'")
.replace("\\n", "")
.strip('"')
)
bot.msg(f"[QUOTE] {sel}", chan)
return None, None
@ -168,7 +172,9 @@ def PART(bot: bare.bot, msg: str) -> tuple[None, None]:
return None, None
handles: dict[str, Callable[[bare.bot, str], Union[tuple[None, None], tuple[str, str]]]] = {
handles: dict[
str, Callable[[bare.bot, str], Union[tuple[None, None], tuple[str, str]]]
] = {
"PRIVMSG": PRIVMSG,
"NICK": NICK,
"KICK": KICK,

View file

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