assembly_bot.py 文件源码

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

项目:AssemblyBot 作者: mbikovitsky 项目源码 文件源码
def on_chat_message(self, message):
        try:
            content_type, chat_type, chat_id = telepot.glance(message)

            if content_type in self.UNRECOGNIZED_CONTENT_TYPES:
                raise BotException("Message content not understood.")

            message_text = message["text"]

            if self._is_command(message_text):
                result = self._process_command_text(message["text"])
            else:
                result = self._process_query_text(message["text"])
            await self._send_reply(message, result)
        except Exception as e:
            try:
                exception_string = str(e)
            except:
                exception_string = "Unprintable exception."
            finally:
                error_message = "ERROR: " + exception_string
                await self._send_reply(message,
                                       self._format_as_html(error_message))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号