fix a bug that was getting the trailing semicolon wrong, and do it better anyway.
This commit is contained in:
		
							parent
							
								
									053c3f0ae6
								
							
						
					
					
						commit
						27ff7e257d
					
				| @ -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) | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user