Also update frestart

I guess I lied, that wasn't my last commit for today.
This commit is contained in:
nyuszika7h 2015-02-27 20:58:14 +01:00
parent 0bbfee91f4
commit 81ae2e7516

View File

@ -430,24 +430,27 @@ def forced_exit(cli, nick, chan, rest):
def restart_program(cli, nick, chan, rest): def restart_program(cli, nick, chan, rest):
"""Restarts the bot.""" """Restarts the bot."""
try:
if var.PHASE in ("day", "night"): if var.PHASE in ("day", "night"):
try: try:
stop_game(cli) stop_game(cli)
except: except Exception:
errlog(traceback.format_exc()) notify_error(cli, chan, errlog)
url = pastebin(traceback.format_exc())
cli.msg(chan, "An error has occurred and has been logged.{0}" try:
.format((" " + url) if url else "")) reset_modes_timers(cli)
reset_modes_timers(cli) except Exception:
reset() notify_error(cli, chan, errlog)
else:
reset_modes_timers(cli) try:
reset() reset()
except Exception:
notify_error(cli, chan, errlog)
try:
cli.quit("Forced restart from {0}".format(nick))
except Exception:
notify_error(cli, chan, errlog)
cli.quit("Forced restart from "+nick)
raise SystemExit
finally:
plog("RESTARTING") plog("RESTARTING")
python = sys.executable python = sys.executable
if rest.strip().lower() == "debugmode": if rest.strip().lower() == "debugmode":
@ -459,6 +462,7 @@ def restart_program(cli, nick, chan, rest):
else: else:
os.execl(python, python, *sys.argv) os.execl(python, python, *sys.argv)
@cmd("ping", pm=True) @cmd("ping", pm=True)
def pinger(cli, nick, chan, rest): def pinger(cli, nick, chan, rest):
"""Pings the channel to get people's attention. Rate-limited.""" """Pings the channel to get people's attention. Rate-limited."""