raids - YoYoGames/GMEXT-Twitch GitHub Wiki
These are the functions of this module:
Twitch Endpoint: Start a raid
This function raids another channel by sending the broadcaster's viewers to the targeted channel.
When you call the API from a chat bot or extension, the Twitch UX pops up a window at the top of the chat room that identifies the number of viewers in the raid. The raid occurs when the broadcaster clicks Raid Now or after the 90-second countdown expires.
To determine whether the raid successfully occurred, you must subscribe to the Channel Raid event. For more information, see Get notified when a raid begins.
To cancel a pending raid, use the Cancel a raid endpoint.
Rate Limit: The limit is 10 requests within a 10-minute window.
Note
Requires a user access token that includes the TWITCH_SCOPE: TWITCH_SCOPE_CHANNEL_MANAGE_RAIDS
.
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_raids_start_a_raid(from_broadcaster_id, to_broadcaster_id, callback_success, callback_failed)
Argument | Type | Description |
---|---|---|
from_broadcaster_id | String | The ID of the broadcaster that's sending the raiding party. This ID must match the user ID in the user access token. |
to_broadcaster_id | String | The ID of the broadcaster to raid. |
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 | A list that contains a single struct with information about the pending raid. |
├── created_at | String | The UTC date and time, in RFC3339 format, of when the raid was requested. |
└── is_mature | Boolean | A Boolean value that indicates whether the channel being raided contains mature content. |
This method is triggered on failure.
Twitch Endpoint: Cancel a raid
This function cancel a pending raid.
You can cancel a raid at any point up until the broadcaster clicks Raid Now in the Twitch UX or the 90-second countdown expires.
Rate Limit: The limit is 10 requests within a 10-minute window.
Note
Requires a user access token that includes the TWITCH_SCOPE: TWITCH_SCOPE_CHANNEL_MANAGE_RAIDS
.
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_raids_cancel_a_raid(broadcaster_id, callback_success, callback_failed)
Argument | Type | Description |
---|---|---|
broadcaster_id | String | The ID of the broadcaster that initiated the raid. This ID must match the user ID in the user access token. |
callback_success | Function | Triggered if the request succeeded |
callback_failed | Function | Triggered if the request failed |
Returns:
N/A
Triggers:
This method is triggered on success. It has no response body.
This method is triggered on failure.