make roll command neater

remotes/1693045480750635534/spooky-22
Aevann1 2022-07-14 16:43:05 +02:00
parent abb54747c2
commit c56f3951e1
1 changed files with 6 additions and 2 deletions

View File

@ -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