From 39f209783adfb539d0a816e3045d62f8b7c760bc Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Mon, 26 Apr 2021 00:51:16 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Fix=20crash=20when=20sending=20e?= =?UTF-8?q?mpty=20messages?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- royalnet_telethon/bullet/contents/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/royalnet_telethon/bullet/contents/__init__.py b/royalnet_telethon/bullet/contents/__init__.py index c8b44ee1..79e629e4 100644 --- a/royalnet_telethon/bullet/contents/__init__.py +++ b/royalnet_telethon/bullet/contents/__init__.py @@ -40,7 +40,7 @@ class TelegramMessage(co.Message): async def reply(self, *, text: str = None, files: t.List[t.BinaryIO] = None) -> t.Optional[TelegramMessage]: - sent = await self._msg.reply(message=tg_html_format(text), file=files, parse_mode="HTML") + sent = await self._msg.reply(message=tg_html_format(text) if text else None, file=files, parse_mode="HTML") return TelegramMessage(msg=sent) @@ -62,7 +62,7 @@ class TelegramChannel(co.Channel): files: t.List[t.BinaryIO] = None) -> t.Optional[TelegramMessage]: sent = await self._client.send_message( self._channel, - message=tg_html_format(text), + message=tg_html_format(text) if text else None, file=files, parse_mode="HTML" )