bits - YoYoGames/GMEXT-Twitch GitHub Wiki
These are the functions of this module:
Twitch Endpoint: Get Cheermotes
This function gets a list of Cheermotes that users can use to cheer Bits in any Bits-enabled channel's chat room. Cheermotes are animated emotes that viewers can assign Bits to.
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_bits_get_cheermotes(broadcaster_id, callback_success, callback_failed)
Argument | Type | Description |
---|---|---|
broadcaster_id | String | The ID of the broadcaster whose custom Cheermotes you want to get. Specify the broadcaster's ID if you want to include the broadcaster's Cheermotes in the response (not all broadcasters upload Cheermotes). If not specified, the response contains only global Cheermotes. If the broadcaster uploaded Cheermotes, the type field in the response is set to "channel_custom" . |
callback_success | Function | Triggered if the request succeeded |
callback_failed | Function | Triggered if the request failed |
Returns:
N/A
Triggers:
These members are returned in the success callback:
Member | Type | Description |
---|---|---|
data | Array | The list of Cheermotes. The list is in ascending order by the order field's value. |
├── prefix | String | The name portion of the Cheermote string that you use in chat to cheer Bits. The full Cheermote string is the concatenation of {prefix} + {number of Bits}. For example, if the prefix is "Cheer" and you want to cheer 100 Bits, the full Cheermote string is Cheer100. When the Cheermote string is entered in chat, Twitch converts it to the image associated with the Bits tier that was cheered. |
├── tiers | Array | A list of tier levels that the Cheermote supports. Each tier identifies the range of Bits that you can cheer at that tier level and an image that graphically identifies the tier level. |
├── min_bits | Real | The minimum number of Bits that you must cheer at this tier level. The maximum number of Bits that you can cheer at this level is determined by the required minimum Bits of the next tier level minus 1. For example, if min_bits is 1 and min_bits for the next tier is 100, the Bits range for this tier level is 1 through 99. The minimum Bits value of the last tier is the maximum number of Bits you can cheer using this Cheermote. For example, 10000. |
├── id | String | The tier level. Possible tiers are:1, 100, 500, 1000, 5000, 10000, 100000 |
├── color | String | The hex code of the color associated with this tier level (for example, #979797 ). |
├── images | Struct | The animated and static image sets for the Cheermote. The dictionary of images is organized by theme, format, and size. The theme keys are "dark" and "light" . Each theme is a dictionary of formats: "animated" and "static" . Each format is a dictionary of sizes: "1" , "1.5" , "2" , "3" , and "4" . The value of each size contains the URL to the image. |
├── can_cheer | Boolean | A Boolean value that determines whether users can cheer at this tier level. |
└── show_in_bits_card | Boolean | A Boolean value that determines whether this tier level is shown in the Bits card. Is true if this tier level is shown in the Bits card. |
├── type | String | The type of Cheermote. Possible values are: "global_first_party " - A Twitch-defined Cheermote that is shown in the Bits card. "global_third_party" - A Twitch-defined Cheermote that is not shown in the Bits card. "channel_custom" - A broadcaster-defined Cheermote. "display_only" - Do not use; for internal use only. "sponsored" - A sponsor-defined Cheermote. When used, the sponsor adds additional Bits to the amount that the user cheered. For example, if the user cheered Terminator100, the broadcaster might receive 110 Bits, which includes the sponsor's 10 Bits contribution. |
├── order | Real | The order that the Cheermotes are shown in the Bits card. The numbers may not be consecutive. For example, the numbers may jump from 1 to 7 to 13. The order numbers are unique within a Cheermote type (for example, "global_first_party" ) but may not be unique amongst all Cheermotes in the response. |
├── last_updated | String | The date and time, in RFC3339 format, when this Cheermote was last updated. |
└── is_charitable | Boolean | A Boolean value that indicates whether this Cheermote provides a charitable contribution match during charity campaigns. |
This method is triggered on failure.
Twitch Endpoint: Get Extension Transactions
This function gets an extension's list of transactions. A transaction records the exchange of a currency (for example, Bits) for a digital product.
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_bits_get_extension_transactions(extension_id, optionals, callback_success, callback_failed)
Argument | Type | Description |
---|---|---|
extension_id | String | The ID of the extension whose list of transactions you want to get. |
optionals | Struct | The optional parameters to be passed into the function: - id : String : A transaction ID used to filter the list of transactions. Specify an array with transaction IDs to get multiple transactions. You may specify a maximum of 100 IDs.- 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 20.- 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:
These members are returned in the success callback:
Member | Type | Description |
---|---|---|
data | Array | The list of transactions. |
├── id | String | An ID that identifies the transaction. |
├── timestamp | String | The UTC date and time (in RFC3339 format) of the transaction. |
├── broadcaster_id | String | The ID of the broadcaster that owns the channel where the transaction occurred. |
├── broadcaster_login | String | The broadcaster's login name. |
├── broadcaster_name | String | The broadcaster's display name. |
├── user_id | String | The ID of the user that purchased the digital product. |
├── user_login | String | The user's login name. |
├── user_name | String | The user's display name. |
├── product_type | String | The type of transaction. Possible values are: "BITS_IN_EXTENSION"
|
└── product_data | Struct | Contains details about the digital product. |
├── sku | String | An ID that identifies the digital product. |
├── domain | String | Set to twitch.ext. + <the extension's ID> . |
├── cost | Struct | Contains details about the digital product's cost. |
├── amount | Real | The amount exchanged for the digital product. |
└── type | String | The type of currency exchanged. Possible values are: "bits"
|
├── inDevelopment | Boolean | A Boolean value that determines whether the product is in development. Is true if the digital product is in development and cannot be exchanged. |
├── displayName | String | The name of the digital product. |
├── expiration | String | This field is always empty since you may purchase only unexpired products. |
└── broadcast | Boolean | A Boolean value that determines whether the data was broadcast to all instances of the extension. Is true if the data was broadcast to all instances. |
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. |
This method is triggered on failure.