Lightweight tool that connects to Twitch IRC, stores messages in SQLite, and tracks copy/pastes: who posted first, how many repeats, and which authors create them most often. The collected stats and counting rules are exposed via an HTTP API.
- Connects to public Twitch IRC (anonymous by default or with a provided nick).
- Auto-creates schema in
day_stats.db(SQLite). - Copy/paste detection with rules (min tokens/chars, time window, optional single-emote counting for 7tv/Twitch).
- HTTP API on
:8080for top copy/pastes, authors, per-user info, per-text info, and current config. - Tests cover IRC parsing, HTTP handlers, and counting logic.
- Requirements: Go 1.25+ and internet access to reach Twitch IRC.
- Configure
config.yaml:channel: target channel without#.user: optional nick; empty value falls back to anonymousjustinfan12345.rules: tweak counting parameters (example already in the file).
- Run the service:
go run .- The app creates
day_stats.db, starts HTTP API on:8080, and begins listening to the IRC channel.
- The app creates
GET /copy-pastes?number=10top copy/pastes with first author and total count.GET /copy-pastes/authors?number=10top authors by number of created copy/pastes.GET /copy-paste?text=...details for a specific text.GET /users?username=...stats for a user.GET /configscurrent config loaded fromconfig.yaml. Ifnumberis missing or invalid, the default limit is 10.
- Run tests:
go test ./... - Mermaid diagrams live in
*.mermaidfiles for quick process visualization.
day_stats.dbcontains collected stats; add it to.gitignoreif you do not want to commit data.
- Data is written to the database in a single thread. Trying to do this in goroutines results in an error. A proper queue needs to be implemented and connection pooling needs to be addressed.
- There's no emotes check for rules verification. Need to download 7tv, bttv, and twitch emotes for launch so you can check emotes further.
- There's no web interface, just get requests