Table of Contents

Class TwitchChat

Namespace
Firesplash.UnityAssets.TwitchIntegration.Skeletons
Assembly
Firesplash.UnityAssets.TwitchIntegration.dll

This class provides access to the chat features

public class TwitchChat
Inheritance
TwitchChat
Derived
Inherited Members

Fields

DebugMode

Setting this to true will cause detailed log output. It's made for development only.

public bool DebugMode

Field Value

bool

OnChatCleared

This event fires when the chat is eighter completely cleared or a user is cleared out. First parameter is the channel, second is the user's login name or null if it's a complete clear.

public TwitchChat.ChatClearedEvent OnChatCleared

Field Value

TwitchChat.ChatClearedEvent

OnChatCommandReceived

This event is fired when a command message starting with the command identifier is received

public TwitchChat.ChatCommandReceivedEvent OnChatCommandReceived

Field Value

TwitchChat.ChatCommandReceivedEvent

OnChatConnected

This event is fired when the connection has been established and the bot is authenticated (ready to send messages)

public TwitchChat.ChatConnectedEvent OnChatConnected

Field Value

TwitchChat.ChatConnectedEvent

OnChatDisconnected

This event is fired when the connection to the chat has been interrupted

public TwitchChat.ChatDisconnectedEvent OnChatDisconnected

Field Value

TwitchChat.ChatDisconnectedEvent

OnChatMessageReceived

This event is fired when a normal message (without the command identifier) is received

public TwitchChat.ChatMessageReceivedEvent OnChatMessageReceived

Field Value

TwitchChat.ChatMessageReceivedEvent

OnChatReceivedUnknownMessage

To be able to implement unsupported things, this event fires, when we receive a string from the IRC which is not supported natively by this library

public TwitchChat.ChatReceivedUnknownMessageEvent OnChatReceivedUnknownMessage

Field Value

TwitchChat.ChatReceivedUnknownMessageEvent

OnIncomingHost

This Event is fired when another channel hosts a channel we listen to This event is the clean implementation of twitch's hosting notifications BUT it does not always fire for any host. For example zero viewer hosts often get dropped. This is an issue on twitch's side. You can use OnIncomingHostInformation to get an event for every host event but this does not provide us with technical data like tags and badges or viewer count.

public TwitchChat.OnIncomingViewersEvent OnIncomingHost

Field Value

TwitchChat.OnIncomingViewersEvent

OnIncomingHostInformation

This Event is fired when twitch informs about an incoming host. The difference to OnIncomingHost is, that this event is fired for ANY incoming host but has no technical data. The only thing we know is the DISPLAY name of the hosting channel. This event does send a string to the callback method containing the hosting channel's DISPLAY name

public UnityEvent<string> OnIncomingHostInformation

Field Value

UnityEvent<string>

OnIncomingRaid

This Event is fired when another channel raids a channel we listen to

public TwitchChat.OnIncomingViewersEvent OnIncomingRaid

Field Value

TwitchChat.OnIncomingViewersEvent

OnWhisperCommandReceived

This event is fired when a command message starting with the command identifier is received as a WHISPER

public TwitchChat.ChatCommandReceivedEvent OnWhisperCommandReceived

Field Value

TwitchChat.ChatCommandReceivedEvent

OnWhisperMessageReceived

This event is fired when a normal message (without the command identifier) is received as a WHISPER

public TwitchChat.ChatMessageReceivedEvent OnWhisperMessageReceived

Field Value

TwitchChat.ChatMessageReceivedEvent

twitchIRCHost

The host name to connect to

public string twitchIRCHost

Field Value

string

twitchIRCPort

The port of twitch's irc

public int twitchIRCPort

Field Value

int

twitchIRCWebSocket

The WebSocket to connect to in WebGL Mode

public string twitchIRCWebSocket

Field Value

string

Properties

IsReceivingCommands

Did the twitch chat recognize our commands request?

public bool IsReceivingCommands { get; }

Property Value

bool

IsTagsEnabled

Did the twitch chat recognize our tags request?

public bool IsTagsEnabled { get; }

Property Value

bool

Methods

Connect(string, string)

Connects to the Twitch Chat using the credentials provided

public void Connect(string botUserName, string botOAuthToken)

Parameters

botUserName string

The Twitch user, the bot should login with

botOAuthToken string

A valid OAuth-Token fo the bot - starting with "oauth:"

Connect(string, string, string)

Connects to the Twitch Chat using the credentials provided

public void Connect(string botUserName, string botOAuthToken, string channelName)

Parameters

botUserName string

The Twitch user, the bot should login with

botOAuthToken string

A valid OAuth-Token fo the bot - starting with "oauth:"

channelName string

The name of the channel to join (optional, defaults to the bots own channel)

Connect(string, string, string, string)

Connects to the Twitch Chat using the credentials provided

public void Connect(string botUserName, string botOAuthToken, string channelName, string commandIdentifier)

Parameters

botUserName string

The Twitch user, the bot should login with

botOAuthToken string

A valid OAuth-Token fo the bot - starting with "oauth:"

channelName string

The name of the channel to join (optional, defaults to the bots own channel)

commandIdentifier string

The identifier for commands (optional, default "!")

IsConnected()

Tells, if the library is connected to twitch chat

public bool IsConnected()

Returns

bool

JoinChannel(string)

Joins an additional channel

public void JoinChannel(string channelName)

Parameters

channelName string

The name of the channel to join

SendMessageToChannel(string)

Sends a message to the main chat channel (the one used as paremeter when connecting)

public void SendMessageToChannel(string chatMessageText)

Parameters

chatMessageText string

The chat message to send

SendMessageToChannel(string, string)

Sends a message to a channel

public void SendMessageToChannel(string targetChannel, string chatMessageText)

Parameters

targetChannel string

The channel to send a message into

chatMessageText string

The chat message to send to the channel