Browse Source

add bash admin command

master
fosslinux 3 years ago
parent
commit
5df267b922
  1. 16
      nsbot.py

16
nsbot.py

@ -44,6 +44,13 @@ def recv(chan):
def send(msg, chan):
irc.send(enc("PRIVMSG " + chan + " :" + msg))
def update(chan):
code = subprocess.call("git pull")
if code == 0:
send("updated!", chan)
else:
send("there was an error updating.", chan)
def parse_admin(msg, chan):
admin_cmd = msg[10:]
if admin_cmd == "down":
@ -58,11 +65,10 @@ def parse_admin(msg, chan):
elif "raw" in admin_cmd:
irc.send(enc(admin_cmd[4:]))
elif admin_cmd == "update":
code = subprocess.call("git pull", shell=True)
if code == 0:
send("updated!", chan)
else:
send("there was an error updating.", chan)
update(chan)
elif "bash" in admin_cmd:
code = subprocess.call(admin_cmd[5:])
send("command completed with code " + str(code), chan)
def parse_msg(msg, user, chan):
if msg.startswith("!ns admin"):

Loading…
Cancel
Save