hype_train - YoYoGames/GMEXT-Twitch GitHub Wiki

Hype Train

Functions

These are the functions of this module:



Back To Top

twitch_hype_train_get_hype_train_events

Twitch Endpoint: Get Hype Train Events

This function gets information about the broadcaster's current or most recent Hype Train event.

Instead of polling for events, consider subscribing to Hype Train events (Begin, Progress, End).

Note

Requires a user access token that includes the TWITCH_SCOPE: TWITCH_SCOPE_CHANNEL_READ_HYPE_TRAIN.

This function operates asynchronously, which means that it does not immediately return the requested result. Instead, upon completion of the task, it will trigger the Success Callback, or Failure Callback.


Syntax:

twitch_hype_train_get_hype_train_events(broadcaster_id, optionals, callback_success, callback_failed)
Argument Type Description
broadcaster_id String The ID of the broadcaster that's running the Hype Train. This ID must match the User ID in the user access token.
optionals Struct The optional parameters to be passed into the function:

- first : Real : The maximum number of items to return per page in the response. The minimum page size is 1 item per page and the maximum is 100 items per page. The default is 1.
- after : String : The cursor used to get the next page of results. The Pagination struct in the response contains the cursor's value. Read more
callback_success Function Triggered if the request succeeded
callback_failed Function Triggered if the request failed



Returns:

N/A


Triggers:

Success Callback

These members are returned in the success callback:

Member Type Description
data Array The list of Hype Train events. The list is empty if the broadcaster hasn't run a Hype Train within the last 5 days.
 ├── id String An ID that identifies this event.
 ├── event_type String The type of event. The string is in the form, hypetrain.{event_name}. The request returns only progress event types (i.e., hypetrain.progression).
 ├── event_timestamp String The UTC date and time (in RFC3339 format) that the event occurred.
 ├── version String The version number of the definition of the event's data. For example, the value is 1 if the data in event_data uses the first definition of the event's data.
 └── event_data Struct The event's data.
         ├── broadcaster_id String The ID of the broadcaster that's running the Hype Train.
         ├── cooldown_end_time String The UTC date and time (in RFC3339 format) that another Hype Train can start.
         ├── expires_at String The UTC date and time (in RFC3339 format) that the Hype Train ends.
         ├── goal Real The value needed to reach the next level.
         ├── id String An ID that identifies this Hype Train.
         ├── last_contribution Struct The most recent contribution towards the Hype Train's goal.
                 ├── total Real The total amount contributed. If type is "BITS", total represents the amount of Bits used. If type is "SUBS", total is 500, 1000, or 2500 to represent tier 1, 2, or 3 subscriptions, respectively.
                 ├── type String The contribution method used. Possible values are: "BITS" - Cheering with Bits. "SUBS" - Subscription activity like subscribing or gifting subscriptions. "OTHER" - Covers other contribution methods not listed.
                 └── user String The ID of the user that made the contribution.
         ├── level Real The highest level that the Hype Train reached (the levels are 1 through 5).
         ├── started_at String The UTC date and time (in RFC3339 format) that this Hype Train started.
         ├── top_contributions Array The top contributors for each contribution type. For example, the top contributor using BITS (by aggregate) and the top contributor using SUBS (by count).
                 ├── total Real The total amount contributed. If type is "BITS", total represents the amount of Bits used. If type is "SUBS", total is 500, 1000, or 2500 to represent tier 1, 2, or 3 subscriptions, respectively.
                 ├── type String The contribution method used. Possible values are: "BITS" - Cheering with Bits. "SUBS" - Subscription activity like subscribing or gifting subscriptions. "OTHER" - Covers other contribution methods not listed.
                 └── user String The ID of the user that made the contribution.
         └── total Real The current total amount raised.
pagination Struct Contains the information used to page through the list of results. The struct is empty if there are no more pages left to page through. Read More
 └── cursor String The cursor used to get the next page of results. Use the cursor to set the request's after parameter.

Failure Callback

This method is triggered on failure.



⚠️ **GitHub.com Fallback** ⚠️