Also, put both the hunt url and the hunt state into the hunt channel's topic.
block.append(divider_block())
return blocks
block.append(divider_block())
return blocks
+
+def hunt_update_topic(turb, hunt):
+
+ channel_id = hunt['channel_id']
+
+ topic = ''
+
+ url = hunt.get('url', None)
+ if url:
+ topic += "<{}|Hunt website> ".format(url)
+
+ state = hunt.get('state', None)
+ if state:
+ topic += state
+
+ # Slack only allows 250 characters for a topic
+ if len(topic) > 250:
+ topic = topic[:247] + "..."
+ turb.slack_client.conversations_setTopic(channel=channel_id,
+ topic=topic)
from turbot.hunt import (
find_hunt_for_hunt_id,
hunt_blocks,
from turbot.hunt import (
find_hunt_for_hunt_id,
hunt_blocks,
- hunt_puzzles_for_hunt_id
+ hunt_puzzles_for_hunt_id,
+ hunt_update_topic
)
from turbot.puzzle import (
find_puzzle_for_url,
)
from turbot.puzzle import (
find_puzzle_for_url,
input_block("Hunt URL", "url", "External URL of hunt",
initial_value=hunt.get("url", None),
optional=True),
input_block("Hunt URL", "url", "External URL of hunt",
initial_value=hunt.get("url", None),
optional=True),
+ input_block("State", "state",
+ "State of the hunt (goals, upcoming meetings, etc.)",
+ initial_value=hunt.get("state", None),
+ optional=True),
checkbox_block("Is this hunt active?", "Active", "active",
checked=(hunt.get('active', False)))
]
checkbox_block("Is this hunt active?", "Active", "active",
checked=(hunt.get('active', False)))
]
if url:
hunt['url'] = url
if url:
hunt['url'] = url
+ hunt_state = state['state']['state']['value']
+ if hunt_state:
+ hunt['state'] = hunt_state
if state['active']['active']['selected_options']:
hunt['active'] = True
else:
if state['active']['active']['selected_options']:
hunt['active'] = True
else:
turb.slack_client, hunt['channel_id'],
edit_message, blocks=blocks)
turb.slack_client, hunt['channel_id'],
edit_message, blocks=blocks)
+ # Update channel topic and description
+ hunt_update_topic(turb, hunt)
+
return lambda_ok
def new_hunt_command(turb, body):
return lambda_ok
def new_hunt_command(turb, body):