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
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
OnChatCommandReceived
This event is fired when a command message starting with the command identifier is received
public TwitchChat.ChatCommandReceivedEvent OnChatCommandReceived
Field Value
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
OnChatDisconnected
This event is fired when the connection to the chat has been interrupted
public TwitchChat.ChatDisconnectedEvent OnChatDisconnected
Field Value
OnChatMessageReceived
This event is fired when a normal message (without the command identifier) is received
public TwitchChat.ChatMessageReceivedEvent OnChatMessageReceived
Field Value
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
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
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
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
OnWhisperMessageReceived
This event is fired when a normal message (without the command identifier) is received as a WHISPER
public TwitchChat.ChatMessageReceivedEvent OnWhisperMessageReceived
Field Value
twitchIRCHost
The host name to connect to
public string twitchIRCHost
Field Value
twitchIRCPort
The port of twitch's irc
public int twitchIRCPort
Field Value
twitchIRCWebSocket
The WebSocket to connect to in WebGL Mode
public string twitchIRCWebSocket
Field Value
Properties
IsReceivingCommands
Did the twitch chat recognize our commands request?
public bool IsReceivingCommands { get; }
Property Value
IsTagsEnabled
Did the twitch chat recognize our tags request?
public bool IsTagsEnabled { get; }
Property Value
Methods
Connect(string, string)
Connects to the Twitch Chat using the credentials provided
public void Connect(string botUserName, string botOAuthToken)
Parameters
botUserName
stringThe Twitch user, the bot should login with
botOAuthToken
stringA 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
stringThe Twitch user, the bot should login with
botOAuthToken
stringA valid OAuth-Token fo the bot - starting with "oauth:"
channelName
stringThe 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
stringThe Twitch user, the bot should login with
botOAuthToken
stringA valid OAuth-Token fo the bot - starting with "oauth:"
channelName
stringThe name of the channel to join (optional, defaults to the bots own channel)
commandIdentifier
stringThe identifier for commands (optional, default "!")
IsConnected()
Tells, if the library is connected to twitch chat
public bool IsConnected()
Returns
JoinChannel(string)
Joins an additional channel
public void JoinChannel(string channelName)
Parameters
channelName
stringThe 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
stringThe chat message to send
SendMessageToChannel(string, string)
Sends a message to a channel
public void SendMessageToChannel(string targetChannel, string chatMessageText)