forked from MarseyWorld/MarseyWorld
make roll command neater
parent
abb54747c2
commit
c56f3951e1
|
@ -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()]))
|
||||
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>'
|
||||
return match.group(1) + result
|
Loading…
Reference in New Issue