X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;f=turbot%2Fhunt.py;h=2d4de5108b4e75f5694b817941d3e24a1a8cec10;hb=1af32409a8d60e9580a0873bd8b2fa3c676c37ee;hp=7b515d21c0012ccf5b8f74f9f7962f0ef00349cf;hpb=c6ad0733c2613b899a30291b14222ef6c322c6cb;p=turbot diff --git a/turbot/hunt.py b/turbot/hunt.py index 7b515d2..2d4de51 100644 --- a/turbot/hunt.py +++ b/turbot/hunt.py @@ -116,10 +116,12 @@ def hunt_blocks(turb, hunt, puzzle_status='unsolved', search_terms=[], hunt_text += " matching {}".format(" AND ".join(quoted_terms)) blocks = [ - accessory_block( - section_block(text_block(hunt_text)), - button_block("✏", "edit_hunt", hunt_id) - ) + [ + accessory_block( + section_block(text_block(hunt_text)), + button_block("✏", "edit_hunt", hunt_id) + ) + ] ] block = blocks[0] @@ -161,3 +163,23 @@ def hunt_blocks(turb, hunt, puzzle_status='unsolved', search_terms=[], 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)