Membership is determined by membership in a hunt's primary slack channel.
)
import turbot.sheets
import turbot.slack
)
import turbot.sheets
import turbot.slack
-from turbot.slack import slack_send_message
+from turbot.slack import slack_send_message, slack_channel_members
TURBOT_USER_ID = 'U01B9QM4P9R'
TURBOT_USER_ID = 'U01B9QM4P9R'
hunt_blocks = []
for hunt in hunts:
hunt_blocks = []
for hunt in hunts:
- if hunt['active']:
- hunt_blocks += hunt_block(turb, hunt)
+ if not hunt['active']:
+ continue
+ if user_id not in slack_channel_members(turb.slack_client,
+ hunt['channel_id']):
+ continue
+ hunt_blocks += hunt_block(turb, hunt)
return {
"type": "home",
"blocks": [
return {
"type": "home",
"blocks": [
- section_block(text_block("*Active hunts*")),
+ section_block(text_block("*Hunts you belong to*")),
divider_block(),
* hunt_blocks,
actions_block(button_block("New hunt", "new_hunt"))
divider_block(),
* hunt_blocks,
actions_block(button_block("New hunt", "new_hunt"))