added crapdate, the crappy and hacky update command (also crapdate log, to show commit history)

This commit is contained in:
jan6 2023-10-09 11:36:06 -05:00
parent 6f06ccd1a0
commit 1ffe8c91ef
1 changed files with 23 additions and 6 deletions

View File

@ -112,6 +112,8 @@ class Command:
command = "weather"
elif cmd.startswith("me "):
command = "me"
elif cmd == "crapdate" or cmd.startswith("crapdate "):
command = "crapdate"
elif cmd == "dbg" or cmd.startswith("dbg "):
command = "dbg"
elif cmd == "dbg2" or cmd.startswith("dbg2 "):
@ -145,14 +147,14 @@ class Command:
notice = self.notice
ctcp = cmd[1:]
ctcp_upper = ctcp.upper()
if not ctcp.endswith("\x01"):
ctcp = ctcp + "\x01"
if ctcp_upper.startswith("PING"):
ctcp = (
"\x01PING"
+ ("" if 1 == len(ctcp.split(" ")) else " ")
+ " ".join(ctcp.split(" ")[1:])
)
if not ctcp.endswith("\x01"):
ctcp = ctcp + "\x01"
print(ctcp)
self.notice(ctcp)
if ctcp_upper.startswith("SOURCE"):
@ -174,9 +176,24 @@ class Command:
def quit(self, prefix, cmd, pm, line, admin, mesg):
if admin and (cmd == "q" or cmd == "quit"):
self.util.quit()
elif is_adm and (cmd.startswith("q ") or cmd.startswith("quit ")):
elif admin and (cmd.startswith("q ") or cmd.startswith("quit ")):
self.util.quit(cmd.split(" ", 1)[1])
@adm
def crapdate(self, prefix, cmd, pm, line, admin, mesg):
"""hacky and crappy update command, don't use it, lol"""
args=cmd.split()[1:]
if not args:args=['']
popen=__import__("os").popen
# mesg(args)
if args[0] in ["log","list"]:
if len(args) == 1 : args=args+["",3]
elif len(args) < 3: args=args+["3"]
for i in popen(f"git log --pretty=oneline --abbrev-commit {args[1]}").read().split("\n",int(args[2])): mesg(i)
else:
mesg(popen("git pull").read())
mesg(popen("git status|tr '\\n' ' '").read())
@adm
def dbg(self, prefix, cmd, pm, line, admin, mesg):
"""temporary debug command, subject to change A LOT"""
@ -208,17 +225,17 @@ class Command:
@cmd
def echo(self, prefix, cmd, pm, line, admin, mesg):
"""simple echo command"""
"""simple echo command | "echo ABC..." """
mesg("\x7f" + cmd.split(" ", 1)[1])
@cmd
def choose(self, prefix, cmd, pm, line, admin, mesg):
f"""simple random choice command, "{self.config.cmd.prefixes[0]}choose A B C..." """
"""simple random choice command | "choose A B C..." """
mesg("I choose: " + str(random.choice(cmd.split(" ", 1)[1].split(" "))))
@cmd
def dice(self, prefix, cmd, pm, line, admin, mesg):
f"""simple dice command, "{self.config.cmd.prefixes[0]}roll [N[d[M]]]" where N is number of dice, and M is number of faces"""
"""simple dice command | "roll [N[d[M]]]" where N is number of dice, and M is number of faces"""
cmd = cmd.split(" ", 1)[1]
amount, faces = 1, 6
try: