diff --git a/src/cogs/election.py b/src/cogs/election.py index db32c2b..2a9667f 100644 --- a/src/cogs/election.py +++ b/src/cogs/election.py @@ -13,7 +13,7 @@ from discord.ext import commands SPAN_REGEX = re.compile( - r"^(?P[a-zA-Z]+)\s(?P\d+)\scouncillors\s(?P\d+)\scouncillors\s(?P(gained|lost))$" + r"^(?P(\D+)(?P[0-9,]+)\scouncillors\s(?P[0-9,]+)\scouncillors\s(?P(gained|lost))$" ) MULTI: dict[str, int] = { "gained": 1, @@ -89,9 +89,9 @@ class ElectionCog(commands.Cog): ) continue - results[str(groups["party"])] = [ - int(groups["councillors"]), - int(groups["net"]) * MULTI[groups["net_change"]], + results[str(groups["party"]).strip()] = [ + int(groups["councillors"].strip().strip(",")), + int(groups["net"].strip().strip(",")) * MULTI[groups["net_change"]], int(find_colour(child_ul.next["class"][0])[1:], base=16) ] return results