diff --git a/var.py b/var.py index e84c6b0..c04ea33 100644 --- a/var.py +++ b/var.py @@ -6,7 +6,7 @@ MAX_SHOTS = 2 DRUNK_SHOTS_MULTIPLIER = 3 NIGHT_TIME_LIMIT = 0 DAY_TIME_LIMIT = 0 -START_WITH_DAY = True +START_WITH_DAY = False # HIT MISS SUICIDE GUN_CHANCES = ( 5/7 , 1/7 , 1/7 ) @@ -112,7 +112,8 @@ class ChangedRolesMode(object): try: lx[CHANGEABLE_ROLES[role.lower()]] = num except KeyError: - raise InvalidModeException("The role \u0002{0}\u0002 is not valid.") + raise InvalidModeException(("The role \u0002{0}\u0002 "+ + "is not valid.").format(role)) except ValueError: raise InvalidModeException("A bad value was used in mode roles.") for k in ROLES_GUIDE.keys(): diff --git a/wolfgame.py b/wolfgame.py index c543e01..64b85eb 100644 --- a/wolfgame.py +++ b/wolfgame.py @@ -116,7 +116,10 @@ def forced_exit(cli, nick, *rest): # Admin Only @cmd("!exec", admin_only=True) def py(cli, nick, chan, rest): - exec(rest) + try: + exec(rest) + except Exception as e: + cli.msg(chan, str(type(e))+":"+str(e)) @@ -261,7 +264,7 @@ def hurry_up(cli): found_dup = False elif len(voters) == maxfound[0]: found_dup = True - if max[0] > 0 and not found_dup: + if maxfound[0] > 0 and not found_dup: cli.msg(chan, "The sun sets.") var.VOTES[maxfound[1]] = [None] * votesneeded chk_decision(cli) # Induce a lynch @@ -966,6 +969,7 @@ def transition_night(cli): def cgamemode(cli, *args): + chan = botconfig.CHANNEL for arg in args: modeargs = arg.split("=", 1) modeargs[0] = modeargs[0].strip() @@ -985,7 +989,7 @@ def cgamemode(cli, *args): cli.msg(botconfig.CHANNEL, "Invalid mode: "+str(e)) return False else: - cli.msg(chan, "Mode \u0002{0}\u0002not found.".format(mode)) + cli.msg(chan, "Mode \u0002{0}\u0002not found.".format(modeargs[0])) @cmd("!start") @@ -1132,7 +1136,7 @@ def game(cli, nick, chan, rest): def nay(cli, nick, chan, rest): pl = var.list_players() if var.PHASE != "join" or not var.SETTINGS_CHANGE_REQUESTER: - cli.notice("This command is only allowed if there is "+ + cli.notice(nick, "This command is only allowed if there is "+ "a game settings change request in effect.") return if nick not in pl: @@ -1140,6 +1144,9 @@ def nay(cli, nick, chan, rest): return if var.SETTINGS_CHANGE_REQUESTER in pl: pl.remove(var.SETTINGS_CHANGE_REQUESTER) + if nick in var.SETTINGS_CHANGE_OPPOSITION: + cli.notice(nick, "You are already in the opposition.") + return var.SETTINGS_CHANGE_OPPOSITION.append(nick) needed = len(pl)//2 + 1 if len(var.SETTINGS_CHANGE_OPPOSITION) >= needed: