This commit is contained in:
Jacob Henry 2019-03-02 23:45:56 -05:00
parent 63f03ad158
commit 6a9dbe9d86
2 changed files with 20 additions and 22 deletions

36
main.py
View File

@ -56,24 +56,24 @@ def main() -> None:
event_handling = wrap.handle_events()
passive_handling = wrap.run_passives()
both = asyncio.gather(event_handling, passive_handling)
wrap.send_message("test", "#botzone", blocks=[
{
"type": "actions",
"block_id": "test_block_id",
"elements": [
{
"type": "button",
"action_id": "test_action_id",
"text": {
"type": "plain_text",
"text": "Send payload",
"emoji": False
}
}
]
}
])
#
# wrap.send_message("test", "#botzone", blocks=[
# {
# "type": "actions",
# "block_id": "test_block_id",
# "elements": [
# {
# "type": "button",
# "action_id": "test_action_id",
# "text": {
# "type": "plain_text",
# "text": "Send payload",
# "emoji": False
# }
# }
# ]
# }
# ])
event_loop.run_until_complete(both)

View File

@ -275,11 +275,11 @@ class ClientWrapper(object):
async def interr(request: web.Request):
if request.can_read_body:
# Get the payload
body_dict = await request.json()
payload = body_dict["payload"]
print("Got a normal request: {}".format(request))
print(await request.read())
print("Interaction received: {}".format(payload))
body_dict = await request.json()
payload = body_dict["payload"]
# Handle each action separately
if "actions" in payload:
@ -306,8 +306,6 @@ class ClientWrapper(object):
# Respond that everything is fine
return web.Response(status=200)
else:
print("Got a weird request: {}".format(request))
print(await request.read())
# If we can't read it, get mad
return web.Response(status=400)