bot.py 文件源码

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

项目:foodAId 作者: Pregnor 项目源码 文件源码
def _process_event(self, event):
        'Processes an event sent to the bot.'

        unknown_reactions = [
            'I don\'t think I understand you correctly.\nCould you rephrase what you meant?',
            'I\'m not sure I know what you mean by that.',
            'Could you elaborate on this?',
            'I couldn\'t catch what you meant.\nCould you say it differently?',
        ]

        is_understandable = False

        self._send_typing(event['channel'])
        for keyword in self._keywords:
            if keyword in event['text']:
                is_understandable = True

        if is_understandable:
            self._send_typing(event['channel'])
            self._send_menus(event)
        elif not is_understandable:
            self._send_message(
                event['channel'],
                unknown_reactions[random.randint(0, len(unknown_reactions) - 1)])
            return
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号