models.py 文件源码

python
阅读 21 收藏 0 点赞 0 评论 0

项目:serverless-slack-bot 作者: subodh-malgonde 项目源码 文件源码
def edubot_channel_post(sc, team_bot, message, employee):
    from slackclient import SlackClient
    channels_list = sc.api_call('channels.list', exclude_archived=1)
    channel_names = [channel['name'] for channel in channels_list['channels']]
    if 'question' in channel_names:
        channel_id = '#question'
        post_on_question_channel(sc, channel_id, message)
    else:
        owner_sc = SlackClient(team_bot.owner.slack_access_token)
        msg_res = owner_sc.api_call('channels.create', name='question')
        channel_id = msg_res['channel']['id']
        mentioned_employees = extract_mentions("<!everyone>", team_bot.slack_team_id, team_bot.owner)
        if mentioned_employees:
            for employee in mentioned_employees:
                owner_sc.api_call('channels.invite', channel=channel_id, user=employee.user.username)
        post_on_question_channel(sc, channel_id, message)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号