fix a bug that was getting the trailing semicolon wrong, and do it better anyway.

This commit is contained in:
Brian S. Stephan 2010-09-05 10:44:59 -05:00
parent 053c3f0ae6
commit 27ff7e257d
1 changed files with 3 additions and 3 deletions

View File

@ -29,9 +29,9 @@ class Dice(Module):
whats = what.split(' ')
if whats[0] == 'roll':
rolls = re.split(';\s*', ' '.join(whats[1:]))
rollitrs = re.split(';\s*', ' '.join(whats[1:]))
reply = ""
for roll in rolls:
for count, roll in enumerate(rollitrs):
pattern = '^(?:(\d+)#)?(?:(\d+)/)?(\d+)?d(\d+)(?:(\+|\-)(\d+))?(?:\s+(.*))?'
regex = re.compile(pattern)
matches = regex.search(roll)
@ -90,7 +90,7 @@ class Dice(Module):
result += ', '
reply += result
if roll is not rolls[-1]:
if count is not len(rollitrs)-1:
reply += "; "
if reply is not "":
return self.reply(connection, replypath, nick + ': ' + reply)