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))
评论列表
文章目录