slack_helper.py 文件源码

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

项目:open-source-feeds 作者: mhfowler 项目源码 文件源码
def list_channels():
    """
    helper method for listing all slack channels
    :return: None
    """
    bot_token = ENV_DICT.get('SLACKBOT_TOKEN')
    if not bot_token:
        return []
    sc = SlackClient(bot_token)
    channels = sc.api_call('channels.list')
    # this is to make this function backwards-compatible with older version of SlackClient which returns a string
    if isinstance(channels, basestring):
        channels = json.loads(channels)
    return channels

# construct a map from slack channel name to slack channel id (the format that the API expects)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号