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.

deleteMessage
auto deleteMessage(TwitchPlugin plugin, string channelName, string messageID, string caller)

Deletes a message, or all messages in a channel.

endPoll
auto endPoll(TwitchPlugin plugin, string channelName, string pollID, bool terminate, string caller)

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

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.

getFollowers
auto getFollowers(TwitchPlugin plugin, uint id)

Fetches a list of all followers 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 pollIDString, 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, bool totalOnly, 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, uint id)

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

getTwitchUser
auto getTwitchUser(TwitchPlugin plugin, string givenName, uint id, bool searchByDisplayName)

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

getValidation
auto getValidation(TwitchPlugin plugin, string authToken, bool async, string caller)

Validates an access key, retrieving information about it.

handleRetryDelegateException
auto handleRetryDelegateException(Exception base, size_t i, bool endlessly, bool headless)

Handles exceptions thrown by retryDelegate.

modifyChannelImpl
void modifyChannelImpl(TwitchPlugin plugin, string channelName, string title, uint gameID, string caller)

Modifies a channel's title or currently played game. Implementation function.

persistentQuerier
void persistentQuerier(MutexedAA!(QueryResponse[int]) responseBucket, string caBundleFile)

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

printRetryDelegateException
void printRetryDelegateException(Exception base)

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, bool async, bool endlessly, Duration retryDelay)

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

sendHTTPRequest
QueryResponse sendHTTPRequest(TwitchPlugin plugin, string url, string caller, string authorisationHeader, HTTPVerb verb, ubyte[] body_, string contentType, int id, bool 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.

sendWhisper
auto sendWhisper(TwitchPlugin plugin, uint userID, string unescapedMessage, string caller)

Sends a whisper to a user.

setChannelGame
void setChannelGame(TwitchPlugin plugin, string channelName, uint gameID, string caller)

Changes the currently streamed game of a channel.

setChannelTitle
void setChannelTitle(TwitchPlugin plugin, string channelName, string title, string caller)

Changes the title of a channel.

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

Starts a commercial in the specified channel.

timeoutUser
auto timeoutUser(TwitchPlugin plugin, string channelName, uint userID, uint durationSeconds, string reason, string caller)

Times out a user in a 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.

TwitchPoll
struct TwitchPoll

Represents a Twitch native poll (not a poll of the Poll plugin).

See Also

Meta