Connection to the Twitch pub/sub api. Allows full admin access over your streaming acccount from banning users, setting stream titles to more complex features like vods, clips etc.
- Source:
-
Methods
ConnectToDataCenter(host, port)
Connects to the StreamRoller server
Parameters:
| Name |
Type |
Description |
host |
string
|
|
port |
number
|
|
- Source:
-
DeleteCredentialsOnServer()
Delete our credential file from the server
- Source:
-
SaveConfigToServer()
Save our config to the server
- Source:
-
Parameters:
| Name |
Type |
Description |
to |
String
|
channel to send to or "" to broadcast
|
- Source:
-
Send our small settings widget html code to the given extension
Parameters:
| Name |
Type |
Description |
toChannel |
string
|
|
- Source:
-
(async) addGameToHistoryFromGameName(gameName)
Adds a game by name to the history list
Parameters:
| Name |
Type |
Description |
gameName |
string
|
|
- Source:
-
(async) addMod(username)
make username a mod
Parameters:
| Name |
Type |
Description |
username |
string
|
|
- Source:
-
(async) addVIP(username)
Make the username a VIP
Parameters:
| Name |
Type |
Description |
username |
string
|
|
- Source:
-
(async) banUser(username, reason)
Ban username for given reason
Parameters:
| Name |
Type |
Description |
username |
string
|
|
reason |
string
|
|
- Source:
-
(async) cancelPrediction(data)
Cancels a prediction
Parameters:
| Name |
Type |
Description |
data |
object
|
|
- Source:
-
(async) cheerEmotes()
send trigger_TwitchCheerEmotes
- Source:
-
(async) connectTwitch()
Connects to the twitch api
- Source:
-
containsBadChars(s)
Tests for unicode charts in a string
Parameters:
| Name |
Type |
Description |
s |
string
|
|
- Source:
-
Returns:
boolean
(async) createBlock(data)
Block the user given
Parameters:
| Name |
Type |
Description |
data |
object
|
|
- Source:
-
(async) createClip()
Create a twitch clip and send out trigger_TwitchClipCreated when done
- Source:
-
createDropdownWithSearchableHistory(id, categories, history, currentSelectedId)
Creates an html dropdown list that is searchable using the given information
Parameters:
| Name |
Type |
Description |
id |
string
|
|
categories |
string
|
|
history |
string
|
|
currentSelectedId |
string
|
|
- Source:
-
Returns:
html string containing dropdown code
(async) createPoll(data)
Creates a twitch poll
Parameters:
| Name |
Type |
Description |
data |
object
|
|
- Source:
-
createPredictionString(data)
Fires on a twitch pubsub event
Parameters:
| Name |
Type |
Description |
data |
object
|
|
- Source:
-
(async) deleteBlock(data)
Remove a Block from the given user
Parameters:
| Name |
Type |
Description |
data |
object
|
|
- Source:
-
disconnectTwitch()
Disconnect the twitch API
- Source:
-
(async) endPoll(data)
Ends the given poll
Parameters:
| Name |
Type |
Description |
data |
object
|
|
- Source:
-
findTriggerByMessageType(messagetype)
Find a trigger by message type
Parameters:
| Name |
Type |
Description |
messagetype |
string
|
|
- Source:
-
Returns:
trigger
findTriggerByMessageType(messagetype)
Finds the trigger using the passed messagetype
Parameters:
| Name |
Type |
Description |
messagetype |
string
|
|
- Source:
-
Returns:
trigger
(async) followedChannels()
sends trigger_TwitchFollowedChannels
- Source:
-
(async) followerCount()
Send trigger_TwitchFollowerCount
- Source:
-
(async) getAllGameCategories(id)
Collates and sends out the twitch 'Top' category list
Parameters:
| Name |
Type |
Default |
Description |
id |
string
|
twitch
|
trigger identifier or "twitch"
|
- Source:
-
(async) getBlockedUsers()
send a trigger_TwitchUserBlocks message containing current blocked users
- Source:
-
(async) getChannelEditors()
sends trigger trigger_TwitchEditors containing the chat editors
- Source:
-
(async) getChannelVIPs()
send trigger_TwitchVIPs containing chat VIP's
- Source:
-
(async) getClipById(data, rollbackCountopt)
Gets a clip using data.clipName,if clip isn't available yet (i.e. still being processed)
setup a reschedule timer to wait for clip. Sends trigger_TwitchVodClip when found
Parameters:
| Name |
Type |
Attributes |
Default |
Description |
data |
object
|
|
|
|
rollbackCount |
number
|
<optional>
|
5
|
in seconds, reduced by 1 second each rollback
|
- Source:
-
(async) getClipsByBroadcaster(data, rollbackCountopt)
Sends out a trigger_TwitchVodClip message for each clip the broadcaster has
data is formatted from an action.
Parameters:
| Name |
Type |
Attributes |
Default |
Description |
data |
object
|
|
|
|
rollbackCount |
number
|
<optional>
|
5
|
number of times to check (1 second polls, in case clip is still being processed)
|
- Source:
-
(async) getClipsByGame(data)
sends a trigger_TwitchVodClip for each clip from a game category based on data object
Parameters:
| Name |
Type |
Description |
data |
object
|
|
- Source:
-
(async) getGameFromId(gameId)
Get a game object from a game Id
Parameters:
| Name |
Type |
Description |
gameId |
number
|
|
- Source:
-
Returns:
gameobject
(async) getPoll(id)
send trigger_TwitchPoll
Parameters:
| Name |
Type |
Description |
id |
number
|
|
- Source:
-
(async) getPolls()
send a trigger_TwitchPoll message for each poll running
- Source:
-
(async) getPrediction(data)
Sends trigger_TwitchPrediction for the given prediction
Parameters:
| Name |
Type |
Description |
data |
object
|
|
- Source:
-
(async) getPredictions(data)
sends trigger_TwitchPrediction for each current predictions
Parameters:
| Name |
Type |
Description |
data |
object
|
|
- Source:
-
getTextboxWithHistoryHTML(SelectEleId, TextEleId, history, currentSelectedId)
Creates an html dropdown list on a text box is searchable using the given information
Parameters:
| Name |
Type |
Description |
SelectEleId |
string
|
|
TextEleId |
string
|
|
history |
string
|
|
currentSelectedId |
string
|
|
- Source:
-
Returns:
html string containing textbox code
(async) getUser(username)
send trigger_TwitchUserDetails message for given user
Parameters:
| Name |
Type |
Description |
username |
string
|
|
- Source:
-
Handles data from a user submit on our small settings widget
Parameters:
| Name |
Type |
Description |
modalCode |
object
|
|
- Source:
-
Returns:
boolean restart connection needed due to data change
heartBeatCallback()
Sends out heartbeat messages so other extensions can see our status
- Source:
-
init(LocalConfig, ServerConfig, tAndAs, triggerCAllback)
Initialises the pub sub module with the given data
Parameters:
| Name |
Type |
Description |
LocalConfig |
object
|
|
ServerConfig |
object
|
|
tAndAs |
object
|
|
triggerCAllback |
function
|
|
- Source:
-
initialise(app, host, port, heartbeat)
Starts the extension using the given data.
Parameters:
| Name |
Type |
Description |
app |
object:Express
|
|
host |
string
|
|
port |
number
|
|
heartbeat |
number
|
|
- Source:
-
(async) leaderboard()
send trigger_TwitchLeaderboard
- Source:
-
(async) lockPrediction(data)
Locks a prediction in it's current state
Parameters:
| Name |
Type |
Description |
data |
object
|
|
- Source:
-
onChannelBan(data)
Fires on a twitch pubsub event
Parameters:
| Name |
Type |
Description |
data |
object
|
|
- Source:
-
onChannelCharityCampaignProgress(data)
Fires on a twitch pubsub event
Parameters:
| Name |
Type |
Description |
data |
object
|
|
- Source:
-
onChannelCharityCampaignStart(data)
Fires on a twitch pubsub event
Parameters:
| Name |
Type |
Description |
data |
object
|
|
- Source:
-
onChannelCharityCampaignStop(data)
Fires on a twitch pubsub event
Parameters:
| Name |
Type |
Description |
data |
object
|
|
- Source:
-
onChannelCharityDonation(data)
Fires on a twitch pubsub event
Parameters:
| Name |
Type |
Description |
data |
object
|
|
- Source:
-
onChannelCheer(data)
Fires on a twitch pubsub event
Parameters:
| Name |
Type |
Description |
data |
object
|
|
- Source:
-
onChannelFollow(data)
Fires on a twitch pubsub event
Parameters:
| Name |
Type |
Description |
data |
object
|
|
- Source:
-
onChannelGoalBegin(data)
Fires on a twitch pubsub event
Parameters:
| Name |
Type |
Description |
data |
object
|
|
- Source:
-
onChannelGoalEnd(data)
Fires on a twitch pubsub event
Parameters:
| Name |
Type |
Description |
data |
object
|
|
- Source:
-
onChannelGoalProgress(data)
Fires on a twitch pubsub event
Parameters:
| Name |
Type |
Description |
data |
object
|
|
- Source:
-
onChannelHypeTrainBegin(data)
Fires on a twitch pubsub event
Parameters:
| Name |
Type |
Description |
data |
object
|
|
- Source:
-
onChannelHypeTrainEnd(data)
Fires on a twitch pubsub event
Parameters:
| Name |
Type |
Description |
data |
object
|
|
- Source:
-
onChannelHypeTrainProgress(data)
Fires on a twitch pubsub event
Parameters:
| Name |
Type |
Description |
data |
object
|
|
- Source:
-
onChannelModeratorAdd(data)
Fires on a twitch pubsub event
Parameters:
| Name |
Type |
Description |
data |
object
|
|
- Source:
-
onChannelModeratorRemove(data)
Fires on a twitch pubsub event
Parameters:
| Name |
Type |
Description |
data |
object
|
|
- Source:
-
onChannelPollBegin(data)
Fires on a twitch pubsub event
Parameters:
| Name |
Type |
Description |
data |
object
|
|
- Source:
-
onChannelPollEnd(data)
Fires on a twitch pubsub event
Parameters:
| Name |
Type |
Description |
data |
object
|
|
- Source:
-
onChannelPollProgress(data)
Fires on a twitch pubsub event
Parameters:
| Name |
Type |
Description |
data |
object
|
|
- Source:
-
onChannelPredictionBegin(data)
Fires on a twitch pubsub event
Parameters:
| Name |
Type |
Description |
data |
object
|
|
- Source:
-
onChannelPredictionEnd(data)
Fires on a twitch pubsub event
Parameters:
| Name |
Type |
Description |
data |
object
|
|
- Source:
-
onChannelPredictionLock(data)
Fires on a twitch pubsub event
Parameters:
| Name |
Type |
Description |
data |
object
|
|
- Source:
-
onChannelPredictionProgress(data)
Fires on a twitch pubsub event
Parameters:
| Name |
Type |
Description |
data |
object
|
|
- Source:
-
onChannelRaidFrom(data)
Fires on a twitch pubsub event
Parameters:
| Name |
Type |
Description |
data |
object
|
|
- Source:
-
onChannelRaidTo(data)
Fires on a twitch pubsub event
Parameters:
| Name |
Type |
Description |
data |
object
|
|
- Source:
-
onChannelRedemptionAdd(data)
Fires on a twitch pubsub event
Parameters:
| Name |
Type |
Description |
data |
object
|
|
- Source:
-
onChannelRedemptionUpdate(data)
Fires on a twitch pubsub event
Parameters:
| Name |
Type |
Description |
data |
object
|
|
- Source:
-
onChannelRewardAdd(data)
Fires on a twitch pubsub event
Parameters:
| Name |
Type |
Description |
data |
object
|
|
- Source:
-
onChannelRewardRemove(data)
Fires on a twitch pubsub event
Parameters:
| Name |
Type |
Description |
data |
object
|
|
- Source:
-
onChannelRewardUpdate(data)
Fires on a twitch pubsub event
Parameters:
| Name |
Type |
Description |
data |
object
|
|
- Source:
-
onChannelShieldModeBegin(data)
Fires on a twitch pubsub event
Parameters:
| Name |
Type |
Description |
data |
object
|
|
- Source:
-
onChannelShieldModeEnd(data)
Fires on a twitch pubsub event
Parameters:
| Name |
Type |
Description |
data |
object
|
|
- Source:
-
onChannelShoutoutCreate(data)
Fires on a twitch pubsub event
Parameters:
| Name |
Type |
Description |
data |
object
|
|
- Source:
-
onChannelShoutoutReceive(data)
Fires on a twitch pubsub event
Parameters:
| Name |
Type |
Description |
data |
object
|
|
- Source:
-
onChannelSubscription(data)
Fires on a twitch pubsub event
Parameters:
| Name |
Type |
Description |
data |
object
|
|
- Source:
-
onChannelSubscriptionEnd(data)
Fires on a twitch pubsub event
Parameters:
| Name |
Type |
Description |
data |
object
|
|
- Source:
-
onChannelSubscriptionGift(data)
Fires on a twitch pubsub event
Parameters:
| Name |
Type |
Description |
data |
object
|
|
- Source:
-
onChannelSubscriptionMessage(data)
Fires on a twitch pubsub event
Parameters:
| Name |
Type |
Description |
data |
object
|
|
- Source:
-
onChannelUnban(data)
Fires on a twitch pubsub event
Parameters:
| Name |
Type |
Description |
data |
object
|
|
- Source:
-
(async) onChannelUpdate(data)
Fires on a twitch pubsub event
Parameters:
| Name |
Type |
Description |
data |
object
|
|
- Source:
-
onDataCenterConnect(socket)
called on StreamRoller websocket connect
Parameters:
| Name |
Type |
Description |
socket |
object
|
|
- Source:
-
onDataCenterDisconnect(reason)
called on StreamRoller websocket disconnect
Parameters:
| Name |
Type |
Description |
reason |
string
|
|
- Source:
-
onDataCenterMessage(server_packet)
Called when we receive a StreamRoller message
Parameters:
| Name |
Type |
Description |
server_packet |
object
|
|
- Source:
-
onStreamOffline(data)
Fires on a twitch pubsub event
Parameters:
| Name |
Type |
Description |
data |
object
|
|
- Source:
-
onStreamOnline(data)
Fires on a twitch pubsub event
Parameters:
| Name |
Type |
Description |
data |
object
|
|
- Source:
-
postStartupActions()
At this point we should have any config/credentials loaded
- Source:
-
pubSubTriggerCallback(trigger)
Callback for all triggers used in the twitch pubsub.
gets called whenever the pubsub module needs to create a trigger
Parameters:
| Name |
Type |
Description |
trigger |
object
|
|
- Source:
-
(async) raidChannel(username)
sends trigger_TwitchGamedChanged
Parameters:
| Name |
Type |
Description |
username |
string
|
ref id from action
|
- Source:
-
registerSubs(streamerId)
register all subs for the given streamerId stream
Parameters:
| Name |
Type |
Description |
streamerId |
string
|
|
- Source:
-
(async) removeMod(username)
Remove mod status from username
Parameters:
| Name |
Type |
Description |
username |
string
|
|
- Source:
-
(async) removePrediction(data)
Delete prediction
Parameters:
| Name |
Type |
Description |
data |
object
|
|
- Source:
-
removeSubs()
remove all sub events
- Source:
-
(async) removeVIP(username)
Remove VIP status from user
Parameters:
| Name |
Type |
Description |
username |
string
|
|
- Source:
-
(async) resolvePrediction(data)
Resolves the current prediction with the given data
Parameters:
| Name |
Type |
Description |
data |
object
|
|
- Source:
-
sendGameCategoriesTrigger(idopt)
sends trigger_TwitchGameCategories containing all games in our category
Parameters:
| Name |
Type |
Attributes |
Default |
Description |
id |
number
|
<optional>
|
"twitch"
|
ref id from action
|
- Source:
-
sendTrigger(trigger)
sends out the given trigger
Parameters:
| Name |
Type |
Description |
trigger |
object
|
|
- Source:
-
sendTrigger(trigger)
Sends the given trigger out on our channel
Parameters:
| Name |
Type |
Description |
trigger |
object
|
|
- Source:
-
sendTwitchChatCredentials(name, oauth, bot)
updates the twitch chat extension with credentials
Parameters:
| Name |
Type |
Default |
Description |
name |
string
|
|
|
oauth |
string
|
|
|
bot |
string
|
false
|
|
- Source:
-
sendTwitchStats(triggerIdopt)
sends trigger_TwitchGamedChanged
Parameters:
| Name |
Type |
Attributes |
Default |
Description |
triggerId |
number
|
<optional>
|
"twitch"
|
ref id from action
|
- Source:
-
(async) setStreamGame(gameId)
Sets the current game/category in twitch
Parameters:
| Name |
Type |
Description |
gameId |
number
|
|
- Source:
-
(async) setStreamTitle(title)
Sets the current stream title
Parameters:
| Name |
Type |
Description |
title |
string
|
|
- Source:
-
start(host, port, nonce, clientId, heartbeat)
Starts the extension using the given data.
Parameters:
| Name |
Type |
Description |
host |
string
|
|
port |
number
|
|
nonce |
number
|
|
clientId |
number
|
|
heartbeat |
number
|
|
- Source:
-
(async) startCommercial(length)
Start a add/commercial running on twitch
Parameters:
| Name |
Type |
Description |
length |
number
|
["30", "60", "90", "120", "150", "180"]
|
- Source:
-
(async) startEventSub(streamerId, apiClient, channelData)
Starts event pub subs registration
Parameters:
| Name |
Type |
Description |
streamerId |
string
|
|
apiClient |
object
|
|
channelData |
object
|
|
- Source:
-
(async) startPrediction(data)
Starts a prediction
Parameters:
| Name |
Type |
Description |
data |
object
|
|
- Source:
-
startupCheck()
waits for config and credentials files to set ready flag
- Source:
-
(async) unbanUser(username, reason)
Unban username for give reason
Parameters:
| Name |
Type |
Description |
username |
string
|
|
reason |
string
|
|
- Source:
-