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}'