diff --git a/files/helpers/regex.py b/files/helpers/regex.py index 6eeb33f87..90f38551c 100644 --- a/files/helpers/regex.py +++ b/files/helpers/regex.py @@ -1,6 +1,6 @@ import re from .const import * -from random import choice +from random import choice, choices if SITE_NAME == 'PCM': valid_username_chars = 'a-zA-Z0-9_\-А-я' @@ -144,4 +144,8 @@ commands = { command_regex = re.compile("(\s|\n|^)#(fortune|factcheck|8ball|roll)", flags=re.A|re.I) def command_regex_matcher(match, upper=False): - return match.group(1) + str(choice(commands[match.group(2).lower()])) \ No newline at end of file + 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}' + return match.group(1) + result \ No newline at end of file