Skip to content

fix: 封禁用户不再触发验证 - #90

Merged
pplulee merged 1 commit into
devfrom
cursor/fix-banned-user-captcha-edb7
Nov 5, 2026
Merged

pplulee merged 1 commit into
devfrom
cursor/fix-banned-user-captcha-edb7

Conversation

@pplulee

@pplulee pplulee commented Nov 5, 2026

Copy link
Copy Markdown
Member

/ban 之后,被封用户再给 bot 发消息仍会先进入验证流程:弹出 captcha / 消耗 TGuard hCaptcha 额度,通过后提示可以发送,但消息不会转发到话题。

原因是用户私聊处理里先跑 _check_captcha,封禁检查排在后面;/ban 又会清掉验证状态,所以被封用户会被当成未验证用户重新出题。

本次改动:

  • 处理用户消息时先检查 blocked_users,被封则只回复封禁提示(已配置自定义自动回复则用自定义文案)
  • _check_captcha 对已封用户直接返回,不再生成或完成验证
  • 按钮 / emoji 验证回调在完成前拒绝已封用户,并清掉 pending challenge
  • 被封用户私聊 /start 也只提示已封禁,不再发送欢迎语
  • 补充验证入口相关测试;现有测试套件已通过

Fixes #89

Open in Web Open in Cursor 

Banned users were hitting captcha before the blocked_users check, so
/ban still started TGuard/hCaptcha and accepted later messages without
forwarding them. Check the ban first, reply with a banned notice, and
refuse verification callbacks.

Co-authored-by: pplulee <hi@pplulee.me>
@pplulee
pplulee merged commit 97027c3 into dev Nov 5, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants