Small tweaks
This commit is contained in:
parent
b1dece0edd
commit
a1eb155b14
2 changed files with 7 additions and 6 deletions
|
@ -9,7 +9,8 @@ from util import hook
|
||||||
|
|
||||||
|
|
||||||
whitespace_re = re.compile(r'\s+')
|
whitespace_re = re.compile(r'\s+')
|
||||||
valid_diceroll = r'^([+-]?(?:\d+|\d*d(?:\d+|F))(?:[+-](?:\d+|\d*d(?:\d+|F)))*)( .+)?$'
|
valid_diceroll = r'^([+-]?(?:\d+|\d*d(?:\d+|F))(?:[+-](?:\d+|\d*d(?:\d+|' \
|
||||||
|
'F)))*)( .+)?$'
|
||||||
valid_diceroll_re = re.compile(valid_diceroll, re.I)
|
valid_diceroll_re = re.compile(valid_diceroll, re.I)
|
||||||
sign_re = re.compile(r'[+-]?(?:\d*d)?(?:\d+|F)', re.I)
|
sign_re = re.compile(r'[+-]?(?:\d*d)?(?:\d+|F)', re.I)
|
||||||
split_re = re.compile(r'([\d+-]*)d?(F|\d*)', re.I)
|
split_re = re.compile(r'([\d+-]*)d?(F|\d*)', re.I)
|
||||||
|
@ -36,8 +37,8 @@ def nrolls(count, n):
|
||||||
#@hook.regex(valid_diceroll, re.I)
|
#@hook.regex(valid_diceroll, re.I)
|
||||||
@hook.command
|
@hook.command
|
||||||
def dice(inp):
|
def dice(inp):
|
||||||
".dice <diceroll> -- Simulates dicerolls. Example of <diceroll>: '.dice 2d20-d5+4 roll 2'." \
|
".dice <diceroll> -- Simulates dicerolls. Example of <diceroll>:" \
|
||||||
"D20s, subtract 1D5, add 4"
|
" '.dice 2d20-d5+4 roll 2'. D20s, subtract 1D5, add 4"
|
||||||
|
|
||||||
try: # if inp is a re.match object...
|
try: # if inp is a re.match object...
|
||||||
(inp, desc) = inp.groups()
|
(inp, desc) = inp.groups()
|
||||||
|
|
Reference in a new issue