• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

umputun / tg-spam / 19082335171

04 Nov 2025 08:45PM UTC coverage: 81.809% (-0.003%) from 81.812%
19082335171

push

github

web-flow
Skip spam checks for anonymous admin posts (#331)

* feat: skip spam checks for anonymous admin posts

Implements automatic exclusion of anonymous admin posts from spam detection while maintaining spam checks for channel forwards and regular users.

Changes:
- Added check in listener.go to skip spam detection when msg.SenderChat.ID == fromChat
- Added comprehensive test coverage with 4 test cases
- Updated README.md to document the behavior

Behavior:
- Anonymous admin posts (when admins post "as the group") skip spam check
- Channel auto-forwards (SenderChat.ID != chat ID) still checked for spam
- Regular user messages (no SenderChat) still checked for spam
- Works uniformly across primary group, testing chats, and all allowed chats

The fix compares msg.SenderChat.ID to fromChat (the actual chat the message came from) rather than l.chatID, ensuring proper handling of anonymous admin posts in testing chats configured via --testing-id.

Related to #330

* docs: add clarifying comment for SenderChat check

Explains that when admins post 'as the group', SenderChat.ID equals the group's chat ID. This clarifies why checking ID != 0 is sufficient (it's a struct value, not a pointer).

4 of 4 new or added lines in 1 file covered. (100.0%)

1 existing line in 1 file now uncovered.

6152 of 7520 relevant lines covered (81.81%)

272.61 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

84.56
/app/webapi/webapi.go


Source Not Available

STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc