Esempio n. 1
0
def open_next_pack(draft_id, player):
    pack = DRAFTS[draft_id]['players'][player]['inbox'][0]
    card_blocks = [blocks.divider()]
    for card in pack:
        card_text = templates.format(card)
        button_value = '--'.join([draft_id, player, card['code']])
        pick_block = blocks.text_with_button(card_text, card['title'],
                                             button_value)
        card_blocks.append(pick_block)
        card_blocks.append(blocks.divider())
    client.chat_postMessage(channel=get_player_dm_id(player),
                            text='Here is your next pack.')
    client.chat_postMessage(channel=get_player_dm_id(player),
                            blocks=card_blocks)
    DRAFTS[draft_id]['players'][player]['has_open_pack'] = True
Esempio n. 2
0
def open_new_pack(draft_id):
    """
    Sends first set of picks to players.
    After this the pack-sending logic is entirely event-driven.
    """
    for player in get_players(draft_id):
        pack = DRAFTS[draft_id]['players'][player]['packs'].pop(0)
        DRAFTS[draft_id]['players'][player]['inbox'].append(pack)
        card_blocks = [blocks.divider()]
        for card in pack:
            card_text = templates.format(card)
            button_value = '--'.join([draft_id, player, card['code']])
            pick_block = blocks.text_with_button(card_text, card['title'],
                                                 button_value)
            card_blocks.append(pick_block)
            card_blocks.append(blocks.divider())
        client.chat_postMessage(channel=get_player_dm_id(player),
                                blocks=card_blocks)
        DRAFTS[draft_id]['players'][player]['has_open_pack'] = True