Skip to content

feat: Add V2 Hype Train EventSub events#361

Open
mphacker wants to merge 1 commit intotwitchdev:mainfrom
mphacker:main
Open

feat: Add V2 Hype Train EventSub events#361
mphacker wants to merge 1 commit intotwitchdev:mainfrom
mphacker:main

Conversation

@mphacker
Copy link

Summary

Adds support for V2 Hype Train EventSub events (channel.hype_train.begin, .progress, .end), matching the current Twitch EventSub API which has moved to version 2.

Changes

New V2 fields added:

  • type (string): regular, treasure, golden_kappa - the Hype Train variant
  • is_shared_train (boolean): whether this is a shared Hype Train
  • shared_train_participants (array|null): list of broadcasters in a shared train
  • all_time_high_level / all_time_high_total (begin event only)

V2 fields removed vs V1:

  • last_contribution removed (only top_contributions remains in V2)

Files changed:

  • internal/models/hype_train.go - Added V2 model structs
  • internal/events/types/hype_train_v2/hype_train_event.go - New V2 event handler
  • internal/events/types/hype_train_v2/hype_train_event_test.go - Tests for all triggers
  • internal/events/types/types.go - Registered V2, deprecated V1
  • docs/event.md - Updated documentation

Design decisions

  • Backward compatible: V1 preserved; V2 is a separate package following the channel_update_v1/v2 pattern
  • V1 marked as removed: Added to RemovedEvents() since Twitch no longer lists V1
  • Uses only public API: All fields from official Twitch EventSub docs

Testing

  • All existing tests pass (go test ./...)
  • New V2 tests cover begin, progress, end triggers for webhook and websocket
  • Cross-compiled and verified on Windows x64

Add support for V2 Hype Train events (begin, progress, end) matching
the current Twitch EventSub API. V2 adds type (regular/treasure/
golden_kappa), is_shared_train, shared_train_participants, and
all_time_high_level/all_time_high_total fields for begin events.
V2 removes last_contribution (replaced by top_contributions only).

V1 events are preserved for backward compatibility but marked as
removed in RemovedEvents() since Twitch no longer lists V1.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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