dice: properly handle multiple-roll strings (d20; d20) in this post-
recursion world where we're supposed to return a string
This commit is contained in:
parent
713b1e560b
commit
88c83c1e45
@ -29,6 +29,7 @@ class Dice(Module):
|
||||
overallroll = what
|
||||
|
||||
rolls = re.split(';\s*', overallroll)
|
||||
reply = ""
|
||||
for roll in rolls:
|
||||
pattern = '^(?:(\d+)#)?(?:(\d+)/)?(\d+)?d(\d+)(?:(\+|\-)(\d+))?(?:\s+(.*))?'
|
||||
regex = re.compile(pattern)
|
||||
@ -89,7 +90,11 @@ class Dice(Module):
|
||||
if t != times-1:
|
||||
result += ', '
|
||||
|
||||
return self.reply(connection, replypath, result)
|
||||
reply += result
|
||||
if roll is not rolls[-1]:
|
||||
reply += "; "
|
||||
|
||||
return self.reply(connection, replypath, reply)
|
||||
|
||||
# vi:tabstop=4:expandtab:autoindent
|
||||
# kate: indent-mode python;indent-width 4;replace-tabs on;
|
||||
|
Loading…
Reference in New Issue
Block a user