from turbot.blocks import input_block
import uuid
+import turbot.sheets
def new_hunt(turb, payload):
"""Handler for the action of user pressing the new_hunt button"""
slug = state['slug']['slug']['value']
url = state['url']['url']['value']
+ # Create a channel for the hunt
response = turb.slack_client.conversations_create(name=slug)
if not response['ok']:
user_id = payload['user']['id']
channel_id = response['channel']['id']
+ # Create a sheet for the channel
+ sheet = turbot.sheets.sheets_create(turb, slug)
+
+ # Insert the newly-created hunt into the database
turb.hunts_table = turb.db.Table("hunts")
turb.hunts_table.put_item(
Item={
}
)
+ # Invite the initiating user to the channel
turb.slack_client.conversations_invite(channel=channel_id, users=user_id)
return {