Skip to content

feat: Add 3-strike anti-spam system for captchas#144

Merged
marcopaganini merged 4 commits into
OsProgramadores:masterfrom
abarrosjr:feature/anti-spam
Jul 14, 2026
Merged

feat: Add 3-strike anti-spam system for captchas#144
marcopaganini merged 4 commits into
OsProgramadores:masterfrom
abarrosjr:feature/anti-spam

Conversation

@abarrosjr

Copy link
Copy Markdown
Contributor

Description

This PR introduces a progressive punitive system to prevent spam bots from repeatedly rejoining the group after failing the captcha.

Changes

  • 1st Failure: User is kicked from the group.
  • 2nd Failure: User is kicked and warned about a potential 24h ban.
  • 3rd Failure: User receives a 24-hour temporary ban (utilizing Telegram's UntilDate attribute).
  • 4th Failure: User receives a permanent ban.
  • Reset: If a user successfully passes the captcha at any point, their failure count is reset to zero.

Technical Details

  • Implemented captchaFailures struct to track user failure counts.
  • Added data persistence via captcha_failures.json so the state is kept across bot restarts.
  • Added kickUserUntil in ban.go to handle time-bound bans using the Telegram API.

@abarrosjr
abarrosjr force-pushed the feature/anti-spam branch from 5adf82b to 98997ce Compare July 12, 2026 01:41
Comment thread .github/workflows/golangci-lint.yml
Comment thread src/captcha.go Outdated
@marcopaganini
marcopaganini merged commit 920c374 into OsProgramadores:master Jul 14, 2026
2 checks passed
@abarrosjr
abarrosjr deleted the feature/anti-spam branch July 15, 2026 11:11
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