Skip to content

[PL-90] - Add Twitch OAuth sign-in and chat announcements for achievement unlocks, game changes, and mastery - #67

Merged
kzryzstof merged 3 commits into
mainfrom
features/PL-90-twitch-chat-announcer
Aug 5, 2026
Merged

kzryzstof merged 3 commits into
mainfrom
features/PL-90-twitch-chat-announcer

Conversation

@kzryzstof

@kzryzstof kzryzstof commented Aug 4, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

The tracker had no way to let viewers know what was happening on stream in real time. This adds a full Twitch integration so the plugin can automatically post a chat message when a new achievement unlocks (Xbox Live or RetroAchievements), when a new game starts, or when a game is fully mastered — configurable via a new Tools dialog, off by default, and gated behind an OAuth-connected Twitch account.

The core architectural gap called out in the ticket — detecting which achievement just unlocked from a payload-less "achievements changed" signal — is solved by diffing the achievement list against a per-game baseline, so a game's unlock history is never dumped into chat when it first loads. The baseline is captured on the monitoring service's session_ready signal rather than the first achievements_changed event, since RetroAchievements pushes an empty placeholder list before the real one arrives.

Changes

  • New src/integrations/twitch/ module mirroring the existing Xbox OAuth device-code flow: oauth/twitch-oauth.c (device-code auth + token refresh), chat.c (Helix chat posting with client-side rate limiting and 401 retry), stream_status.c (live-channel check for the "only when live" gate), account_manager.c (sign-in/out wrapper), and entities/twitch_identity.c
  • achievement_announcer.c: subscribes to the monitoring service, diffs the achievement list against a per-game baseline to detect new unlocks, announces new games being played (deduplicated against reconnect re-notifications), and announces game mastery (100% unlocked) — all off the monitor thread via a detached posting thread
  • New src/ui/twitch_account_config.cpp Tools → Twitch Account dialog: connect/disconnect, per-feature toggles (achievement unlocks, game changes, mastery, only-when-live), and editable message templates with {name}/{value}/{gamertag}/{game} placeholders
  • state.c/state.h: persists Twitch identity/tokens and the announcement configuration, including a proper state_free_twitch_configuration() helper for the three owned template strings
  • types.h: new twitch_configuration_t struct and default message templates
  • Wired into main.c (twitch_account_config_register(), twitch_achievement_announcer_start()) and CMakeLists.txt

Related


Generated by describe-pr skill v1.1.0

…ts to Twitch chat

Adds a full Twitch integration mirroring the existing Xbox OAuth device-code flow: sign-in/out via a new Tools dialog, chat posting through the Helix API, and an achievement-list differ that detects newly-unlocked achievements without spamming a game's unlock history when it first loads.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
@kzryzstof kzryzstof changed the title [PL-90] Post achievement-unlock, game-change, and mastery announcements to Twitch chat [PL-90] - Add Twitch OAuth sign-in and chat announcements for achievement unlocks, game changes, and mastery Aug 4, 2026
@kzryzstof
kzryzstof merged commit 24b6e39 into main Aug 5, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant