Tweaks to admin.py + new command
This commit is contained in:
parent
ad3db1d036
commit
988d46d797
1 changed files with 12 additions and 6 deletions
|
@ -7,16 +7,22 @@ import time
|
||||||
import re
|
import re
|
||||||
|
|
||||||
|
|
||||||
@hook.command("owners", autohelp=False)
|
|
||||||
@hook.command(autohelp=False)
|
@hook.command(autohelp=False)
|
||||||
def admins(inp, bot=None):
|
def admins(inp, bot=None):
|
||||||
".admins -- Lists the bot's admins."
|
".admins -- Lists the bot's admins."
|
||||||
admins = bot.config["admins"]
|
admins = bot.config["admins"]
|
||||||
return ", ".join(admins)
|
return ", ".join(admins)
|
||||||
|
|
||||||
|
|
||||||
|
@hook.command(autohelp=False)
|
||||||
|
def channels(inp, conn=None):
|
||||||
|
".channels -- Lists the channels that the bot is in."
|
||||||
|
channels = 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, db=None, notice=None):
|
def stop(inp, input=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 + ")")
|
input.conn.send("QUIT :Killed by " + input.nick + " (" + inp + ")")
|
||||||
|
@ -28,7 +34,7 @@ def stop(inp, input=None, db=None, notice=None):
|
||||||
|
|
||||||
@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, db=None, notice=None):
|
def restart(inp, input=None):
|
||||||
".restart [reason] -- Restarts the bot with [reason] as its quit message."
|
".restart [reason] -- Restarts the bot with [reason] as its quit message."
|
||||||
if inp:
|
if inp:
|
||||||
input.conn.send("QUIT :Restarted by " + input.nick + " (" + inp + ")")
|
input.conn.send("QUIT :Restarted by " + input.nick + " (" + inp + ")")
|
||||||
|
@ -40,14 +46,14 @@ def restart(inp, input=None, db=None, notice=None):
|
||||||
|
|
||||||
@hook.command("clearlogs", autohelp=False, adminonly=True)
|
@hook.command("clearlogs", autohelp=False, adminonly=True)
|
||||||
@hook.command(autohelp=False, adminonly=True)
|
@hook.command(autohelp=False, adminonly=True)
|
||||||
def clear(inp, input=None, db=None, notice=None):
|
def clear(inp, input=None):
|
||||||
".clear -- Clears the bots log(s)."
|
".clear -- Clears the bots log(s)."
|
||||||
time.sleep(5)
|
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, db=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)
|
input.conn.send("JOIN " + inp)
|
||||||
|
@ -74,7 +80,7 @@ def nick(inp, input=None, notice=None, set_nick=None):
|
||||||
if not re.match("^[A-Za-z0-9_|.-\]\[]*$", inp.lower()):
|
if not re.match("^[A-Za-z0-9_|.-\]\[]*$", inp.lower()):
|
||||||
notice("Invalid username!")
|
notice("Invalid username!")
|
||||||
return
|
return
|
||||||
notice("Changing nick to " + inp + ".")
|
notice("Attempting to change nick to " + inp + ".")
|
||||||
set_nick(inp)
|
set_nick(inp)
|
||||||
|
|
||||||
|
|
||||||
|
|
Reference in a new issue