kameloso.plugins.twitch.api

Functions for accessing the Twitch API. For internal use.

Members

Functions

averageApproximateQueryTime
void averageApproximateQueryTime(TwitchPlugin plugin, long responseMsecs)

Given a query time measurement, calculate a new approximate query time based on the weighted averages of the old value and said new measurement.

createPoll
auto createPoll(TwitchPlugin plugin, string channelName, string title, string durationString, string[] choices, string caller)

Creates a Twitch poll in the specified channel.

createShoutout
auto createShoutout(TwitchPlugin plugin, string login)

Prepares a Shoutout Voldemort struct with information needed to compose a shoutout.

endPoll
auto endPoll(TwitchPlugin plugin, string channelName, string voteID, Flag!"terminate" terminate, string caller)

Ends a Twitch poll, putting it in either a "TERMINATED" or "ARCHIVED" state.

get7tvEmotes
void get7tvEmotes(TwitchPlugin plugin, bool[dstring] emoteMap, string idString, string caller)

Fetches 7tv emotes for a given channel.

get7tvGlobalEmotes
void get7tvGlobalEmotes(TwitchPlugin plugin, bool[dstring] emoteMap, string caller)

Fetches 7tv emotes.

getBTTVEmotes
void getBTTVEmotes(TwitchPlugin plugin, bool[dstring] emoteMap, string idString, string caller)

Fetches BetterTTV emotes for a given channel.

getBTTVGlobalEmotes
void getBTTVGlobalEmotes(TwitchPlugin plugin, bool[dstring] emoteMap, string caller)

Fetches globalBetterTTV emotes.

getBotList
auto getBotList(TwitchPlugin plugin, string caller)

Fetches a list of known (online) bots from TwitchInsights.net.

getBroadcasterAuthorisation
auto getBroadcasterAuthorisation(TwitchPlugin plugin, string channelName)

Returns a broadcaster-level "Bearer" authorisation token for a channel, where such exist.

getChannel
auto getChannel(TwitchPlugin plugin, string channelName)

Fetches information about a channel; its title, what game is being played, the channel tags, etc.

getChatters
auto getChatters(TwitchPlugin plugin, string broadcaster, string caller)

Get the JSON representation of everyone currently in a broadcaster's channel.

getFFZEmotes
void getFFZEmotes(TwitchPlugin plugin, bool[dstring] emoteMap, string idString, string caller)

Fetches FrankerFaceZ emotes for a given channel.

getFollows
auto getFollows(TwitchPlugin plugin, string id)

Fetches a list of all follows of the passed channel and caches them in the channel's entry in TwitchPlugin.rooms.

getMultipleTwitchData
auto getMultipleTwitchData(TwitchPlugin plugin, string url, string caller)

By following a passed URL, queries Twitch servers for an array of entities (such as users or channels).

getPolls
auto getPolls(TwitchPlugin plugin, string channelName, string idString, string caller)

Fetches information about polls in the specified channel. If an ID string is supplied, it will be included in the query, otherwise all "ACTIVE" polls are included in the returned JSON.

getStream
auto getStream(TwitchPlugin plugin, string loginName)

Fetches information about an ongoing stream.

getSubscribers
auto getSubscribers(TwitchPlugin plugin, string channelName, string caller)

Fetches a list of all subscribers of the specified channel. A broadcaster-level access token is required.

getTwitchData
auto getTwitchData(TwitchPlugin plugin, string url, string caller)

By following a passed URL, queries Twitch servers for an entity (user or channel).

getTwitchGame
auto getTwitchGame(TwitchPlugin plugin, string name, string id)

Fetches information about a game; its numerical ID and full name.

getTwitchUser
auto getTwitchUser(TwitchPlugin plugin, string givenName, string givenIDString, Flag!"searchByDisplayName" searchByDisplayName)

Fetches information about a Twitch user and returns it in the form of a Voldemort struct with nickname, display name and account ID (as string) members.

getUniqueNumericalID
auto getUniqueNumericalID(QueryResponse[int] bucket)

Generates a unique numerical ID for use as key in the passed associative array bucket.

getValidation
auto getValidation(TwitchPlugin plugin, string authToken, Flag!"async" async, string caller)

Validates an access key, retrieving information about it.

modifyChannel
void modifyChannel(TwitchPlugin plugin, string channelName, string title, string gameID, string caller)

Modifies a channel's title or currently played game.

persistentQuerier
void persistentQuerier(QueryResponse[int] bucket, string caBundleFile)

Persistent worker issuing Twitch API queries based on the concurrency messages sent to it.

printRetryDelegateException
void printRetryDelegateException(Exception e)

Prints out details about exceptions passed from retryDelegate. retryDelegate itself rethrows them when we return, so no need to do that here.

retryDelegate
auto retryDelegate(TwitchPlugin plugin, Dg dg)

Retries a passed delegate until it no longer throws or until the hardcoded number of retries (TwitchPlugin.delegateRetries) is reached.

sendHTTPRequest
QueryResponse sendHTTPRequest(TwitchPlugin plugin, string url, string caller, string authorisationHeader, HttpVerb verb, ubyte[] body_, string contentType, int id, Flag!"recursing" recursing)

Wraps sendHTTPRequestImpl by proxying calls to it via the persistentQuerier subthread.

sendHTTPRequestImpl
auto sendHTTPRequestImpl(string url, string authHeader, string caBundleFile, HttpVerb verb, ubyte[] body_, string contentType)

Sends a HTTP request of the passed verb to the passed URL, and returns the response.

startCommercial
void startCommercial(TwitchPlugin plugin, string channelName, string lengthString, string caller)

Starts a commercial in the specified channel.

waitForQueryResponse
auto waitForQueryResponse(TwitchPlugin plugin, int id)

Common code to wait for a query response.

Structs

QueryResponse
struct QueryResponse

Embodies a response from a query to the Twitch servers. A string paired with a millisecond count of how long the query took, and some metadata about the request.

See Also

Meta