1
Fork 0
mirror of https://github.com/RYGhub/royalnet.git synced 2024-11-23 19:44:20 +00:00

🐛 Fix crash when sending empty messages

This commit is contained in:
Steffo 2021-04-26 00:51:16 +02:00
parent 2d97b66e99
commit 39f209783a
Signed by: steffo
GPG key ID: 6965406171929D01

View file

@ -40,7 +40,7 @@ class TelegramMessage(co.Message):
async def reply(self, *, async def reply(self, *,
text: str = None, text: str = None,
files: t.List[t.BinaryIO] = None) -> t.Optional[TelegramMessage]: 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) return TelegramMessage(msg=sent)
@ -62,7 +62,7 @@ class TelegramChannel(co.Channel):
files: t.List[t.BinaryIO] = None) -> t.Optional[TelegramMessage]: files: t.List[t.BinaryIO] = None) -> t.Optional[TelegramMessage]:
sent = await self._client.send_message( sent = await self._client.send_message(
self._channel, self._channel,
message=tg_html_format(text), message=tg_html_format(text) if text else None,
file=files, file=files,
parse_mode="HTML" parse_mode="HTML"
) )