示例#1
0
def hello():
    """Send hello message with question and yes no buttons"""
    YES = 'yes'
    NO = 'no'
    yes_no_buttons_block = {
        "type":
        "actions",
        "elements": [{
            "type": "button",
            "text": {
                "type": "plain_text",
                "emoji": True,
                "text": "Yes"
            },
            "style": "primary",
            "value": "i_like_bots",
            "action_id": YES
        }, {
            "type": "button",
            "text": {
                "type": "plain_text",
                "emoji": True,
                "text": "No"
            },
            "style": "danger",
            "value": "i_dont_like_bots",
            "action_id": NO
        }]
    }
    blocks = [text_block('Do you like Bots?'), yes_no_buttons_block]
    return block_reply(blocks)
示例#2
0
def test_block_reply():
    assert block_reply([1, 2, 3]) == ('{"blocks": [1, 2, 3]}', 200, {
        'Content-Type': 'application/json'
    })