From e56bdef0f7a003a493601b3d97edda1b56d12f21 Mon Sep 17 00:00:00 2001 From: Zichao Lin Date: Sat, 11 Jul 2026 22:05:02 +0800 Subject: [PATCH] fix: use single backtick for tap-to-copy, remove copy_text button --- src/tg_bot.py | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/tg_bot.py b/src/tg_bot.py index db6f367..03b56f9 100644 --- a/src/tg_bot.py +++ b/src/tg_bot.py @@ -24,12 +24,11 @@ def send_summary(tg_cfg: TelegramConfig, chat_id: str, summary_text: str, can_reply = summary_data.get("can_reply", True) is_promotion = summary_data.get("category") == "promotion" links = summary_data.get("links", []) - verification_code = summary_data.get("verification_code", "") result = _tg_req(tg_cfg, "sendMessage", { "chat_id": chat_id, "text": summary_text, "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"] _email_contexts[msg_id] = { @@ -117,7 +116,7 @@ def _format_verification(data: dict, account_email: str = "") -> str: lines = [ f"🔑 *验证码*", f"━━━━━━━━━━━━━━━━━━", - f"```{_escape(code)}```", + f"`{_escape(code)}`", f"账户: {_escape(account_email)}", ] return "\n".join(lines) @@ -154,8 +153,7 @@ CALLBACK_HINT = "h" CALLBACK_CANCEL = "c" -def _summary_keyboard(can_reply: bool = True, is_promotion: bool = False, - links: list = None, verification_code: str = "") -> dict: +def _summary_keyboard(can_reply: bool = True, is_promotion: bool = False, links: list = None) -> dict: if is_promotion: return {"inline_keyboard": [[{"text": "查看原文", "callback_data": CALLBACK_VIEW_ORIG}]]} kb = [ @@ -171,9 +169,6 @@ def _summary_keyboard(can_reply: bool = True, is_promotion: bool = False, text = link.get("text", "打开链接")[:30] if url.startswith("http"): 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}