Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class StartStandupCommand(Command):
- validator = '^Standup for:'
- def do(self):
- groups = re.findall(re.compile('(?P<names>[a-z0-9\.]*@[a-z\.]*)'), self.input)
- members = slack_client.api_call("users.list")['members']
- members = [(m['id'], m['profile'].get('email')) for m in members if m['profile'].get('email') in groups]
- for id, email in members:
- channel_id = slack_client.api_call(
- "conversations.open",
- users=[id]
- )['channel']['id']
- slack_client.api_call(
- "chat.postMessage",
- channel=channel_id,
- text="""
- Hey! It's standup time! Please answer:
- 1. What are you workinng on?
- 2. Do you encounter any problems?
- 3. What are your plans for later?
- """
- )
- STANDUP_CHANNELS[channel_id] = {'origin': self.channel, 'author': email, 'response': []}
- slack_client.api_call(
- "chat.postMessage",
- channel=self.channel,
- text=f"Be right back! Gathering feedback from {', '.join([m[1] for m in members])}"
- )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement