fix: use single backtick for tap-to-copy, remove copy_text button

This commit is contained in:
2026-07-11 22:05:02 +08:00
parent 6d1fe29df4
commit e56bdef0f7

View File

@@ -24,12 +24,11 @@ def send_summary(tg_cfg: TelegramConfig, chat_id: str, summary_text: str,
can_reply = summary_data.get("can_reply", True) can_reply = summary_data.get("can_reply", True)
is_promotion = summary_data.get("category") == "promotion" is_promotion = summary_data.get("category") == "promotion"
links = summary_data.get("links", []) links = summary_data.get("links", [])
verification_code = summary_data.get("verification_code", "")
result = _tg_req(tg_cfg, "sendMessage", { result = _tg_req(tg_cfg, "sendMessage", {
"chat_id": chat_id, "chat_id": chat_id,
"text": summary_text, "text": summary_text,
"parse_mode": "MarkdownV2", "parse_mode": "MarkdownV2",
"reply_markup": _summary_keyboard(can_reply, is_promotion, links, verification_code), "reply_markup": _summary_keyboard(can_reply, is_promotion, links),
}) })
msg_id = result["result"]["message_id"] msg_id = result["result"]["message_id"]
_email_contexts[msg_id] = { _email_contexts[msg_id] = {
@@ -117,7 +116,7 @@ def _format_verification(data: dict, account_email: str = "") -> str:
lines = [ lines = [
f"🔑 *验证码*", f"🔑 *验证码*",
f"━━━━━━━━━━━━━━━━━━", f"━━━━━━━━━━━━━━━━━━",
f"```{_escape(code)}```", f"`{_escape(code)}`",
f"账户: {_escape(account_email)}", f"账户: {_escape(account_email)}",
] ]
return "\n".join(lines) return "\n".join(lines)
@@ -154,8 +153,7 @@ CALLBACK_HINT = "h"
CALLBACK_CANCEL = "c" CALLBACK_CANCEL = "c"
def _summary_keyboard(can_reply: bool = True, is_promotion: bool = False, def _summary_keyboard(can_reply: bool = True, is_promotion: bool = False, links: list = None) -> dict:
links: list = None, verification_code: str = "") -> dict:
if is_promotion: if is_promotion:
return {"inline_keyboard": [[{"text": "查看原文", "callback_data": CALLBACK_VIEW_ORIG}]]} return {"inline_keyboard": [[{"text": "查看原文", "callback_data": CALLBACK_VIEW_ORIG}]]}
kb = [ kb = [
@@ -171,9 +169,6 @@ def _summary_keyboard(can_reply: bool = True, is_promotion: bool = False,
text = link.get("text", "打开链接")[:30] text = link.get("text", "打开链接")[:30]
if url.startswith("http"): if url.startswith("http"):
kb.append([{"text": f"🔗 {text}", "url": url}]) kb.append([{"text": f"🔗 {text}", "url": url}])
if verification_code:
code = verification_code.split(" ", 1)[-1] if " " in verification_code else verification_code
kb.append([{"text": code, "type": "copy_text", "copy_text": {"text": code}}])
return {"inline_keyboard": kb} return {"inline_keyboard": kb}