Without this, the '/solved' command felt rather anti-climactic.
else:
return hunt_channel_created(turb, channel_name, channel_id)
else:
return hunt_channel_created(turb, channel_name, channel_id)
events['channel_created'] = channel_created
events['channel_created'] = channel_created
import re
import requests
from botocore.exceptions import ClientError
import re
import requests
from botocore.exceptions import ClientError
+from turbot.slack import slack_send_message
actions = {}
commands = {}
actions = {}
commands = {}
# XXX: This duplicates functionality eith events.py:set_channel_description
def set_channel_topic(turb, puzzle):
channel_id = puzzle['channel_id']
# XXX: This duplicates functionality eith events.py:set_channel_description
def set_channel_topic(turb, puzzle):
channel_id = puzzle['channel_id']
- description = puzzle['name']
url = puzzle.get('url', None)
sheet_url = puzzle.get('sheet_url', None)
state = puzzle.get('state', None)
url = puzzle.get('url', None)
sheet_url = puzzle.get('sheet_url', None)
state = puzzle.get('state', None)
+ status = puzzle['status']
+
+ description = ''
+
+ if status == 'solved':
+ description += "Solved: `{}` ".format('`, `'.join(puzzle['solution']))
+
+ description += name
channel_id = body['channel_id'][0]
channel_name = body['channel_name'][0]
channel_id = body['channel_id'][0]
channel_name = body['channel_name'][0]
+ user_name = body['user_name'][0]
(puzzle, table) = channel_is_puzzle(turb, channel_id, channel_name)
(puzzle, table) = channel_is_puzzle(turb, channel_id, channel_name)
puzzle['solution'].append(args)
table.put_item(Item=puzzle)
puzzle['solution'].append(args)
table.put_item(Item=puzzle)
+ # Report the solution to the puzzle's channel
+ slack_send_message(
+ turb.slack_client, channel_id,
+ "Puzzle mark solved by {}: `{}`".format(user_name, args))
+
+ # And update the puzzle's description
+ set_channel_topic(turb, puzzle)
+
return lambda_ok
commands["/solved"] = solved
return lambda_ok
commands["/solved"] = solved