Only append to bomb collections if the thing does not exist yet
This commit is contained in:
		
							parent
							
								
									d08630da75
								
							
						
					
					
						commit
						a2e4f99eec
					
				
					 1 changed files with 6 additions and 3 deletions
				
			
		| 
						 | 
				
			
			@ -91,9 +91,12 @@ def _handle_add(match, channel):
 | 
			
		|||
    collection = match.group('collection')
 | 
			
		||||
    item = match.group('item')
 | 
			
		||||
    LOGGER.debug('Adding item to %s: %s', collection, item)
 | 
			
		||||
    if item not in COLLECTIONS[collection]:
 | 
			
		||||
        COLLECTIONS[collection].append(item)
 | 
			
		||||
        _dump_collection(collection, COLLECTIONS[collection])
 | 
			
		||||
    outputs.append([channel, '_Saved {} to {} collection_'.format(item, collection)])
 | 
			
		||||
        outputs.append([channel, 'Saved _{}_ to _{}_ collection'.format(item, collection)])
 | 
			
		||||
    else:
 | 
			
		||||
        outputs.append([channel, '_{}_ collection already contains _{}_'.format(collection, item)])
 | 
			
		||||
 | 
			
		||||
def _dump_collection(collection, items):
 | 
			
		||||
    LOGGER.info('Saving collection %s: %d item%s', collection, 's' if len(items) != 1 else '')
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue