X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;f=turbot%2Fhunt.py;h=3063d879cb1069745a5405683b87f733dea58c1f;hb=e976e25976e54226a6b735a835c0897e856e3df4;hp=5edd443e59cc00da59aa14308a6b3fd133246a0a;hpb=c1f3d14cd6f589030c95dabd9a0d4b3c7582b489;p=turbot diff --git a/turbot/hunt.py b/turbot/hunt.py index 5edd443..3063d87 100644 --- a/turbot/hunt.py +++ b/turbot/hunt.py @@ -163,3 +163,26 @@ 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) + + topic += " ".format( + hunt['channel_id']) + + 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)