Limit number of bombs (EMILY)
This commit is contained in:
parent
9540ff4dd9
commit
966e0fba61
1 changed files with 5 additions and 0 deletions
|
@ -13,6 +13,8 @@ LOGGER = logging.getLogger(__name__)
|
|||
CMD_RE = None
|
||||
ADD_RE = None
|
||||
|
||||
MAX_BOMBS = 10
|
||||
|
||||
COLLECTIONS = {}
|
||||
|
||||
#
|
||||
|
@ -80,6 +82,9 @@ def _handle_bomb(match, channel):
|
|||
except TypeError: # count is None
|
||||
count = 1
|
||||
|
||||
bombs = COLLECTIONS[collection]
|
||||
count = min(MAX_BOMBS, len(bombs), count)
|
||||
|
||||
LOGGER.info('Getting %d item%s from %s', count, '' if count == 1 else 's', collection)
|
||||
items = random.sample(COLLECTIONS[collection], count)
|
||||
LOGGER.debug('I HAVE BOMB FOOD: %s', items)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue