semicolon support. multiple rolls on one line, separated by ;

This commit is contained in:
Brian S. Stephan 2010-07-25 19:21:20 -05:00
parent ec2be10aca
commit 9f6ae529fe
1 changed files with 55 additions and 52 deletions

View File

@ -189,9 +189,12 @@ def sub_countdown(connection, event, nick, userhost, replypath, what, admin_unlo
#####
def sub_dice(connection, event, nick, userhost, replypath, what, admin_unlocked):
overallroll = what
rolls = re.split(';\s*', overallroll)
for roll in rolls:
pattern = '^(?:(\d+)#)?(?:(\d+)/)?(\d+)?d(\d+)(?:(\+|\-)(\d+))?(?:\s+(.*))?'
regex = re.compile(pattern)
roll = what
matches = regex.search(roll)
if matches is not None: