Skip to content

noNhead/twitch-copypast-tracker

Repository files navigation

twitch-copypast-tracker

Go Version HTTP API Database Status

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.

Features

  • 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 :8080 for top copy/pastes, authors, per-user info, per-text info, and current config.
  • Tests cover IRC parsing, HTTP handlers, and counting logic.

Quick start

  1. Requirements: Go 1.25+ and internet access to reach Twitch IRC.
  2. Configure config.yaml:
    • channel: target channel without #.
    • user: optional nick; empty value falls back to anonymous justinfan12345.
    • rules: tweak counting parameters (example already in the file).
  3. Run the service:
    go run .
    • The app creates day_stats.db, starts HTTP API on :8080, and begins listening to the IRC channel.

API

  • GET /copy-pastes?number=10 top copy/pastes with first author and total count.
  • GET /copy-pastes/authors?number=10 top authors by number of created copy/pastes.
  • GET /copy-paste?text=... details for a specific text.
  • GET /users?username=... stats for a user.
  • GET /configs current config loaded from config.yaml. If number is missing or invalid, the default limit is 10.

Development

  • Run tests: go test ./...
  • Mermaid diagrams live in *.mermaid files for quick process visualization.

Notes

  • day_stats.db contains collected stats; add it to .gitignore if you do not want to commit data.

Current problems and plans

  • 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

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors