slack.py 文件源码

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

项目:huebot 作者: reb 项目源码 文件源码
def __init__(self, slack_token, reporting_channel, state):
        """Connect to Slack and setup the object."""
        self.channels = {}
        self.client = SlackClient(slack_token)
        if self.client.rtm_connect():
            print("HueBot connected to Slack!")
        else:
            print("HueBot did not connect to Slack")
            raise IOError
        self.reporting_channel = reporting_channel

        self.state = state
        self.state.on_new_failure = self.message_failure
        self.state.on_new_warning = self.message_warning

        # Retrieve parse functions
        self.parse_functions = []
        for attr_name in dir(self):
            attr = getattr(self, attr_name)
            try:
                if attr._parse_func:
                    self.parse_functions.append(attr)
            except AttributeError:
                pass
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号