feat: Implement Telegram bot with Claude authentication, mail service, and identity spoofing, refactoring core logic into new modules. #1

Open
mygo-kyx wants to merge 13 commits from mygo-kyx/autoClaude-TGbot:main into Feature-FromFork-Kunkun
Showing only changes of commit c6f69ac37d - Show all commits

12
bot.py
View File

@@ -705,17 +705,25 @@ async def cmd_verify(update: Update, context: ContextTypes.DEFAULT_TYPE):
# 阶段 1通过代理尝试最多 _MAX_RETRIES 次) # 阶段 1通过代理尝试最多 _MAX_RETRIES 次)
proxy = get_proxy() proxy = get_proxy()
if proxy: if proxy:
proxy_display = proxy.get("https", proxy.get("http", "?"))
logger.info(f"验证 {email} 使用代理: {proxy_display}")
for attempt in range(_MAX_RETRIES): for attempt in range(_MAX_RETRIES):
status_code, err = _do_verify_request(sk, proxy) status_code, err = _do_verify_request(sk, proxy)
if status_code is not None: if status_code is not None:
break break
last_error = err last_error = err
logger.warning(f"验证重试 {attempt + 1}/{_MAX_RETRIES} ({email}): {err}") logger.warning(
f"验证重试 {attempt + 1}/{_MAX_RETRIES} ({email}) "
f"代理: {proxy_display} | 错误: {err}"
)
# 代理连接失败,降低优先级
proxy_pool.pool.report_failure(proxy)
time.sleep(1) time.sleep(1)
# 阶段 2代理全部失败 → 直连回退 # 阶段 2代理全部失败 → 直连回退
if status_code is None: if status_code is None:
logger.info(f"代理失败,直连回退验证: {email}") if proxy:
logger.info(f"代理 {proxy_display} 全部失败,直连回退验证: {email}")
status_code, err = _do_verify_request(sk, {}, timeout=20) status_code, err = _do_verify_request(sk, {}, timeout=20)
if status_code is None: if status_code is None:
last_error = err last_error = err