TwitchChatEmitter

TwitchChatEmitter

TwitchChatEmitter The Twitch chat implementation, based on the already existing module tmi.js (tmijs.org), adding more features and handlers to chat interation.

Constructor

new TwitchChatEmitter(config)

Source:
Parameters:
Name Type Description
config object

The config object

Name Type Description
debug boolean

Debug mode. If true, will show the debug messages.

logger object

The logger instance. If empty, the default logger will be used.

channels Array.<string>

The twitch channels that will be used. This is required.

username string

The chat bot username. This is required.

password string

The chat bot OAUTH token password. You can get it at http://twitchapps.com/tmi/ . This is required.

reconnect boolean

Reconnect to Twitch when disconnected from server. Default: false

maxReconnectAttempts number

Max number of reconnection attempts (Default: Infinity)

maxReconnectInterval number

Max number of ms to delay a reconnection (Default: 30000)

reconnectDecay number

The rate of increase of the reconnect delay (Default: 1.5)

reconnectInterval number

Number of ms before attempting to reconnect (Default: 1000)

secure boolean

Use secure connection (SSL / HTTPS) (Overrides port to 443)

timeout number

Number of ms to disconnect if no responses from server (Default: 9999)

commandPrefix string

The prefix caracter for chat command. Default is "!".

triggers Array.<object>

The triggers object array.

Name Type Description
name string

The name of the trigger. This is required.

type string

The type of the trigger. Can be one 'word' or 'command'. This is required

channel string

The channel in which the trigger will be used. This is required.

chatTrigger boolean

Define if its a chat trigger. (Default: true)

whisperTrigger boolean

Define if its a whisper trigger. (Default: false)

minDelay number

The delay before the action is triggered again. (Default: 0)

eventName string

The name of the event that will be triggered. If this is empty, no event will be emitted.

responseText string

The text that will be sent to chat/whisper if the action is triggered. If this is empty, nothing will be sent.

timedMessages Array.<object>

The timed messages array.

Name Type Description
message string

The message to be sent.

channel string

The channel in which the timed message will be sent. This is required.

timedMessages[].minDelay number

The minimum delay, in seconds, between this kind of message. This is required.

timedMessages[].minChatMessages number

The minimum ammount of messages in chat to send this message.

Methods

connect()

Connect to the chat.

Source:

Events

Chat:chat_parsed

The chat message parsed to html, with twitch emotes.

Source:
Parameters:
Name Type Description
channel string

The channel in which the command was sent.

userstate object

The userstate object.

message string

The parsed message.

self bool

Whether the command was sent to the user bot or not.