From 8cf4e49a5b2f4c548b5ae5795a09681ce1cfb1dc Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Sat, 17 Dec 2022 17:33:29 +0200 Subject: [PATCH] fix #roll comand (JC broke it 2 weeks ago) --- files/helpers/regex.py | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/files/helpers/regex.py b/files/helpers/regex.py index c13bfbf14..6bdb87741 100644 --- a/files/helpers/regex.py +++ b/files/helpers/regex.py @@ -177,18 +177,13 @@ commands = { "fortune": FORTUNE_REPLIES, "factcheck": FACTCHECK_REPLIES, "8ball": EIGHTBALL_REPLIES, - "roll": range(1, 9999), + "roll": range(1, 9999) } -command_regex = re.compile(f"(\s|\n|^)#({'|'.join(commands.keys())})", flags=re.A|re.I) +command_regex = re.compile("(\s|\n|^)#(fortune|factcheck|8ball|roll)", flags=re.A|re.I) def command_regex_matcher(match, upper=False): - choices = commands[match.group(2).lower()] - if not choices: - return '' - elif isinstance(choices, str): - return choices - result = str(choice(choices)) + result = str(choice(commands[match.group(2).lower()])) if match.group(2) == 'roll': color = tuple(choices(range(256), k=3)) result = f'Your roll: {result}'