Formatting, adding some aliases, early work on better help command

This commit is contained in:
Firepup Sixfifty 2024-09-17 12:05:56 -05:00
parent 3053948bdc
commit 56e60f59ce
Signed by: Firepup650
SSH key fingerprint: SHA256:cb8sEJwc0kQJ6/nMUhscWRe35itf0NFMdSKl3v4qt48

View file

@ -67,27 +67,29 @@ def isAdmin(bot: bare.bot, chan: str, name: str, message: str) -> None:
def help(bot: bare.bot, chan: str, name: str, message: str) -> None: def help(bot: bare.bot, chan: str, name: str, message: str) -> None:
helpErr = False helpErr = False
category = None
if len(message.split(" ")) > 1:
category = message.split(" ")[1]
if bot.current == "bridge": if bot.current == "bridge":
helpErr = True helpErr = True
if not helpErr: if not helpErr:
bot.msg("Command list needs rework", name) bot.msg("Command list needs rework", chan)
return return
bot.msg("List of commands:", name) match category:
bot.msg(f'Current bot.prefix is "{bot.prefix}"', name) case None:
bot.msg(f"{bot.prefix}help - Sends this help list", name) bot.msg("Categories of commands: gen, dbg, adm, fun, msc", chan)
bot.msg(f"{bot.prefix}quote - Sends a random firepup quote", name) case "gen":
bot.msg( bot.msg("Commands in the General category: ", chan)
f"{bot.prefix}(eightball,8ball,8b) [question]? - Asks the magic eightball a question", case "dbg":
name, bot.msg("Commands in the [DEBUG] category: ", chan)
) case "adm":
bot.msg(f"(hi,hello) {bot.nick} - The bot says hi to you", name) bot.msg("Commands in the Admin category: ", chan)
if checks.admin(bot, name): case "fun":
bot.msg(f"reboot {bot.rebt} - Restarts the bot", name) bot.msg("Commands in the Fun category: ", chan)
bot.msg("op me - Makes the bot try to op you", name) case "msc":
bot.msg( bot.msg("Commands in the Misc. category: ", chan)
f"{bot.prefix}join [channel(s)] - Joins the bot to the specified channel(s)", case _:
name, bot.msg("Unknown commands category.", chan)
)
else: else:
bot.msg("Sorry, I can't send help to bridged users.", chan) bot.msg("Sorry, I can't send help to bridged users.", chan)
@ -323,7 +325,11 @@ def slap(bot: bare.bot, chan: str, name: str, message: str) -> None:
msg = name msg = name
else: else:
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: def morning(bot: bare.bot, chan: str, name: str, message: str) -> None:
msg = message.split(" ") msg = message.split(" ")
@ -339,6 +345,7 @@ def morning(bot: bare.bot, chan: str, name: str, message: str) -> None:
return return
bot.msg(f"Good morning {name}{postfix}", chan) bot.msg(f"Good morning {name}{postfix}", chan)
def night(bot: bare.bot, chan: str, name: str, message: str) -> None: def night(bot: bare.bot, chan: str, name: str, message: str) -> None:
msg = message.split(" ") msg = message.split(" ")
addresse = " ".join(msg[2:]).strip().lower() addresse = " ".join(msg[2:]).strip().lower()
@ -353,6 +360,7 @@ def night(bot: bare.bot, chan: str, name: str, message: str) -> None:
return return
bot.msg(f"Good night {name}{postfix}", chan) bot.msg(f"Good night {name}{postfix}", chan)
def afternoon(bot: bare.bot, chan: str, name: str, message: str) -> None: def afternoon(bot: bare.bot, chan: str, name: str, message: str) -> None:
msg = message.split(" ") msg = message.split(" ")
addresse = " ".join(msg[2:]).strip().lower() addresse = " ".join(msg[2:]).strip().lower()
@ -396,7 +404,7 @@ data: dict[str, dict[str, Any]] = {
"aliases": ["g.m.d"], "aliases": ["g.m.d"],
"check": checks.admin, "check": checks.admin,
}, },
"help": {"prefix": True, "aliases": ["?"]}, "help": {"prefix": True, "aliases": ["?", "list", "h"]},
"amiadmin": {"prefix": True, "aliases": []}, "amiadmin": {"prefix": True, "aliases": []},
"ping": {"prefix": True, "aliases": []}, "ping": {"prefix": True, "aliases": []},
"op me": {"prefix": False, "aliases": [], "check": checks.admin}, "op me": {"prefix": False, "aliases": [], "check": checks.admin},
@ -409,9 +417,12 @@ data: dict[str, dict[str, Any]] = {
"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 morning": {
"good night": {"prefix": False, "aliases": []}, "prefix": False,
"good afternoon": {"prefix": False, "aliases": []}, "aliases": ["g'morning", "morning", "mornin'", "good mornin'"],
},
"good night": {"prefix": False, "aliases": ["g'night", "night"]},
"good afternoon": {"prefix": False, "aliases": ["g'afternoon", "afternoon"]},
} }
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]] = {