Add some commands, correct some strings, update admin IP, and add +k to possible reasons joining a channel failed.

This commit is contained in:
Firepup Sixfifty 2024-09-13 09:34:55 -05:00
parent 67cbb64a31
commit 3053948bdc
Signed by: Firepup650
GPG key ID: 7C92E2ABBBFAB9BA
4 changed files with 59 additions and 6 deletions

5
bot.py
View file

@ -191,6 +191,11 @@ class bot(bare.bot):
if origin != "null": if origin != "null":
self.msg(f"I'm banned from {chan}.", origin) self.msg(f"I'm banned from {chan}.", origin)
break break
elif code == 475:
self.log(f"Joining {chan} failed (+k without/with bad key)")
if origin != "null":
self.msg(f"{chan} is +k, and either you didn't give me a key, or you gave me the wrong one.", origin)
break
elif code == 480: elif code == 480:
self.log(f"Joining {chan} failed (+S)", "WARN") self.log(f"Joining {chan} failed (+S)", "WARN")
if origin != "null": if origin != "null":

View file

@ -325,6 +325,48 @@ def slap(bot: bare.bot, chan: str, name: str, message: str) -> None:
msg = name msg = name
bot.msg(f"\x01ACTION slaps {msg} around a bit with {r.choice(['a firewall', 'a fireball', 'a large trout', 'a computer', 'an rpi4', 'an rpi5', 'firepi', name])}\x01", chan) bot.msg(f"\x01ACTION slaps {msg} around a bit with {r.choice(['a firewall', 'a fireball', 'a large trout', 'a computer', 'an rpi4', 'an rpi5', 'firepi', name])}\x01", chan)
def morning(bot: bare.bot, chan: str, name: str, message: str) -> None:
msg = message.split(" ")
addresse = " ".join(msg[2:]).strip().lower()
postfix = ""
if addresse and addresse[-1] in ["!", ".", "?"]:
postfix = addresse[-1]
addresse = addresse[:-1]
elif message[-1] in ["!", ".", "?"]:
postfix = addresse[-1]
addresse = addresse[:-1]
if addresse not in ["everyone", "people", bot.nick.lower(), ""]:
return
bot.msg(f"Good morning {name}{postfix}", chan)
def night(bot: bare.bot, chan: str, name: str, message: str) -> None:
msg = message.split(" ")
addresse = " ".join(msg[2:]).strip().lower()
postfix = ""
if addresse and addresse[-1] in ["!", ".", "?"]:
postfix = addresse[-1]
addresse = addresse[:-1]
elif message[-1] in ["!", ".", "?"]:
postfix = addresse[-1]
addresse = addresse[:-1]
if addresse not in ["everyone", "people", bot.nick.lower(), ""]:
return
bot.msg(f"Good night {name}{postfix}", chan)
def afternoon(bot: bare.bot, chan: str, name: str, message: str) -> None:
msg = message.split(" ")
addresse = " ".join(msg[2:]).strip().lower()
postfix = ""
if addresse and addresse[-1] in ["!", ".", "?"]:
postfix = addresse[-1]
addresse = addresse[:-1]
elif message[-1] in ["!", ".", "?"]:
postfix = addresse[-1]
addresse = addresse[:-1]
if addresse not in ["everyone", "people", bot.nick.lower(), ""]:
return
bot.msg(f"Good afternoon {name}{postfix}", chan)
data: dict[str, dict[str, Any]] = { data: dict[str, dict[str, Any]] = {
"!botlist": {"prefix": False, "aliases": []}, "!botlist": {"prefix": False, "aliases": []},
@ -336,7 +378,7 @@ data: dict[str, dict[str, Any]] = {
"aliases": ["reboot", "stop", "hardreload", "hr"], "aliases": ["reboot", "stop", "hardreload", "hr"],
"check": checks.admin, "check": checks.admin,
}, },
"uptime": {"prefix": True, "aliases": []}, "uptime": {"prefix": True, "aliases": ["u"]},
"raw": {"prefix": True, "aliases": ["cmd "], "check": checks.admin}, "raw": {"prefix": True, "aliases": ["cmd "], "check": checks.admin},
"debug": {"prefix": True, "aliases": ["dbg", "d"], "check": checks.admin}, "debug": {"prefix": True, "aliases": ["dbg", "d"], "check": checks.admin},
"debugInternal": { "debugInternal": {
@ -366,7 +408,10 @@ data: dict[str, dict[str, Any]] = {
"setStatus": {"prefix": True, "aliases": ["sS"], "check": checks.admin}, "setStatus": {"prefix": True, "aliases": ["sS"], "check": checks.admin},
"getStatus": {"prefix": True, "aliases": ["gS"]}, "getStatus": {"prefix": True, "aliases": ["gS"]},
"check": {"prefix": True, "aliases": [], "check": checks.admin}, "check": {"prefix": True, "aliases": [], "check": checks.admin},
"slap": {"prefix": True, "aliases": ["s"]} "slap": {"prefix": True, "aliases": ["s"]},
"good morning": {"prefix": False, "aliases": []},
"good night": {"prefix": False, "aliases": []},
"good afternoon": {"prefix": False, "aliases": []},
} }
regexes: list[str] = [conf.npbase, conf.su] regexes: list[str] = [conf.npbase, conf.su]
call: dict[str, Callable[[bare.bot, str, str, str], None]] = { call: dict[str, Callable[[bare.bot, str, str, str], None]] = {
@ -399,4 +444,7 @@ call: dict[str, Callable[[bare.bot, str, str, str], None]] = {
"getStatus": getStatus, "getStatus": getStatus,
"check": check, "check": check,
"slap": slap, "slap": slap,
"good morning": morning,
"good night": night,
"good afternoon": afternoon,
} }

View file

@ -32,7 +32,7 @@ ipbl = DNSBLIpChecker(providers=providers)
hsbl = DNSBLDomainChecker(providers=providers) hsbl = DNSBLDomainChecker(providers=providers)
load_dotenv() load_dotenv()
__version__ = "v3.0.20" __version__ = "v3.0.21"
npbase: str = ( npbase: str = (
"\[\x0303last\.fm\x03\] [A-Za-z0-9_[\]{}\\|\-^]{1,$MAX} (is listening|last listened) to: \x02.+ - .*\x02( \([0-9]+ plays\)( \[.*\])?)?" # pyright: ignore [reportInvalidStringEscapeSequence] "\[\x0303last\.fm\x03\] [A-Za-z0-9_[\]{}\\|\-^]{1,$MAX} (is listening|last listened) to: \x02.+ - .*\x02( \([0-9]+ plays\)( \[.*\])?)?" # pyright: ignore [reportInvalidStringEscapeSequence]
) )
@ -101,7 +101,7 @@ servers: dict[str, dict[str, Any]] = {
"prefix": "!", "prefix": "!",
}, },
} }
admin_hosts: list[str] = ["firepup.firepi", "47.221.108.152"] admin_hosts: list[str] = ["firepup.firepi", "47.221.98.52"]
ESCAPE_SEQUENCE_RE = re.compile( ESCAPE_SEQUENCE_RE = re.compile(
r""" r"""
( \\U........ # 8-digit hex escapes ( \\U........ # 8-digit hex escapes

View file

@ -15,7 +15,7 @@ def CTCP(bot: bare.bot, msg: str) -> bool:
bot.log(f'Responding to CTCP "{kind}" from {sender}') bot.log(f'Responding to CTCP "{kind}" from {sender}')
if kind == "VERSION": if kind == "VERSION":
bot.notice( bot.notice(
f"\x01VERSION FireBot {conf.__version__} (https://git.amcforum.wiki/Firepup650/fire-ircbot)\x01", f"\x01VERSION FireBot {conf.__version__} (https://git.h.hackclub.app/Firepup650/FireBot)\x01",
sender, sender,
True, True,
) )
@ -25,7 +25,7 @@ def CTCP(bot: bare.bot, msg: str) -> bool:
return True return True
elif kind == "SOURCE": elif kind == "SOURCE":
bot.notice( bot.notice(
"\x01SOURCE https://git.amcforum.wiki/Firepup650/fire-ircbot\x01", "\x01SOURCE https://git.h.hackclub.app/Firepup650/FireBot\x01",
sender, sender,
True, True,
) )