]> git.cworth.org Git - turbot/blobdiff - turbot/events.py
Rename identifier from item to hunt
[turbot] / turbot / events.py
index b8fd429cbd6009e2aca5a605127b22c66486c863..cae4ccfbb86b98bc07a4264b209b2e62974c73c6 100644 (file)
@@ -103,40 +103,40 @@ def hunt_channel_created(turb, channel_name, channel_id):
               .format(channel_id) + "Letting Slack retry this event")
         return lambda_error
 
-    item = response['Items'][0]
+    hunt = response['Items'][0]
 
-    if 'sheet_url' in item:
+    if 'sheet_url' in hunt:
         print("Info: channel_id {} already has sheet_url {}. Exiting."
-              .format(channel_id, item['sheet_url']))
+              .format(channel_id, hunt['sheet_url']))
         return lambda_success
 
     # Before launching into sheet creation, indicate that we're doing this
     # in the database. This way, if we take too long to create the sheet
     # and Slack retries the event, that next event will see this 'pending'
     # string and cleanly return (eliminating all future retries).
-    item['sheet_url'] = 'pending'
-    turb.table.put_item(Item=item)
+    hunt['sheet_url'] = 'pending'
+    turb.table.put_item(Item=hunt)
 
     # Also, let the channel users know what we are up to
     slack_send_message(
         turb.slack_client, channel_id,
-        "Welcome to the channel for the {} hunt! ".format(item['name'])
+        "Welcome to the channel for the {} hunt! ".format(hunt['name'])
         + "Please wait a minute or two while I create some backend resources.")
 
     # Create a sheet for the hunt
-    sheet = sheets_create(turb, item['name'])
+    sheet = sheets_create(turb, hunt['name'])
 
     # Update the database with the URL of the sheet
-    item['sheet_url'] = sheet['url']
-    turb.table.put_item(Item=item)
+    hunt['sheet_url'] = sheet['url']
+    turb.table.put_item(Item=hunt)
 
     # Message the channel with the URL of the sheet
     slack_send_message(turb.slack_client, channel_id,
                        "Sheet created for this hunt: {}".format(sheet['url']))
 
     # Mark the hunt as active in the database
-    item['active'] = True
-    turb.table.put_item(Item=item)
+    hunt['active'] = True
+    turb.table.put_item(Item=hunt)
 
     # Message the hunt channel that the database is ready
     slack_send_message(