From 797d95fac85ae5588778c675f0dec27f1d87b2d4 Mon Sep 17 00:00:00 2001 From: nyuszika7h Date: Tue, 25 Oct 2016 16:38:46 +0200 Subject: [PATCH] Fixes to !fpull and !frestart --- messages/en.json | 2 +- src/wolfgame.py | 20 ++++++++------------ 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/messages/en.json b/messages/en.json index c6ba9fa..1310be7 100644 --- a/messages/en.json +++ b/messages/en.json @@ -768,7 +768,7 @@ "no_command_in_channel": "You cannot use this command in channel right now", "no_such_role": "No such role: {0}", "available_modes": "Available game modes: \u0002", - "process_exited": "Process %s exited with %s %d", + "process_exited": "Process {0} exited with {1} {2}", "admin_fleave_deadchat": "You have forced {0} to leave the deadchat.", "available_mode_setters_help": "Votes to make a specific game mode more likely. Available game mode setters: ", "fspectate_help": "Usage: fspectate [on|off]", diff --git a/src/wolfgame.py b/src/wolfgame.py index e525549..d47a2f3 100644 --- a/src/wolfgame.py +++ b/src/wolfgame.py @@ -465,12 +465,14 @@ def restart_program(cli, nick, chan, rest): """Restarts the bot.""" args = rest.split() + force = False - if botconfig.DEBUG_MODE or (args and args[0] == "-force"): + if botconfig.DEBUG_MODE: + force = True + + if args and args[0] == "-force": force = True rest = " ".join(args[1:]) - else: - force = False if var.PHASE in var.GAME_PHASES: if var.PHASE == "join" or force: @@ -509,7 +511,7 @@ def restart_program(cli, nick, chan, rest): rest = " ".join(args[1:]) if rest: - msg += " ({0})".format(rest) + msg += " ({0})".format(rest.strip()) cli.quit(msg.format(nick, rest.strip())) @@ -7280,10 +7282,7 @@ def fpull(cli, nick, chan, rest): ret = child.returncode for line in (out + err).splitlines(): - if chan == nick: - cli.msg(nick, line.decode("utf-8")) - else: - pm(cli, nick, line.decode("utf-8")) + reply(cli, nick, chan, line.decode("utf-8"), private=True) if ret != 0: if ret < 0: @@ -7292,10 +7291,7 @@ def fpull(cli, nick, chan, rest): else: cause = "status" - if chan == nick: - cli.msg(nick, messages["process_exited"] % (command, cause, ret)) - else: - pm(cli, nick, messages["process_exited"] % (command, cause, ret)) + reply(cli, nick, chan, messages["process_exited"].format(command, cause, ret), private=True) @cmd("fsend", flag="F", pm=True) def fsend(cli, nick, chan, rest):