Repository navigation
[PL-90] - Add Twitch OAuth sign-in and chat announcements for achievement unlocks, game changes, and mastery - #67
Merged
Conversation
…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]>
…ts, and achievement tracking
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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_readysignal rather than the firstachievements_changedevent, since RetroAchievements pushes an empty placeholder list before the real one arrives.Changes
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), andentities/twitch_identity.cachievement_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 threadsrc/ui/twitch_account_config.cppTools → 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}placeholdersstate.c/state.h: persists Twitch identity/tokens and the announcement configuration, including a properstate_free_twitch_configuration()helper for the three owned template stringstypes.h: newtwitch_configuration_tstruct and default message templatesmain.c(twitch_account_config_register(),twitch_achievement_announcer_start()) andCMakeLists.txtRelated
Generated by describe-pr skill v1.1.0