forked from Firepup650/FireBot
Formatting
This commit is contained in:
parent
fbd2188a37
commit
87ed08e5cd
5 changed files with 20 additions and 10 deletions
|
@ -101,7 +101,9 @@ def quote(bot: bare.bot, chan: str, name: str, message: str) -> None:
|
|||
r.seed()
|
||||
mm = open("mastermessages.txt", "r")
|
||||
q = mm.readlines()
|
||||
sel = conf.decode_escapes(str(r.sample(q, 1)).strip("[]'").replace("\\n", "").strip('"'))
|
||||
sel = conf.decode_escapes(
|
||||
str(r.sample(q, 1)).strip("[]'").replace("\\n", "").strip('"')
|
||||
)
|
||||
bot.msg(sel, chan)
|
||||
mm.close()
|
||||
|
||||
|
@ -127,7 +129,8 @@ def debug(bot: bare.bot, chan: str, name: str, message: str) -> None:
|
|||
"VERSION": bot.__version__,
|
||||
"NICKLEN": bot.nicklen,
|
||||
"NICK": bot.nick,
|
||||
"ADMINS": str(conf.servers[bot.server]["admins"]) + " (Does not include hostname checks)",
|
||||
"ADMINS": str(conf.servers[bot.server]["admins"])
|
||||
+ " (Does not include hostname checks)",
|
||||
"CHANNELS": bot.channels,
|
||||
}
|
||||
bot.msg(f"[DEBUG] {dbg_out}", chan)
|
||||
|
|
|
@ -37,7 +37,7 @@ servers: dict[str, dict[str, Any]] = {
|
|||
"channels": {"#default": 0, "#botrebellion": 0},
|
||||
"admins": [],
|
||||
"hosts": ["172.20.171.225", "169.254.253.107"],
|
||||
}
|
||||
},
|
||||
}
|
||||
admin_hosts: list[str] = ["firepup.firepi", "47.221.227.180"]
|
||||
ESCAPE_SEQUENCE_RE = re.compile(
|
||||
|
@ -67,5 +67,10 @@ def mfind(message: str, find: list, usePrefix: bool = True) -> bool:
|
|||
else:
|
||||
return any(message[: len(match)] == match for match in find)
|
||||
|
||||
|
||||
def adminCheck(bot: bare.bot, name: str, host: Optional[str] = "nul") -> bool:
|
||||
return name.lower() in servers[bot.server]["admins"] or host in admin_hosts or host in servers[bot.server]["hosts"]
|
||||
return (
|
||||
name.lower() in servers[bot.server]["admins"]
|
||||
or host in admin_hosts
|
||||
or host in servers[bot.server]["hosts"]
|
||||
)
|
||||
|
|
|
@ -45,9 +45,11 @@ def PRIVMSG(bot: bare.bot, msg: str) -> tuple[Union[None, str], Union[None, str]
|
|||
# Format of ":[Nick]![ident]@[host|vhost] PRIVMSG [channel] :[message]”
|
||||
name = msg.split("!", 1)[0][1:]
|
||||
host = msg.split("@", 1)[1].split(" ", 1)[0]
|
||||
if (name.startswith("saxjax") and bot.server == "efnet") or (
|
||||
name == "ReplIRC" and bot.server == "replirc"
|
||||
) or (name == "FirePyLink_" and bot.server == "ircnow"):
|
||||
if (
|
||||
(name.startswith("saxjax") and bot.server == "efnet")
|
||||
or (name == "ReplIRC" and bot.server == "replirc")
|
||||
or (name == "FirePyLink_" and bot.server == "ircnow")
|
||||
):
|
||||
if "<" in msg and ">" in msg:
|
||||
Nname = msg.split("<", 1)[1].split(">", 1)[0].strip()
|
||||
if name == "ReplIRC":
|
||||
|
|
4
logs.py
4
logs.py
|
@ -17,9 +17,9 @@ def log(
|
|||
if time == "now":
|
||||
dtime = dt.now()
|
||||
elif type(time) == str:
|
||||
raise ValueError("Only \"now\" is an accepted string argument for time")
|
||||
raise ValueError('Only "now" is an accepted string argument for time')
|
||||
else:
|
||||
dtime = time # type: dt #type: ignore
|
||||
dtime = time # type: dt #type: ignore
|
||||
time = dtime.strftime("%H:%M:%S")
|
||||
if not "\n" in message:
|
||||
print(f"[{level}][{origin}][{time}] {message}", file=stream)
|
||||
|
|
|
@ -46,7 +46,7 @@ class bytes(bbytes):
|
|||
def safe_decode(cls) -> str:
|
||||
'Calls cls.decode(cls, errors = "ignore"), if that errors, returns a blank string'
|
||||
try:
|
||||
return cls.decode(cls.value, errors = "ignore") # type: ignore
|
||||
return cls.decode(cls.value, errors="ignore") # type: ignore
|
||||
except TypeError:
|
||||
print("panik - invalid UTF-8")
|
||||
return "nul"
|
||||
|
|
Loading…
Reference in a new issue