Skip to content
This repository has been archived by the owner on Sep 13, 2023. It is now read-only.

Commit

Permalink
Fixed error when images are empty
Browse files Browse the repository at this point in the history
  • Loading branch information
scmanjarrez committed Jul 26, 2023
1 parent 14fba6e commit 97f4d5b
Showing 1 changed file with 17 additions and 16 deletions.
33 changes: 17 additions & 16 deletions src/backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -449,19 +449,20 @@ async def parse_message(self, message: Dict[str, Any]) -> None:
):
raw = message["adaptiveCards"][0]["body"][0]["text"]
images = IMG_RESP.findall(raw)
if not self.inline:
media = [InputMediaPhoto(img) for img in images]
await self.update.effective_message.reply_media_group(
media,
caption=f"<b>You</b>: {self.text}",
parse_mode=ParseMode.HTML,
)
else:
await asyncio.sleep(2)
await ut.edit_inline(
self.update,
self.context,
f"{msg}\n"
f"<code>Images can't be sent in addition to "
f"messages. Use 'image' inline query instead</code>",
)
if images:
if not self.inline:
media = [InputMediaPhoto(img) for img in images]
await self.update.effective_message.reply_media_group(
media,
caption=f"<b>You</b>: {self.text}",
parse_mode=ParseMode.HTML,
)
else:
await asyncio.sleep(2)
await ut.edit_inline(
self.update,
self.context,
f"{msg}\n"
f"<code>Images can't be sent in addition to "
f"messages. Use 'image' inline query instead</code>",
)

0 comments on commit 97f4d5b

Please sign in to comment.