fix #roll comand (JC broke it 2 weeks ago)

pull/80/head
Aevann1 2022-12-17 17:33:29 +02:00
parent 5cbe4749f1
commit 8cf4e49a5b
1 changed files with 3 additions and 8 deletions

View File

@ -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'<b style="color:rgb{color}">Your roll: {result}</b>'