From fe451962cd36537db28f81da64c64390b5398c26 Mon Sep 17 00:00:00 2001 From: Ryan Schmidt Date: Tue, 10 May 2016 15:37:57 -0700 Subject: [PATCH] Fix spurious error when ending night as shaman and dying. An artifact of how we run commands means that we try to run the rest of the "give" command handlers even after the first (shaman) one ended night. As such, check the phase and if it's different, stop trying to execute command handlers. This has a small race condition where the error this fixes can happen anyway, but since it's purely a visual error I think that's fine. Better than happening all of the time, at least. --- src/handler.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/handler.py b/src/handler.py index dcaa561..31d4515 100644 --- a/src/handler.py +++ b/src/handler.py @@ -48,7 +48,7 @@ def on_privmsg(cli, rawnick, chan, msg, notice = False): for fn in decorators.COMMANDS[""]: fn.caller(cli, rawnick, chan, msg) - + phase = var.PHASE for x in list(decorators.COMMANDS.keys()): if chan != parse_nick(rawnick)[0] and not msg.lower().startswith(botconfig.CMD_CHAR): break # channel message but no prefix; ignore @@ -60,7 +60,8 @@ def on_privmsg(cli, rawnick, chan, msg, notice = False): continue if not h or h[0] == " ": for fn in decorators.COMMANDS.get(x, []): - fn.caller(cli, rawnick, chan, h.lstrip()) + if phase == var.PHASE: + fn.caller(cli, rawnick, chan, h.lstrip()) def unhandled(cli, prefix, cmd, *args):