🎨 Will not send the original text if the text exceeds the limit

This commit is contained in:
洛水居室 2022-12-07 11:26:18 +08:00
parent f2b89134cb
commit 7d1c6049fe
No known key found for this signature in database
GPG Key ID: C9DE87DA724B88FC

View File

@ -189,9 +189,8 @@ class Post(Plugin.Conversation, BasePlugin.Conversation):
post_text += f"{escape_markdown(p.get_text(), version=2)}\n" post_text += f"{escape_markdown(p.get_text(), version=2)}\n"
post_text += f"[source](https://www.miyoushe.com/ys/article/{post_id})" post_text += f"[source](https://www.miyoushe.com/ys/article/{post_id})"
if len(post_text) >= MessageLimit.CAPTION_LENGTH: if len(post_text) >= MessageLimit.CAPTION_LENGTH:
await message.reply_markdown_v2(post_text) post_text = post_text[: MessageLimit.CAPTION_LENGTH]
post_text = post_text[: MessageLimit.CAPTION_LENGTH - 16 * 3] # 预留一些字 await message.reply_text(f"警告!图片字符描述已经超过 {MessageLimit.CAPTION_LENGTH} 个字,已经切割")
await message.reply_text(f"警告!图片字符描述已经超过 {MessageLimit.CAPTION_LENGTH} 个字,已经切割并发送原文本")
try: try:
if len(post_images) > 1: if len(post_images) > 1:
media = [InputMediaPhoto(img_info.data) for img_info in post_images] media = [InputMediaPhoto(img_info.data) for img_info in post_images]