From 52154b9413f3dac876977baa81d6c14a63d9e4be Mon Sep 17 00:00:00 2001 From: Jimmy Cao Date: Sun, 26 Feb 2012 18:18:11 -0600 Subject: [PATCH] prevent crashing if !fgame is given invalid arguments --- modules/wolfgame.py | 5 +++++ settings/wolfgame.py | 6 +----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/modules/wolfgame.py b/modules/wolfgame.py index 0dbc0c8..793cd13 100644 --- a/modules/wolfgame.py +++ b/modules/wolfgame.py @@ -2071,6 +2071,11 @@ def cgamemode(cli, *args): for arg in args: modeargs = arg.split("=", 1) + + if len(modeargs) < 2: # no equal sign in the middle of the arg + cli.msg(botconfig.CHANNEL, "Invalid syntax.") + return False + modeargs[0] = modeargs[0].strip() if modeargs[0] in var.GAME_MODES.keys(): md = modeargs.pop(0) diff --git a/settings/wolfgame.py b/settings/wolfgame.py index 9169192..688a1dc 100644 --- a/settings/wolfgame.py +++ b/settings/wolfgame.py @@ -125,11 +125,7 @@ CHANGEABLE_ROLES = { "seers" : INDEX_OF_ROLE["seer"], "angels" : INDEX_OF_ROLE["guardian angel"], "detectives" : INDEX_OF_ROLE["detective"]} - - -@game_mode("normal") -class Normal(object): - pass + # TODO: implement game modes