1
0
Fork 0
forked from swee/MeowNex

Prepare for contribution #1

Merged
10kilo merged 30 commits from swee/MeowNex:main into main 2024-12-13 12:59:40 -08:00
Showing only changes of commit 6b55d21f91 - Show all commits

View file

@ -273,12 +273,18 @@ def restart():
irc2.irc_socket.close()
irc3.irc_socket.close()
exit(0)
def system(cmd, chan):
def system(cmd, chan, rstrip=False):
try:
p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
outpp = ""
for line in iter(p.stdout.readline, b''):
if text != "" and text != " ":
if not rstrip
multiline(line.rstrip(), chan)
else:
outpp += line.rstrip() + " "
if rstrip:
multiline(outpp[:-1])
p.stdout.close()
p.wait()
except FileNotFoundError:
@ -349,7 +355,7 @@ while True:
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":
system(["/usr/games/fortune", "debian-hints"], channel)
system(["/usr/games/fortune", "debian-hints"], channel, True)
elif command[0] == "$whoami":
if perms != "":