forked from rDrama/rDrama
fix #roll comand (JC broke it 2 weeks ago)
parent
5cbe4749f1
commit
8cf4e49a5b
|
@ -177,18 +177,13 @@ commands = {
|
||||||
"fortune": FORTUNE_REPLIES,
|
"fortune": FORTUNE_REPLIES,
|
||||||
"factcheck": FACTCHECK_REPLIES,
|
"factcheck": FACTCHECK_REPLIES,
|
||||||
"8ball": EIGHTBALL_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):
|
def command_regex_matcher(match, upper=False):
|
||||||
choices = commands[match.group(2).lower()]
|
result = str(choice(commands[match.group(2).lower()]))
|
||||||
if not choices:
|
|
||||||
return ''
|
|
||||||
elif isinstance(choices, str):
|
|
||||||
return choices
|
|
||||||
result = str(choice(choices))
|
|
||||||
if match.group(2) == 'roll':
|
if match.group(2) == 'roll':
|
||||||
color = tuple(choices(range(256), k=3))
|
color = tuple(choices(range(256), k=3))
|
||||||
result = f'<b style="color:rgb{color}">Your roll: {result}</b>'
|
result = f'<b style="color:rgb{color}">Your roll: {result}</b>'
|
||||||
|
|
Loading…
Reference in New Issue