From 20b62a6caf7409671ce4c6c4feeceac7531e57bd Mon Sep 17 00:00:00 2001 From: Bobloy Date: Tue, 8 May 2018 16:01:42 -0400 Subject: [PATCH] Bugfix for parse_code --- werewolf/builder.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/werewolf/builder.py b/werewolf/builder.py index 4a9da6a..c673e3f 100644 --- a/werewolf/builder.py +++ b/werewolf/builder.py @@ -104,18 +104,22 @@ async def parse_code(code, game): built = "" category = "" for c in code: + if len(built) < digits: + built += c + if built == "T" or built == "W" or built == "N": # Random Towns category = built built = "" digits = 1 + continue elif built == "-": + built = "" digits += 1 - - if len(built) < digits: - built += c continue + + try: idx = int(built) except ValueError: @@ -138,6 +142,9 @@ async def parse_code(code, game): decode.append(choice(options)(game)) + built = "" + + return decode