started cleaning up admin.py
This commit is contained in:
parent
90aa8976fc
commit
3224bbe370
1 changed files with 18 additions and 22 deletions
|
@ -17,21 +17,19 @@ def admins(inp, bot=None):
|
||||||
@hook.command(autohelp=False)
|
@hook.command(autohelp=False)
|
||||||
def channels(inp, conn=None):
|
def channels(inp, conn=None):
|
||||||
".channels -- Lists the channels that the bot is in."
|
".channels -- Lists the channels that the bot is in."
|
||||||
channels = conn.channels
|
return "I am in these channels: " + ", ".join(conn.channels)
|
||||||
return "I am in these channels: " + ", ".join(channels)
|
|
||||||
|
|
||||||
|
|
||||||
@hook.command(autohelp=False, adminonly=True)
|
@hook.command(autohelp=False, adminonly=True)
|
||||||
def stop(inp, input=None):
|
def stop(inp, nick=None, conn=None):
|
||||||
".stop [reason] -- Kills the bot with [reason] as its quit message."
|
".stop [reason] -- Kills the bot with [reason] as its quit message."
|
||||||
if inp:
|
if inp:
|
||||||
input.conn.send("QUIT :Killed by " + input.nick + " (" + inp + ")")
|
conn.cmd("QUIT", ["Killed by %s (%s)" % (nick, inp)])
|
||||||
else:
|
else:
|
||||||
input.conn.send("QUIT :Killed by " + input.nick + " (no reason)")
|
conn.cmd("QUIT", ["Killed by %s." % nick])
|
||||||
time.sleep(5)
|
time.sleep(5)
|
||||||
subprocess.call("./cloudbot stop", shell=True)
|
subprocess.call("./cloudbot stop", shell=True)
|
||||||
|
|
||||||
|
|
||||||
@hook.command("reboot", autohelp=False, adminonly=True)
|
@hook.command("reboot", autohelp=False, adminonly=True)
|
||||||
@hook.command(autohelp=False, adminonly=True)
|
@hook.command(autohelp=False, adminonly=True)
|
||||||
def restart(inp, input=None):
|
def restart(inp, input=None):
|
||||||
|
@ -44,34 +42,32 @@ def restart(inp, input=None):
|
||||||
os.execl("./cloudbot", "restart")
|
os.execl("./cloudbot", "restart")
|
||||||
|
|
||||||
|
|
||||||
@hook.command("clearlogs", autohelp=False, adminonly=True)
|
|
||||||
@hook.command(autohelp=False, adminonly=True)
|
@hook.command(autohelp=False, adminonly=True)
|
||||||
def clear(inp, input=None):
|
def clearlogs(inp, input=None):
|
||||||
".clear -- Clears the bots log(s)."
|
".clearlogs -- Clears the bots log(s)."
|
||||||
time.sleep(5)
|
|
||||||
subprocess.call("./cloudbot clear", shell=True)
|
subprocess.call("./cloudbot clear", shell=True)
|
||||||
|
|
||||||
|
|
||||||
@hook.command(adminonly=True)
|
@hook.command(adminonly=True)
|
||||||
def join(inp, input=None, notice=None):
|
def join(inp, input=None, notice=None):
|
||||||
".join <channel> -- Joins <channel>."
|
".join <channel> -- joins <channel>."
|
||||||
notice("Attempting to join " + inp + "...")
|
notice("Attempting to join " + inp + "...")
|
||||||
input.conn.send("JOIN " + inp)
|
conn.cmd("JOIN", [inp])
|
||||||
|
|
||||||
|
|
||||||
@hook.command(adminonly=True)
|
@hook.command(adminonly=True)
|
||||||
def cycle(inp, input=None, db=None, notice=None):
|
def cycle(inp, conn=None, notice=None):
|
||||||
".cycle <channel> -- Cycles <channel>."
|
".cycle <channel> -- cycles <channel>."
|
||||||
notice("Attempting to cycle " + inp + "...")
|
notice("Attempting to cycle " + inp + "...")
|
||||||
input.conn.send("PART " + inp)
|
conn.cmd("PART", [inp])
|
||||||
input.conn.send("JOIN " + inp)
|
conn.cmd("JOIN", [inp])
|
||||||
|
|
||||||
|
|
||||||
@hook.command(adminonly=True)
|
@hook.command(adminonly=True)
|
||||||
def part(inp, input=None, notice=None):
|
def part(inp, conn=None, notice=None):
|
||||||
".part <channel> -- Parts from <channel>."
|
".part <channel> -- parts <channel>."
|
||||||
notice("Attempting to part from " + inp + "...")
|
notice("Attempting to part from " + inp + "...")
|
||||||
input.conn.send("PART " + inp)
|
conn.cmd("PART", [inp])
|
||||||
|
|
||||||
|
|
||||||
@hook.command(adminonly=True)
|
@hook.command(adminonly=True)
|
||||||
|
@ -85,14 +81,14 @@ def nick(inp, input=None, notice=None, set_nick=None):
|
||||||
|
|
||||||
|
|
||||||
@hook.command(adminonly=True)
|
@hook.command(adminonly=True)
|
||||||
def raw(inp, input=None, notice=None):
|
def raw(inp, conn=None, notice=None):
|
||||||
".raw <command> -- Sends a RAW IRC command."
|
".raw <command> -- Sends a RAW IRC command."
|
||||||
notice("Raw command sent.")
|
notice("Raw command sent.")
|
||||||
input.conn.send(inp)
|
conn.send(inp)
|
||||||
|
|
||||||
|
|
||||||
@hook.command(adminonly=True)
|
@hook.command(adminonly=True)
|
||||||
def kick(inp, input=None, notice=None):
|
def kick(inp, chan=None, notice=None):
|
||||||
".kick [channel] <user> [reason] -- kicks a user."
|
".kick [channel] <user> [reason] -- kicks a user."
|
||||||
split = inp.split(" ")
|
split = inp.split(" ")
|
||||||
if split[0][0] == "#":
|
if split[0][0] == "#":
|
||||||
|
|
Reference in a new issue