forked from Firepup650/FireBot
Formatting
This commit is contained in:
parent
478bcb9d04
commit
e7acda43b4
3 changed files with 21 additions and 7 deletions
|
@ -4,7 +4,14 @@ import random as r
|
||||||
from typing import Any, Callable, Optional
|
from typing import Any, Callable, Optional
|
||||||
import bare, re
|
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 (
|
if (
|
||||||
name.lower() in conf.servers[bot.server]["admins"]
|
name.lower() in conf.servers[bot.server]["admins"]
|
||||||
or host in conf.admin_hosts
|
or host in conf.admin_hosts
|
||||||
|
|
18
handlers.py
18
handlers.py
|
@ -50,7 +50,10 @@ def PRIVMSG(bot: bare.bot, msg: str) -> Union[tuple[None, None], tuple[str, str]
|
||||||
if (
|
if (
|
||||||
(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 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:
|
if "<" in msg and ">" in msg:
|
||||||
bridge = True
|
bridge = True
|
||||||
|
@ -101,9 +104,7 @@ def PRIVMSG(bot: bare.bot, msg: str) -> Union[tuple[None, None], tuple[str, str]
|
||||||
triggers,
|
triggers,
|
||||||
cmds.data[cmd]["prefix"],
|
cmds.data[cmd]["prefix"],
|
||||||
):
|
):
|
||||||
if (
|
if "check" in cmds.data[cmd] and cmds.data[cmd]["check"]:
|
||||||
"check" in cmds.data[cmd] and cmds.data[cmd]["check"]
|
|
||||||
):
|
|
||||||
if cmds.data[cmd]["check"](bot, name, host, chan, cmd):
|
if cmds.data[cmd]["check"](bot, name, host, chan, cmd):
|
||||||
cmds.call[cmd](bot, chan, name, message)
|
cmds.call[cmd](bot, chan, name, message)
|
||||||
else:
|
else:
|
||||||
|
@ -138,7 +139,10 @@ def PRIVMSG(bot: bare.bot, msg: str) -> Union[tuple[None, None], tuple[str, str]
|
||||||
bot.channels[chan] = 0
|
bot.channels[chan] = 0
|
||||||
with open("mastermessages.txt", "r") as mm:
|
with open("mastermessages.txt", "r") as mm:
|
||||||
sel = conf.decode_escapes(
|
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)
|
bot.msg(f"[QUOTE] {sel}", chan)
|
||||||
return None, None
|
return None, None
|
||||||
|
@ -168,7 +172,9 @@ def PART(bot: bare.bot, msg: str) -> tuple[None, None]:
|
||||||
return 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,
|
"PRIVMSG": PRIVMSG,
|
||||||
"NICK": NICK,
|
"NICK": NICK,
|
||||||
"KICK": KICK,
|
"KICK": KICK,
|
||||||
|
|
|
@ -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