Provides functionality for the kick streaming service.
    
        
        
        
        
        
        
        
        
        
        
        
        
        
        - Source:
- 
            
        
Methods
    DeleteCredentialsOnServer(referenceopt)
Parameters:
    
        
            
            | Name | Type | Attributes | Default | Description | 
    
    
        
        
            
            | reference | String | <optional> 
 | "" |  | 
        
    
    
        
        
        
        
        
        
        
        
        
        
        
        
        
        - Source:
- 
            
        
    SaveConfigToServer(referenceopt)
    Sends our config to the server to be saved for next time we run
Parameters:
    
        
            
            | Name | Type | Attributes | Default | Description | 
    
    
        
        
            
            | reference | String | <optional> 
 | "" |  | 
        
    
    
        
        
        
        
        
        
        
        
        
        
        
        
        
        - Source:
- 
            
        
    SaveCredentialsToServer(referenceopt)
    Sends Credential to the server to be saved
Parameters:
    
        
            
            | Name | Type | Attributes | Default | Description | 
    
    
        
        
            
            | reference | String | <optional> 
 | "" |  | 
        
    
    
        
        
        
        
        
        
        
        
        
        
        
        
        
        - Source:
- 
            
        
Parameters:
    
        
            
            | Name | Type | Attributes | Default | Description | 
    
    
        
        
            
            | to | String | <optional> 
 | "" |  | 
        
        
            
            | reference | String | <optional> 
 | "" |  | 
        
    
    
        
        
        
        
        
        
        
        
        
        
        
        
        
        - Source:
- 
            
        
Parameters:
    
        
            
            | Name | Type | Attributes | Default | Description | 
    
    
        
        
            
            | to | String | <optional> 
 | "" | // extension name or send to channel if not provided | 
        
        
            
            | reference | String | <optional> 
 | "" |  | 
        
    
    
        
        
        
        
        
        
        
        
        
        
        
        
        
        - Source:
- 
            
        
    (async) addGameToHistoryFromGameName(gameName, referenceopt)
    Adds a game by name to the history list
Parameters:
    
        
            
            | Name | Type | Attributes | Default | Description | 
    
    
        
        
            
            | gameName | string |  |  |  | 
        
        
            
            | reference | String | <optional> 
 | "" |  | 
        
    
    
        
        
        
        
        
        
        
        
        
        
        
        
        
        - Source:
- 
            
        
    authorizedGet(path, forStreamer)
Parameters:
    
        
            
            | Name | Type | Default | Description | 
    
    
        
        
            
            | path | object |  |  | 
        
        
            
            | forStreamer | boolean | true |  | 
        
    
    
        
        
        
        
        
        
        
        
        
        
        
        
        
        - Source:
- 
            
        
Returns:
    Promise
    buildTokenPayload(refreshToken)
Parameters:
    
        
            
            | Name | Type | Description | 
    
    
        
        
            
            | refreshToken | string |  | 
        
    
    
        
        
        
        
        
        
        
        
        
        
        
        
        
        - Source:
- 
            
        
Returns:
    object
    checkForLiveStreams(referenceopt)
    schedules a check for users going live. might need to tweak the timeouts once working
Parameters:
    
        
            
            | Name | Type | Attributes | Default | Description | 
    
    
        
        
            
            | reference | String | <optional> 
 | "" |  | 
        
    
    
        
        
        
        
        
        
        
        
        
        
        
        
        
        - Source:
- 
            
        
    checkForLiveStreamsScheduler(id, referenceopt)
    checks if a user is live
Parameters:
    
        
            
            | Name | Type | Attributes | Default | Description | 
    
    
        
        
            
            | id | number |  |  |  | 
        
        
            
            | reference | String | <optional> 
 | "" |  | 
        
    
    
        
        
        
        
        
        
        
        
        
        
        
        
        
        - Source:
- 
            
        
    connectChat(chatroomId, userName, streamerName)
Parameters:
    
        
            
            | Name | Type | Description | 
    
    
        
        
            
            | chatroomId | string | // channel to subscribe to | 
        
        
            
            | userName | string | // user logged in name | 
        
        
            
            | streamerName | string | // name for the channel Name we are connecting to (normally the same unless using the app to read/view another channel) | 
        
    
    
        
        
        
        
        
        
        
        
        
        
        
        
        
        - Source:
- 
            
        
    (async) connectToChat(referenceopt)
Parameters:
    
        
            
            | Name | Type | Attributes | Default | Description | 
    
    
        
        
            
            | reference | String | <optional> 
 | "" |  | 
        
    
    
        
        
        
        
        
        
        
        
        
        
        
        
        
        - Source:
- 
            
        
    connectToChatScheduler(referenceopt)
Parameters:
    
        
            
            | Name | Type | Attributes | Default | Description | 
    
    
        
        
            
            | reference | String | <optional> 
 | "" |  | 
        
    
    
        
        
        
        
        
        
        
        
        
        
        
        
        
        - 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
    createDummyChatMessage(data, referenceopt)
    Simulates a message from kick chat.
Parameters:
    
        
            
            | Name | Type | Attributes | Default | Description | 
    
    
        
        
            
            | data | object |  |  |  | 
        
        
            
            | reference | String | <optional> 
 | "" |  | 
        
    
    
        
        
        
        
        
        
        
        
        
        
        
        
        
        - Source:
- 
            
        
    createDummyChatMessageFromMessage(data, referenceopt)
    Simulates a message from kick chat.
Parameters:
    
        
            
            | Name | Type | Attributes | Default | Description | 
    
    
        
        
            
            | data | string |  |  |  | 
        
        
            
            | reference | String | <optional> 
 | "" |  | 
        
    
    
        
        
        
        
        
        
        
        
        
        
        
        
        
        - Source:
- 
            
        
    disconnectChat()
    Disconnect socket
    
        
        
        
        
        
        
        
        
        
        
        
        
        
        - Source:
- 
            
        
    findTriggerByMessageType(messagetype, referenceopt) → {object}
    Finds a trigger from the messagetype
Parameters:
    
        
            
            | Name | Type | Attributes | Default | Description | 
    
    
        
        
            
            | messagetype | string |  |  |  | 
        
        
            
            | reference | String | <optional> 
 | "" |  | 
        
    
    
        
        
        
        
        
        
        
        
        
        
        
        
        
        - Source:
- 
            
        
Returns:
    trigger
    - 
        Type
    
- 
        
    object
    
    (async) getCategory(categoryId)
Parameters:
    
        
            
            | Name | Type | Description | 
    
    
        
        
            
            | categoryId | string |  | 
        
    
    
        
        
        
        
        
        
        
        
        
        
        
        
        
        - Source:
- 
            
        
Returns:
    Promise
    getChannel()
    
        
        
        
        
        
        
        
        
        
        
        
        
        
        - Source:
- 
            
        
Returns:
    Promise
    (async) getChannelData(username)
Parameters:
    
        
            
            | Name | Type | Description | 
    
    
        
        
            
            | username | string |  | 
        
    
    
        
        
        
        
        
        
        
        
        
        
        
        
        
        - Source:
- 
            
        
Returns:
    Promise
    getLivestream(userId)
Parameters:
    
        
            
            | Name | Type | Description | 
    
    
        
        
            
            | userId | string |  | 
        
    
    
        
        
        
        
        
        
        
        
        
        
        
        
        
        - Source:
- 
            
        
Returns:
    Promise
    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
    getUser(forStreamer)
Parameters:
    
        
            
            | Name | Type | Default | Description | 
    
    
        
        
            
            | forStreamer | boolean | true |  | 
        
    
    
        
        
        
        
        
        
        
        
        
        
        
        
        
        - Source:
- 
            
        
Returns:
    Promise
    handleClose(code, reason)
Parameters:
    
        
            
            | Name | Type | Description | 
    
    
        
        
            
            | code | string |  | 
        
        
            
            | reason | string |  | 
        
    
    
        
        
        
        
        
        
        
        
        
        
        
        
        
        - Source:
- 
            
        
    handleError(error)
Parameters:
    
        
            
            | Name | Type | Description | 
    
    
        
        
            
            | error | object |  | 
        
    
    
        
        
        
        
        
        
        
        
        
        
        
        
        
        - Source:
- 
            
        
    handleMessage(data)
Parameters:
    
        
            
            | Name | Type | Description | 
    
    
        
        
            
            | data | object |  | 
        
    
    
        
        
        
        
        
        
        
        
        
        
        
        
        
        - Source:
- 
            
        
    handleOpen()
    
        
        
        
        
        
        
        
        
        
        
        
        
        
        - Source:
- 
            
        
    heartBeatCallback()
    Provides a heartbeat message to inform other extensions of our status
    
        
        
        
        
        
        
        
        
        
        
        
        
        
        - Source:
- 
            
        
    init(onMessageCallback)
    initialise the chat system
Parameters:
    
        
            
            | Name | Type | Description | 
    
    
        
        
            
            | onMessageCallback | function |  | 
        
    
    
        
        
        
        
        
        
        
        
        
        
        
        
        
        - Source:
- 
            
        
    init(updateRefreshTokenFn)
Parameters:
    
        
            
            | Name | Type | Description | 
    
    
        
        
            
            | updateRefreshTokenFn | 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:
- 
            
        
    makeRequest(param)
Parameters:
    
        
            
            | Name | Type | Description | 
    
    
        
        
            
            | param | object | { hostname, path, method, headers, data } | 
        
    
    
        
        
        
        
        
        
        
        
        
        
        
        
        
        - Source:
- 
            
        
Returns:
    Promise
    onChatMessage(data)
Parameters:
    
        
            
            | Name | Type | Description | 
    
    
        
        
            
            | data | object |  | 
        
    
    
        
        
        
        
        
        
        
        
        
        
        
        
        
        - Source:
- 
            
        
    onDataCenterConnect(socket)
    Connection message handler
Parameters:
    
        
            
            | Name | Type | Description | 
    
    
        
        
            
            | socket | * |  | 
        
    
    
        
        
        
        
        
        
        
        
        
        
        
        
        
        - Source:
- 
            
        
    onDataCenterDisconnect(reason)
    Disconnection message sent from the server
Parameters:
    
        
            
            | Name | Type | Description | 
    
    
        
        
            
            | reason | String |  | 
        
    
    
        
        
        
        
        
        
        
        
        
        
        
        
        
        - Source:
- 
            
        
    (async) onDataCenterMessage(server_packet)
    receives message from the socket
Parameters:
    
        
            
            | Name | Type | Description | 
    
    
        
        
            
            | server_packet | data |  | 
        
    
    
        
        
        
        
        
        
        
        
        
        
        
        
        
        - Source:
- 
            
        
Parameters:
    
        
            
            | Name | Type | Attributes | Default | Description | 
    
    
        
        
            
            | data | object |  |  | // data from user submitted form | 
        
        
            
            | reference | String | <optional> 
 | "" |  | 
        
    
    
        
        
        
        
        
        
        
        
        
        
        
        
        
        - Source:
- 
            
        
Parameters:
    
        
            
            | Name | Type | Attributes | Default | Description | 
    
    
        
        
            
            | data | object |  |  | // data from user submitted form | 
        
        
            
            | reference | String | <optional> 
 | "" |  | 
        
    
    
        
        
        
        
        
        
        
        
        
        
        
        
        
        - Source:
- 
            
        
    postStartupActions()
    At this point we should have any config/credentials loaded
    
        
        
        
        
        
        
        
        
        
        
        
        
        
        - Source:
- 
            
        
    postTrigger(data)
    Posts a trigger out on our channel
Parameters:
    
        
            
            | Name | Type | Description | 
    
    
        
        
            
            | data | object |  | 
        
    
    
        
        
        
        
        
        
        
        
        
        
        
        
        
        - Source:
- 
            
        
    (async) refreshToken(forStreamer)
Parameters:
    
        
            
            | Name | Type | Default | Description | 
    
    
        
        
            
            | forStreamer | boolean | true |  | 
        
    
    
        
        
        
        
        
        
        
        
        
        
        
        
        
        - Source:
- 
            
        
    sanitiseHTML(string) → {string}
    Removes html chars from a string to avoid chat message html injection
Parameters:
    
        
            
            | Name | Type | Description | 
    
    
        
        
            
            | string | string |  | 
        
    
    
        
        
        
        
        
        
        
        
        
        
        
        
        
        - Source:
- 
            
        
Returns:
    the parsed string
    - 
        Type
    
- 
        
    string
    
    (async) searchCategories(categoryName)
Parameters:
    
        
            
            | Name | Type | Description | 
    
    
        
        
            
            | categoryName | string |  | 
        
    
    
        
        
        
        
        
        
        
        
        
        
        
        
        
        - Source:
- 
            
        
Returns:
    Promise
    sendAccountNames(toExtension, referenceopt)
Parameters:
    
        
            
            | Name | Type | Attributes | Default | Description | 
    
    
        
        
            
            | toExtension | String |  |  |  | 
        
        
            
            | reference | String | <optional> 
 | "" |  | 
        
    
    
        
        
        
        
        
        
        
        
        
        
        
        
        
        - Source:
- 
            
        
    sendCategoryTrigger(referenceopt)
Parameters:
    
        
            
            | Name | Type | Attributes | Default | Description | 
    
    
        
        
            
            | reference | String | <optional> 
 | "" |  | 
        
    
    
        
        
        
        
        
        
        
        
        
        
        
        
        
        - Source:
- 
            
        
    (async) sendChatMessage(messageData)
Parameters:
    
        
            
            | Name | Type | Description | 
    
    
        
        
            
            | messageData | * | {account, message, triggerActionRef} | 
        
    
    
        
        
        
        
        
        
        
        
        
        
        
        
        
        - Source:
- 
            
        
Returns:
    Promise
    sendGameCategoriesClearedTrigger(referenceopt)
Parameters:
    
        
            
            | Name | Type | Attributes | Default | Description | 
    
    
        
        
            
            | reference | String | <optional> 
 | "" |  | 
        
    
    
        
        
        
        
        
        
        
        
        
        
        
        
        
        - Source:
- 
            
        
    sendGameCategoriesSearchTrigger(reference, searchName, referenceopt)
Parameters:
    
        
            
            | Name | Type | Attributes | Default | Description | 
    
    
        
        
            
            | reference | string |  | Kick |  | 
        
        
            
            | searchName | string |  |  |  | 
        
        
            
            | reference | String | <optional> 
 | "" |  | 
        
    
    
        
        
        
        
        
        
        
        
        
        
        
        
        
        - Source:
- 
            
        
    sendTitleClearedTrigger(referenceopt)
Parameters:
    
        
            
            | Name | Type | Attributes | Default | Description | 
    
    
        
        
            
            | reference | String | <optional> 
 | "" |  | 
        
    
    
        
        
        
        
        
        
        
        
        
        
        
        
        
        - Source:
- 
            
        
    sendTitleTrigger(referenceopt)
Parameters:
    
        
            
            | Name | Type | Attributes | Default | Description | 
    
    
        
        
            
            | reference | String | <optional> 
 | "" |  | 
        
    
    
        
        
        
        
        
        
        
        
        
        
        
        
        
        - Source:
- 
            
        
    setClientSecrets(clientId, secret)
    called from main server app when credentials are received
Parameters:
    
        
            
            | Name | Type | Description | 
    
    
        
        
            
            | clientId | string |  | 
        
        
            
            | secret | string |  | 
        
    
    
        
        
        
        
        
        
        
        
        
        
        
        
        
        - Source:
- 
            
        
    setCredentials(creds)
Parameters:
    
        
            
            | Name | Type | Description | 
    
    
        
        
            
            | creds | object |  | 
        
    
    
        
        
        
        
        
        
        
        
        
        
        
        
        
        - Source:
- 
            
        
    (async) setTitleAndCategory(title, categoryId)
Parameters:
    
        
            
            | Name | Type | Description | 
    
    
        
        
            
            | title | string |  | 
        
        
            
            | categoryId | number |  | 
        
    
    
        
        
        
        
        
        
        
        
        
        
        
        
        
        - Source:
- 
            
        
Returns:
    Promise
    (async) setupUsers()
    
        
        
        
        
        
        
        
        
        
        
        
        
        
        - Source:
- 
            
        
    start(app, host, port, heartbeat)
Parameters:
    
        
            
            | Name | Type | Description | 
    
    
        
        
            
            | app | string |  | 
        
        
            
            | host | string |  | 
        
        
            
            | port | string |  | 
        
        
            
            | heartbeat | number |  | 
        
    
    
        
        
        
        
        
        
        
        
        
        
        
        
        
        - Source:
- 
            
        
    startupCheck()
    waits for config and credentials files to set ready flag
    
        
        
        
        
        
        
        
        
        
        
        
        
        
        - Source:
- 
            
        
    (async) updateCategoryTitleFromKick(referenceopt)
Parameters:
    
        
            
            | Name | Type | Attributes | Default | Description | 
    
    
        
        
            
            | reference | String | <optional> 
 | "" |  | 
        
    
    
        
        
        
        
        
        
        
        
        
        
        
        
        
        - Source:
- 
            
        
    updateRefreshToken(name, value, referenceopt)
    Store an updated refresh token
Parameters:
    
        
            
            | Name | Type | Attributes | Default | Description | 
    
    
        
        
            
            | name | string |  |  |  | 
        
        
            
            | value | string |  |  |  | 
        
        
            
            | reference | String | <optional> 
 | "" |  | 
        
    
    
        
        
        
        
        
        
        
        
        
        
        
        
        
        - Source:
- 
            
        
    updateRefreshTokenScheduler(referenceopt)
    Store an updated refresh token
Parameters:
    
        
            
            | Name | Type | Attributes | Default | Description | 
    
    
        
        
            
            | reference | String | <optional> 
 | "" |  | 
        
    
    
        
        
        
        
        
        
        
        
        
        
        
        
        
        - Source:
- 
            
        
    updateTokens(forStreamer, accessToken, refreshToken)
Parameters:
    
        
            
            | Name | Type | Description | 
    
    
        
        
            
            | forStreamer | boolean |  | 
        
        
            
            | accessToken | string |  | 
        
        
            
            | refreshToken | string |  | 
        
    
    
        
        
        
        
        
        
        
        
        
        
        
        
        
        - Source:
- 
            
        
    (async) withAuthRetry(fn, forStreamer)
Parameters:
    
        
            
            | Name | Type | Default | Description | 
    
    
        
        
            
            | fn | function |  |  | 
        
        
            
            | forStreamer | boolean | true |  | 
        
    
    
        
        
        
        
        
        
        
        
        
        
        
        
        
        - Source:
- 
            
        
Returns:
    object from function