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

umputun / tg-spam / 25035848305
83%

Build:
DEFAULT BRANCH: master
Ran 28 Apr 2026 05:39AM UTC
Jobs 1
Files 41
Run time 1min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

28 Apr 2026 05:35AM UTC coverage: 83.275% (+0.2%) from 83.078%
25035848305

push

github

web-flow
Add warn auto-ban for repeated admin /warn commands (#398)

* add plan: warn-auto-ban

* feat: add Warnings storage layer for warn auto-ban

Add per-event log table tracking admin /warn commands per (gid, user_id).
Mirrors the Reports storage pattern with Add/CountWithin methods and
opportunistic cleanup of rows older than 1 year. Tests cover both SQLite
and Postgres engines.

Related to #71

* feat: add Warnings consumer interface and moq mock

Adds the Warnings interface to the events package next to the Reports
interface, generates the moq mock, and threads the warnings/warnThreshold/
warnWindow fields onto the admin struct so they can be wired in Task 4
and consumed in Task 5.

* feat: wire warn auto-ban CLI flags and settings

Adds --warn.threshold and --warn.window flags (env: WARN_THRESHOLD,
WARN_WINDOW) and a corresponding WarnSettings substruct on the top-level
Settings model. Maps options through optToSettings and registers
Warn.Threshold in zeroAwarePaths so 0 ("disabled") survives DB-backed
config loads. Adds startup validation that rejects threshold>0 with
non-positive window, extracted into a testable validateSettings helper.

* feat: wire warnings storage through TelegramListener to admin

Add WarnThreshold, WarnWindow, and Warnings fields to TelegramListener
and pass them into the admin handler literal. Construct the warnings
storage in main.go when --warn.threshold > 0 and populate the listener
fields from settings.Warn.

The admin handler still gates on warnThreshold == 0 || warnings == nil,
so the wiring is inert until Task 5 extends DirectWarnReport to use it.

* feat: implement warn auto-ban in DirectWarnReport

When warn threshold is configured, DirectWarnReport now records each warn
and bans the user or channel once the count within the configured window
reaches the threshold. The new executeWarnBan helper respects dry,
training, and soft-ban modes, posts an admin-chat notification, and uses
the existing banUserOrChannel primiti... (continued)

182 of 205 new or added lines in 6 files covered. (88.78%)

1 existing line in 1 file now uncovered.

8355 of 10033 relevant lines covered (83.28%)

228.83 hits per line

Uncovered Changes

Lines Coverage ∆ File
14
81.08
app/storage/warnings.go
9
55.26
0.63% app/main.go

Coverage Regressions

Lines Coverage ∆ File
1
55.26
0.63% app/main.go
Jobs
ID Job ID Ran Files Coverage
1 25035848305.1 28 Apr 2026 05:39AM UTC 41
83.28
GitHub Action Run
Source Files on build 25035848305
  • Tree
  • List 41
  • Changed 8
  • Source Changed 0
  • Coverage Changed 8
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • dcd8e9c5 on github
  • Prev Build on master (#25030940684)
  • Next Build on master (#25123809667)
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