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

View File

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