mirror of
https://github.com/cdryzun/tg_bot_collections.git
synced 2025-08-05 13:16:42 +08:00
@ -59,7 +59,7 @@ def bot_reply_markdown(
|
|||||||
REPLY_MESSAGE_CACHE[cache_key] = text
|
REPLY_MESSAGE_CACHE[cache_key] = text
|
||||||
if len(text.encode("utf-8")) <= BOT_MESSAGE_LENGTH or not split_text:
|
if len(text.encode("utf-8")) <= BOT_MESSAGE_LENGTH or not split_text:
|
||||||
bot.edit_message_text(
|
bot.edit_message_text(
|
||||||
f"*{who}*:\n{telegramify_markdown.convert(text)}",
|
f"*{who}*:\n{telegramify_markdown.markdownify(text)}",
|
||||||
chat_id=reply_id.chat.id,
|
chat_id=reply_id.chat.id,
|
||||||
message_id=reply_id.message_id,
|
message_id=reply_id.message_id,
|
||||||
parse_mode="MarkdownV2",
|
parse_mode="MarkdownV2",
|
||||||
@ -70,7 +70,7 @@ def bot_reply_markdown(
|
|||||||
# Need a split of message
|
# Need a split of message
|
||||||
msgs = smart_split(text, BOT_MESSAGE_LENGTH)
|
msgs = smart_split(text, BOT_MESSAGE_LENGTH)
|
||||||
bot.edit_message_text(
|
bot.edit_message_text(
|
||||||
f"*{who}* \[1/{len(msgs)}\]:\n{telegramify_markdown.convert(msgs[0])}",
|
f"*{who}* \[1/{len(msgs)}\]:\n{telegramify_markdown.markdownify(msgs[0])}",
|
||||||
chat_id=reply_id.chat.id,
|
chat_id=reply_id.chat.id,
|
||||||
message_id=reply_id.message_id,
|
message_id=reply_id.message_id,
|
||||||
parse_mode="MarkdownV2",
|
parse_mode="MarkdownV2",
|
||||||
@ -79,7 +79,7 @@ def bot_reply_markdown(
|
|||||||
for i in range(1, len(msgs)):
|
for i in range(1, len(msgs)):
|
||||||
bot.reply_to(
|
bot.reply_to(
|
||||||
reply_id.reply_to_message,
|
reply_id.reply_to_message,
|
||||||
f"*{who}* \[{i + 1}/{len(msgs)}\\]:\n{telegramify_markdown.convert(msgs[i])}",
|
f"*{who}* \[{i + 1}/{len(msgs)}\\]:\n{telegramify_markdown.markdownify(msgs[i])}",
|
||||||
parse_mode="MarkdownV2",
|
parse_mode="MarkdownV2",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -65,7 +65,7 @@ def summary_command(message: Message, bot: TeleBot):
|
|||||||
)
|
)
|
||||||
reply_text = f"""*👇 前情提要 👇 \\({since.strftime("%Y/%m/%d %H:%M")} \\- {now.strftime("%Y/%m/%d %H:%M")}\\)*
|
reply_text = f"""*👇 前情提要 👇 \\({since.strftime("%Y/%m/%d %H:%M")} \\- {now.strftime("%Y/%m/%d %H:%M")}\\)*
|
||||||
|
|
||||||
{telegramify_markdown.convert(response.choices[0].message.content)}
|
{telegramify_markdown.markdownify(response.choices[0].message.content)}
|
||||||
"""
|
"""
|
||||||
logger.debug("Generated summary:\n%s", reply_text)
|
logger.debug("Generated summary:\n%s", reply_text)
|
||||||
bot.edit_message_text(
|
bot.edit_message_text(
|
||||||
@ -116,7 +116,7 @@ def search_command(message: Message, bot: TeleBot):
|
|||||||
for msg in messages:
|
for msg in messages:
|
||||||
link = f"https://t.me/c/{chat_id}/{msg.message_id}"
|
link = f"https://t.me/c/{chat_id}/{msg.message_id}"
|
||||||
items.append(f"{link}\n```\n{msg.content}\n```")
|
items.append(f"{link}\n```\n{msg.content}\n```")
|
||||||
message_text = telegramify_markdown.convert("\n".join(items))
|
message_text = telegramify_markdown.markdownify("\n".join(items))
|
||||||
bot.reply_to(
|
bot.reply_to(
|
||||||
message,
|
message,
|
||||||
f"🔍 *搜索结果(只显示前 {limit} 个):*\n{message_text}",
|
f"🔍 *搜索结果(只显示前 {limit} 个):*\n{message_text}",
|
||||||
|
Reference in New Issue
Block a user