From 302c5e5e891ae6f7c085d996b996f35189f47091 Mon Sep 17 00:00:00 2001 From: kyx236 Date: Fri, 13 Feb 2026 05:04:19 +0800 Subject: [PATCH] Please provide the diff content for `d:\Claude_code_project\autoClaude-TGbot\bot.py` to generate a commit message. --- bot.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/bot.py b/bot.py index 5cd6cf6..0f5148f 100644 --- a/bot.py +++ b/bot.py @@ -5,6 +5,7 @@ autoClaude Telegram Bot """ import asyncio +import html import json import logging import os @@ -301,7 +302,7 @@ async def cmd_proxytest(update: Update, context: ContextTypes.DEFAULT_TYPE): f"🔍 代理测试中...\n" f"{_progress_bar(current, total)}\n\n" f"✅ 通过: {ok_count} ❌ 失败: {fail_count}\n\n" - f"最新: {icon} {result['proxy']} {latency}" + f"最新: {icon} {html.escape(str(result['proxy']))} {latency}" ) asyncio.run_coroutine_threadsafe( @@ -326,10 +327,11 @@ async def cmd_proxytest(update: Update, context: ContextTypes.DEFAULT_TYPE): icon = "✅" if r["ok"] else "❌" latency = f"{r['latency_ms']}ms" if r['latency_ms'] > 0 else "-" prio = r.get('priority', '-') - text += f"{icon} {r['proxy']}\n" + proxy_display = html.escape(str(r['proxy'])) + text += f"{icon} {proxy_display}\n" text += f" 延迟: {latency} | 优先级: {prio}\n" if not r["ok"]: - text += f" 错误: {r.get('error', '?')}\n" + text += f" 错误: {html.escape(str(r.get('error', '?')))}\n" if len(text) > 4000: text = text[:4000] + "\n...(已截断)" @@ -350,8 +352,9 @@ async def cmd_proxystatus(update: Update, context: ContextTypes.DEFAULT_TYPE): for i, item in enumerate(items, 1): icon = "✅" if item["last_ok"] else "❌" + proxy_display = html.escape(str(item['proxy'])) text += ( - f"{i}. {icon} {item['proxy']}\n" + f"{i}. {icon} {proxy_display}\n" f" 优先级: {item['priority']} | " f"延迟: {item['latency_ms']}ms | " f"✅{item['success']} ❌{item['fail']}\n"