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.
This commit is contained in:
Ryan Schmidt 2016-05-10 15:37:57 -07:00
parent accd75cfaf
commit fe451962cd

View File

@ -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):