fdie/frestart: Change quit message if aftergame

This commit is contained in:
nyuszika7h 2015-03-10 14:08:45 +01:00
parent de1c8a240f
commit fcdea846c1
2 changed files with 11 additions and 4 deletions

View File

@ -422,13 +422,15 @@ def forced_exit(cli, nick, chan, rest):
except Exception: except Exception:
notify_error(cli, chan, errlog) notify_error(cli, chan, errlog)
msg = "Forced quit from {0}" msg = "{0} quit from {1}"
if rest.strip(): if rest.strip():
msg += " ({1})" msg += " ({2})"
try: try:
cli.quit(msg.format(nick, rest.strip())) cli.quit(msg.format("Scheduled" if forced_exit.aftergame else "Forced",
nick,
rest.strip()))
except Exception: except Exception:
notify_error(cli, chan, errlog) notify_error(cli, chan, errlog)
sys.exit() sys.exit()
@ -454,7 +456,9 @@ def restart_program(cli, nick, chan, rest):
except Exception: except Exception:
notify_error(cli, chan, errlog) notify_error(cli, chan, errlog)
msg = "Forced restart from {0}".format(nick) msg = "{0} restart from {1}".format(
"Scheduled" if restart_program.aftergame else "Forced", nick)
rest = rest.strip() rest = rest.strip()
mode = None mode = None
@ -6818,7 +6822,9 @@ def aftergame(cli, rawnick, chan, rest):
if cmd in COMMANDS.keys(): if cmd in COMMANDS.keys():
def do_action(): def do_action():
for fn in COMMANDS[cmd]: for fn in COMMANDS[cmd]:
fn.aftergame = True
fn(cli, rawnick, botconfig.CHANNEL if fn.chan else nick, " ".join(rst)) fn(cli, rawnick, botconfig.CHANNEL if fn.chan else nick, " ".join(rst))
fn.aftergame = False
else: else:
cli.notice(nick, "That command was not found.") cli.notice(nick, "That command was not found.")
return return

View File

@ -149,6 +149,7 @@ def generate(fdict, permissions=True, **kwargs):
innerf.playing = playing innerf.playing = playing
innerf.roles = roles innerf.roles = roles
innerf.hookid = hookid innerf.hookid = hookid
innerf.aftergame = False
innerf.__doc__ = f.__doc__ innerf.__doc__ = f.__doc__
return innerf return innerf