bot.py 文件源码

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

项目:alphabot 作者: Nextdoor 项目源码 文件源码
def _get_next_event(self):
        """Slack-specific message reader.

        Returns a web event from the API listener if available, otherwise
        waits for the slack streaming event.
        """

        if len(self._web_events):
            event = self._web_events.pop()
            raise gen.Return(event)

        # TODO: rewrite this logic to use `on_message` feature of the socket
        # FIXME: At the moment if there are 0 socket messages then web_events
        #        will never be handled.
        message = yield self.connection.read_message()
        log.debug('Slack message: "%s"' % message)
        message = json.loads(message)

        raise gen.Return(message)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号