Merge branch 'feature/restart' into develop
This commit is contained in:
commit
d3848c64a5
2 changed files with 25 additions and 1 deletions
10
lib/restart.sh
Executable file
10
lib/restart.sh
Executable file
|
@ -0,0 +1,10 @@
|
||||||
|
#!/bin/sh
|
||||||
|
sleep 5
|
||||||
|
if [ -f ./control.sh ]; then
|
||||||
|
./control.sh restart
|
||||||
|
elif [ -f ./bot.sh ]; then
|
||||||
|
./bot.sh restart
|
||||||
|
else
|
||||||
|
./bot.py
|
||||||
|
fi
|
||||||
|
exit 0
|
|
@ -3,9 +3,10 @@
|
||||||
# Improved by Lukeroge
|
# Improved by Lukeroge
|
||||||
from util import hook
|
from util import hook
|
||||||
import sys
|
import sys
|
||||||
|
import subprocess
|
||||||
import time
|
import time
|
||||||
|
|
||||||
@hook.command
|
@hook.command(autohelp=False)
|
||||||
def quit(inp, input=None, db=None, notice=None):
|
def quit(inp, input=None, db=None, notice=None):
|
||||||
".quit [reason] -- Kills the bot, with [reason] reason as its quit message.."
|
".quit [reason] -- Kills the bot, with [reason] reason as its quit message.."
|
||||||
if not input.nick in input.bot.config["admins"]:
|
if not input.nick in input.bot.config["admins"]:
|
||||||
|
@ -18,6 +19,19 @@ def quit(inp, input=None, db=None, notice=None):
|
||||||
time.sleep(3)
|
time.sleep(3)
|
||||||
sys.exit()
|
sys.exit()
|
||||||
|
|
||||||
|
@hook.command(autohelp=False)
|
||||||
|
def restart(inp, input=None, db=None, notice=None):
|
||||||
|
".restart [reason] -- Restarts the bot, with [reason] reason as its quit message.."
|
||||||
|
if not input.nick in input.bot.config["admins"]:
|
||||||
|
notice("Only bot admins can use this command!")
|
||||||
|
return
|
||||||
|
if inp:
|
||||||
|
input.conn.send("QUIT :Bot restarted by "+input.nick+" (" + inp + ")")
|
||||||
|
else:
|
||||||
|
input.conn.send("QUIT :Bot restarted by "+input.nick+" (no reason)")
|
||||||
|
time.sleep(3)
|
||||||
|
subprocess.call(['lib/restart.sh'])
|
||||||
|
sys.exit()
|
||||||
|
|
||||||
@hook.command
|
@hook.command
|
||||||
def join(inp, input=None, db=None, notice=None):
|
def join(inp, input=None, db=None, notice=None):
|
||||||
|
|
Reference in a new issue