fix #2515
This commit is contained in:
parent
71260f04b5
commit
33525730b5
@ -88,6 +88,8 @@ class Telegram:
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
if text:
|
if text:
|
||||||
|
# 对text进行Markdown特殊字符转义
|
||||||
|
text = re.sub(r"([_`])", r"\\\1", text)
|
||||||
caption = f"*{title}*\n{text}"
|
caption = f"*{title}*\n{text}"
|
||||||
else:
|
else:
|
||||||
caption = f"*{title}*"
|
caption = f"*{title}*"
|
||||||
@ -208,8 +210,6 @@ class Telegram:
|
|||||||
image_file = Path(settings.TEMP_PATH) / str(uuid.uuid4())
|
image_file = Path(settings.TEMP_PATH) / str(uuid.uuid4())
|
||||||
image_file.write_bytes(res.content)
|
image_file.write_bytes(res.content)
|
||||||
photo = InputFile(image_file)
|
photo = InputFile(image_file)
|
||||||
# 对caption进行Markdown特殊字符转义
|
|
||||||
caption = re.sub(r"([_`])", r"\\\1", caption)
|
|
||||||
# 发送图片到Telegram
|
# 发送图片到Telegram
|
||||||
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,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user