Fixed parsing of Telegram entities

This commit is contained in:
Dean 2024-07-06 01:44:51 +08:00
parent ffc72ba6fe
commit 3ffcea70a7

View File

@ -206,6 +206,7 @@ class Telegram:
image_file = Path(settings.TEMP_PATH) / Path(image).name image_file = Path(settings.TEMP_PATH) / Path(image).name
image_file.write_bytes(req.content) image_file.write_bytes(req.content)
photo = InputFile(image_file) photo = InputFile(image_file)
caption = re.sub(r'([_`])', r'\\\1', caption)
ret = self._bot.send_photo(chat_id=userid or self._telegram_chat_id, ret = self._bot.send_photo(chat_id=userid or self._telegram_chat_id,
photo=photo, photo=photo,
caption=caption, caption=caption,