bot.py 文件源码

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

项目:devolio-slackbot 作者: devolio 项目源码 文件源码
def is_user_in_group(user_id, group_name):
    try:
        # Get list of channels
        user_groups = slack.channels.list().body.get('channels', [])
    except slacker.Error as e:
        print(e)
        return True

    user_list = []
    for group in user_groups:
        if group['name'] == group_name:
            user_list = group['members']
    # This returns true if the user_id is in user_list, otherwise false
    return user_id in user_list

# Get all the channel names from Slack
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号