Update sweebot.py

This commit is contained in:
Swee 2024-09-22 13:59:28 -07:00
parent 4243df401b
commit 4a45689c05

View file

@ -250,13 +250,13 @@ while True:
run-=1 run-=1
update() update()
else: else:
if path.isfile("/home/swee/helps/" + " ".join(command[1:])): if path.isfile(cwd + "/helps/" + " ".join(command[1:])):
output = open("/home/swee/helps/" + " ".join(command[1:])).read() output = open(cwd + "/helps/" + " ".join(command[1:])).read()
multiline(output) multiline(output)
else: else:
irc.send_irc(channel, "Either the command isn't documented yet or it doesn't exist lol") irc.send_irc(channel, "Either the command isn't documented yet or it doesn't exist lol")
else: else:
irc.send_irc(channel, "tip, ping, whoami, perms, version, figlet, tdfiglet, cowsay, uptime, cc, joke. (restart, join, part, shell, config.) Use '$help (command)' for explanation.") irc.send_irc(channel, "tip, ping, whoami, perms, version, figlet, tdfiglet, cowsay, uptime, cc, joke, botsnack. (restart, join, part, shell, config, pull.) Use '$help (command)' for explanation.")
elif command[0] == "$tip": elif command[0] == "$tip":
result = subprocess.run(['fortune'], stdout=subprocess.PIPE) result = subprocess.run(['fortune'], stdout=subprocess.PIPE)
@ -500,11 +500,11 @@ while True:
run-=1 run-=1
update() update()
else: else:
if path.isfile("/home/swee/cc/" + command[0][1:]): if path.isfile(cwd + "/cc/" + command[0][1:]):
try: try:
com = ['python3'] com = ['python3']
comm = command comm = command
com.append("/home/swee/cc/" + comm[0][1:]) com.append(cwd + "/cc/" + comm[0][1:])
com.append(nick) com.append(nick)
com.append(username) com.append(username)
comm.pop(0) comm.pop(0)
@ -513,9 +513,9 @@ while True:
system(com, channel) system(com, channel)
except Exception as ex: except Exception as ex:
irc.send_irc(channel, nick + ": " + ex.__class__.__name__) irc.send_irc(channel, nick + ": " + ex.__class__.__name__)
elif path.isdir("/home/swee/cc/" + command[0][1:]): elif path.isdir(cwd + "/cc/" + command[0][1:]):
irc.send_irc(channel, nick + ": Command list under cc/debug:") irc.send_irc(channel, nick + ": Command list under cc/debug:")
irc.send_irc(channel, ", ".join(listdir("/home/swee/cc/" + command[0][1:])) + ".") irc.send_irc(channel, ", ".join(listdir(cwd + "/cc/" + command[0][1:])) + ".")
else: else: