You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This commit was created on GitHub.com and signed with GitHub’s verified signature.
Add /stats command with video poster and reaction tracking (#25)
* Add /stats command with video poster and reaction tracking
Tracks who posts videos via /dl and how many reactions (including per-emoji
👍/👎) those posts receive. Surfaces data via a new /stats command showing
top posters, most liked/disliked videos, and top reposters per group.
- Extend DuckDB schema with video_stats table (thumbs_up/down counts, is_repost flag)
- New VideoStatsHandler records each successful /dl post including repost detection
- New StatsHandler responds to /stats with a per-group leaderboard
- Telegram: MiddlewarePoller intercepts message_reaction updates and diffs
old/new emoji arrays to update per-emoji counts accurately
- Discord: reaction add/remove event listeners with emoji routing
- Fix ConstructTextResponseHandler overwriting textResponse for Stats action
- Fix EndOfChainHandler calling CleanupOldFingerprints before DB is initialised
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* Address PR #25 review feedback
- Add allowlist check in queryTopByReactionColumn to defuse SQL injection risk
- Group leaderboard/reposter stats by user_id only, picking MAX(username) so
a renamed user is counted as one person instead of splitting into two rows
- Drop unused reaction_count column; leaderboards already use the per-emoji
counts so the total was dead weight
- Comment the ALTER TABLE migration block to explain why it duplicates the
CREATE TABLE columns (needed for existing DBs created before these columns)
- StatsHandler, Discord and Telegram reaction tracking now share a single
*sql.DB instead of opening a new DuckDB connection per event/query
- Add default case to the platform switches in StatsHandler and
VideoStatsHandler so unknown services log and bail instead of building a
malformed group_id
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>