Fix sending msg: fallback to simple text when failed to parse entities (#147)

* Fix sending msg: fallback to simple text when failed to parse entities

* Fix black formatting
This commit is contained in:
Nameless 2020-07-16 14:37:35 +08:00 committed by GitHub
parent 16b6a5a4d9
commit 3d682441f2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -59,12 +59,12 @@ class Tdlib(Telegram):
return self._send_data(data)
def send_message(self, chat_id: int, msg: str) -> AsyncResult:
text = {"@type": "formattedText", "text": msg}
result = self.parse_text_entities(msg)
result.wait()
if result.error:
return result
text = result.update
if not result.error:
text = result.update
data = {
"@type": "sendMessage",