TwitchLib 3.5.3
Loading...
Searching...
No Matches
TwitchLib.Client.TwitchClient Class Reference

Represents a client connected to a Twitch channel. Implements the TwitchLib.Client.Interfaces.ITwitchClient More...

Inheritance diagram for TwitchLib.Client.TwitchClient:
TwitchLib.Client.Interfaces.ITwitchClient

Public Member Functions

 TwitchClient (IClient client=null, ClientProtocol protocol=ClientProtocol.WebSocket, ILogger< TwitchClient > logger=null)
 Initializes the TwitchChatClient class. More...
 
void Initialize (ConnectionCredentials credentials, string channel=null, char chatCommandIdentifier='!', char whisperCommandIdentifier='!', bool autoReListenOnExceptions=true)
 Initializes the TwitchChatClient class. More...
 
void Initialize (ConnectionCredentials credentials, List< string > channels, char chatCommandIdentifier='!', char whisperCommandIdentifier='!', bool autoReListenOnExceptions=true)
 Initializes the TwitchChatClient class (with multiple channels). More...
 
void SendRaw (string message)
 Sends a RAW IRC message. More...
 
void SendMessage (JoinedChannel channel, string message, bool dryRun=false)
 Sends a formatted Twitch channel chat message. More...
 
void SendMessage (string channel, string message, bool dryRun=false)
 SendMessage wrapper that accepts channel in string form. More...
 
void SendReply (JoinedChannel channel, string replyToId, string message, bool dryRun=false)
 Sends a formatted Twitch chat message reply. More...
 
void SendReply (string channel, string replyToId, string message, bool dryRun=false)
 SendReply wrapper that accepts channel in string form. More...
 
void SendWhisper (string receiver, string message, bool dryRun=false)
 Sends a formatted whisper message to someone. More...
 
bool Connect ()
 Start connecting to the Twitch IRC chat. More...
 
void Disconnect ()
 Start disconnecting from the Twitch IRC chat. More...
 
void Reconnect ()
 Start reconnecting to the Twitch IRC chat. More...
 
void AddChatCommandIdentifier (char identifier)
 Adds a character to a list of characters that if found at the start of a message, fires command received event. More...
 
void RemoveChatCommandIdentifier (char identifier)
 Removes a character from a list of characters that if found at the start of a message, fires command received event. More...
 
void AddWhisperCommandIdentifier (char identifier)
 Adds a character to a list of characters that if found at the start of a whisper, fires command received event. More...
 
void RemoveWhisperCommandIdentifier (char identifier)
 Removes a character to a list of characters that if found at the start of a whisper, fires command received event. More...
 
void SetConnectionCredentials (ConnectionCredentials credentials)
 Sets the connection credentials. More...
 
void JoinChannel (string channel, bool overrideCheck=false)
 Join the Twitch IRC chat of channel . More...
 
JoinedChannel GetJoinedChannel (string channel)
 Returns a JoinedChannel object using a passed string/>. More...
 
void LeaveChannel (string channel)
 Leaves (PART) the Twitch IRC chat of channel . More...
 
void LeaveChannel (JoinedChannel channel)
 Leaves (PART) the Twitch IRC chat of channel . More...
 
void OnReadLineTest (string rawIrc)
 This method allows firing the message parser with a custom irc string allowing for easy testing More...
 
void SendQueuedItem (string message)
 Sends the queued item. More...
 
void Initialize (ConnectionCredentials credentials, string channel=null, char chatCommandIdentifier='!', char whisperCommandIdentifier='!', bool autoReListenOnExceptions=true)
 Initializes the specified credentials. More...
 
void Initialize (ConnectionCredentials credentials, List< string > channels, char chatCommandIdentifier='!', char whisperCommandIdentifier='!', bool autoReListenOnExceptions=true)
 Initializes the specified credentials. More...
 
void SetConnectionCredentials (ConnectionCredentials credentials)
 Sets the connection credentials. More...
 
void AddChatCommandIdentifier (char identifier)
 Adds the chat command identifier. More...
 
void AddWhisperCommandIdentifier (char identifier)
 Adds the whisper command identifier. More...
 
void RemoveChatCommandIdentifier (char identifier)
 Removes the chat command identifier. More...
 
void RemoveWhisperCommandIdentifier (char identifier)
 Removes the whisper command identifier. More...
 
bool Connect ()
 Connects this instance. More...
 
void Disconnect ()
 Disconnects this instance. More...
 
void Reconnect ()
 Reconnects this instance. More...
 
JoinedChannel GetJoinedChannel (string channel)
 Gets the joined channel. More...
 
void JoinChannel (string channel, bool overrideCheck=false)
 Joins the channel. More...
 
void LeaveChannel (JoinedChannel channel)
 Leaves the channel. More...
 
void LeaveChannel (string channel)
 Leaves the channel. More...
 
void OnReadLineTest (string rawIrc)
 Called when [read line test]. More...
 
void SendMessage (JoinedChannel channel, string message, bool dryRun=false)
 Sends the message. More...
 
void SendMessage (string channel, string message, bool dryRun=false)
 Sends the message. More...
 
void SendReply (JoinedChannel channel, string replyToId, string message, bool dryRun=false)
 Sends a formatted Twitch chat message reply. More...
 
void SendReply (string channel, string replyToId, string message, bool dryRun=false)
 SendReply wrapper that accepts channel in string form. More...
 
void SendQueuedItem (string message)
 Sends the queued item. More...
 
void SendRaw (string message)
 Sends the raw. More...
 
void SendWhisper (string receiver, string message, bool dryRun=false)
 Sends the whisper. More...
 

Static Protected Member Functions

static void HandleNotInitialized ()
 Handles the not initialized. More...
 
static void HandleNotConnected ()
 Handles the not connected. More...
 

Properties

Version Version [get]
 Assembly version of TwitchLib.Client. More...
 
bool IsInitialized [get]
 Checks if underlying client has been initialized. More...
 
IReadOnlyList< JoinedChannelJoinedChannels [get]
 A list of all channels the client is currently in. More...
 
string TwitchUsername [get]
 Username of the user connected via this library. More...
 
WhisperMessage PreviousWhisper [get]
 The most recent whisper received. More...
 
bool IsConnected [get]
 The current connection status of the client. More...
 
MessageEmoteCollection ChannelEmotes [get]
 The emotes this channel replaces. More...
 
bool DisableAutoPong = false [get, set]
 Will disable the client from sending automatic PONG responses to PING More...
 
bool WillReplaceEmotes = false [get, set]
 Determines whether Emotes will be replaced in messages. More...
 
ConnectionCredentials ConnectionCredentials [get]
 Provides access to connection credentials object. More...
 
bool AutoReListenOnException [get, set]
 Provides access to autorelistiononexception on off boolean. More...
 
- Properties inherited from TwitchLib.Client.Interfaces.ITwitchClient
bool AutoReListenOnException [get, set]
 Gets or sets a value indicating whether [automatic re listen on exception]. More...
 
MessageEmoteCollection ChannelEmotes [get]
 Gets the channel emotes. More...
 
ConnectionCredentials ConnectionCredentials [get]
 Gets the connection credentials. More...
 
bool DisableAutoPong [get, set]
 Gets or sets a value indicating whether [disable automatic pong]. More...
 
bool IsConnected [get]
 Gets a value indicating whether this instance is connected. More...
 
bool IsInitialized [get]
 Gets a value indicating whether this instance is initialized. More...
 
IReadOnlyList< JoinedChannelJoinedChannels [get]
 Gets the joined channels. More...
 
WhisperMessage PreviousWhisper [get]
 Gets the previous whisper. More...
 
string TwitchUsername [get]
 Gets the twitch username. More...
 
bool WillReplaceEmotes [get, set]
 Gets or sets a value indicating whether [will replace emotes]. More...
 

Events

EventHandler< OnAnnouncementArgsOnAnnouncement
 Fires when an Announcement is received More...
 
EventHandler< OnVIPsReceivedArgsOnVIPsReceived
 Fires when VIPs are received from chat More...
 
EventHandler< OnLogArgsOnLog
 Fires whenever a log write happens. More...
 
EventHandler< OnConnectedArgsOnConnected
 Fires when client connects to Twitch. More...
 
EventHandler< OnJoinedChannelArgsOnJoinedChannel
 Fires when client joins a channel. More...
 
EventHandler< OnIncorrectLoginArgsOnIncorrectLogin
 Fires on logging in with incorrect details, returns ErrorLoggingInException. More...
 
EventHandler< OnChannelStateChangedArgsOnChannelStateChanged
 Fires when connecting and channel state is changed, returns ChannelState. More...
 
EventHandler< OnUserStateChangedArgsOnUserStateChanged
 Fires when a user state is received, returns UserState. More...
 
EventHandler< OnMessageReceivedArgsOnMessageReceived
 Fires when a new chat message arrives, returns ChatMessage. More...
 
EventHandler< OnWhisperReceivedArgsOnWhisperReceived
 Fires when a new whisper arrives, returns WhisperMessage. More...
 
EventHandler< OnMessageSentArgsOnMessageSent
 Fires when a chat message is sent, returns username, channel and message. More...
 
EventHandler< OnWhisperSentArgsOnWhisperSent
 Fires when a whisper message is sent, returns username and message. More...
 
EventHandler< OnChatCommandReceivedArgsOnChatCommandReceived
 Fires when command (uses custom chat command identifier) is received, returns channel, command, ChatMessage, arguments as string, arguments as list. More...
 
EventHandler< OnWhisperCommandReceivedArgsOnWhisperCommandReceived
 Fires when command (uses custom whisper command identifier) is received, returns command, Whispermessage. More...
 
EventHandler< OnUserJoinedArgsOnUserJoined
 Fires when a new viewer/chatter joined the channel's chat room, returns username and channel. More...
 
EventHandler< OnModeratorJoinedArgsOnModeratorJoined
 Fires when a moderator joined the channel's chat room, returns username and channel. More...
 
EventHandler< OnModeratorLeftArgsOnModeratorLeft
 Fires when a moderator joins the channel's chat room, returns username and channel. More...
 
EventHandler< OnMessageClearedArgsOnMessageCleared
 Fires when a message gets deleted in chat. More...
 
EventHandler< OnNewSubscriberArgsOnNewSubscriber
 Fires when new subscriber is announced in chat, returns Subscriber. More...
 
EventHandler< OnReSubscriberArgsOnReSubscriber
 Fires when current subscriber renews subscription, returns ReSubscriber. More...
 
EventHandler< OnPrimePaidSubscriberArgsOnPrimePaidSubscriber
 Fires when a current Prime gaming subscriber converts to a paid subscription. More...
 
EventHandler< OnExistingUsersDetectedArgsOnExistingUsersDetected
 Fires when Twitch notifies client of existing users in chat. More...
 
EventHandler< OnUserLeftArgsOnUserLeft
 Fires when a PART message is received from Twitch regarding a particular viewer More...
 
EventHandler< OnDisconnectedEventArgs > OnDisconnected
 Fires when bot has disconnected. More...
 
EventHandler< OnConnectionErrorArgsOnConnectionError
 Forces when bot suffers connection error. More...
 
EventHandler< OnChatClearedArgsOnChatCleared
 Fires when a channel's chat is cleared. More...
 
EventHandler< OnUserTimedoutArgsOnUserTimedout
 Fires when a viewer gets timedout by any moderator. More...
 
EventHandler< OnLeftChannelArgsOnLeftChannel
 Fires when client successfully leaves a channel. More...
 
EventHandler< OnUserBannedArgsOnUserBanned
 Fires when a viewer gets banned by any moderator. More...
 
EventHandler< OnModeratorsReceivedArgsOnModeratorsReceived
 Fires when a list of moderators is received. More...
 
EventHandler< OnChatColorChangedArgsOnChatColorChanged
 Fires when confirmation of a chat color change request was received. More...
 
EventHandler< OnSendReceiveDataArgsOnSendReceiveData
 Fires when data is either received or sent. More...
 
EventHandler< OnRaidNotificationArgsOnRaidNotification
 Fires when a raid notification is detected in chat More...
 
EventHandler< OnGiftedSubscriptionArgsOnGiftedSubscription
 Fires when a subscription is gifted and announced in chat More...
 
EventHandler< OnCommunitySubscriptionArgsOnCommunitySubscription
 Fires when a community subscription is announced in chat More...
 
EventHandler< OnContinuedGiftedSubscriptionArgsOnContinuedGiftedSubscription
 
EventHandler< OnMessageThrottledEventArgs > OnMessageThrottled
 Fires when a Message has been throttled. More...
 
EventHandler< OnWhisperThrottledEventArgs > OnWhisperThrottled
 Fires when a Whisper has been throttled. More...
 
EventHandler< OnErrorEventArgs > OnError
 Occurs when an Error is thrown in the protocol client More...
 
EventHandler< OnReconnectedEventArgs > OnReconnected
 Occurs when a reconnection occurs. More...
 
EventHandler< OnRequiresVerifiedEmailArgsOnRequiresVerifiedEmail
 Occurs when chatting in a channel that requires a verified email without a verified email attached to the account. More...
 
EventHandler< OnRequiresVerifiedPhoneNumberArgsOnRequiresVerifiedPhoneNumber
 Occurs when chatting in a channel that requires a verified phone number without a verified phone number attached to the account. More...
 
EventHandler< OnRateLimitArgsOnRateLimit
 Occurs when send message rate limit has been applied to the client in a specific channel by Twitch More...
 
EventHandler< OnDuplicateArgsOnDuplicate
 Occurs when sending duplicate messages and user is not permitted to do so More...
 
EventHandler< OnBannedEmailAliasArgsOnBannedEmailAlias
 Occurs when chatting in a channel that the user is banned in bcs of an already banned alias with the same Email More...
 
EventHandler OnSelfRaidError
 Fires when TwitchClient attempts to host a channel it is in. More...
 
EventHandler OnNoPermissionError
 Fires when TwitchClient receives generic no permission error from Twitch. More...
 
EventHandler OnRaidedChannelIsMatureAudience
 Fires when newly raided channel is mature audience only. More...
 
EventHandler< OnFailureToReceiveJoinConfirmationArgsOnFailureToReceiveJoinConfirmation
 Fires when the client was unable to join a channel. More...
 
EventHandler< OnFollowersOnlyArgsOnFollowersOnly
 Fires when the client attempts to send a message to a channel in followers only mode, as a non-follower More...
 
EventHandler< OnSubsOnlyArgsOnSubsOnly
 Fires when the client attempts to send a message to a channel in subs only mode, as a non-sub More...
 
EventHandler< OnEmoteOnlyArgsOnEmoteOnly
 Fires when the client attempts to send a non-emote message to a channel in emotes only mode More...
 
EventHandler< OnSuspendedArgsOnSuspended
 Fires when the client attempts to send a message to a channel that has been suspended More...
 
EventHandler< OnBannedArgsOnBanned
 Fires when the client attempts to send a message to a channel they're banned in More...
 
EventHandler< OnSlowModeArgsOnSlowMode
 Fires when the client attempts to send a message in a channel with slow mode enabled, without cooldown expiring More...
 
EventHandler< OnR9kModeArgsOnR9kMode
 Fires when the client attempts to send a message in a channel with r9k mode enabled, and message was not permitted More...
 
EventHandler< OnUserIntroArgsOnUserIntro
 Fires when the client receives a PRIVMSG tagged as an user-intro More...
 
EventHandler< OnUnaccountedForArgsOnUnaccountedFor
 Fires when data is received from Twitch that is not able to be parsed. More...
 
- Events inherited from TwitchLib.Client.Interfaces.ITwitchClient
EventHandler< OnChannelStateChangedArgsOnChannelStateChanged
 Occurs when [on channel state changed]. More...
 
EventHandler< OnChatClearedArgsOnChatCleared
 Occurs when [on chat cleared]. More...
 
EventHandler< OnChatColorChangedArgsOnChatColorChanged
 Occurs when [on chat color changed]. More...
 
EventHandler< OnChatCommandReceivedArgsOnChatCommandReceived
 Occurs when [on chat command received]. More...
 
EventHandler< OnConnectedArgsOnConnected
 Occurs when [on connected]. More...
 
EventHandler< OnConnectionErrorArgsOnConnectionError
 Occurs when [on connection error]. More...
 
EventHandler< OnDisconnectedEventArgs > OnDisconnected
 Occurs when [on disconnected]. More...
 
EventHandler< OnExistingUsersDetectedArgsOnExistingUsersDetected
 Occurs when [on existing users detected]. More...
 
EventHandler< OnGiftedSubscriptionArgsOnGiftedSubscription
 Occurs when [on gifted subscription]. More...
 
EventHandler< OnIncorrectLoginArgsOnIncorrectLogin
 Occurs when [on incorrect login]. More...
 
EventHandler< OnJoinedChannelArgsOnJoinedChannel
 Occurs when [on joined channel]. More...
 
EventHandler< OnLeftChannelArgsOnLeftChannel
 Occurs when [on left channel]. More...
 
EventHandler< OnLogArgsOnLog
 Occurs when [on log]. More...
 
EventHandler< OnMessageReceivedArgsOnMessageReceived
 Occurs when [on message received]. More...
 
EventHandler< OnMessageSentArgsOnMessageSent
 Occurs when [on message sent]. More...
 
EventHandler< OnModeratorJoinedArgsOnModeratorJoined
 Occurs when [on moderator joined]. More...
 
EventHandler< OnModeratorLeftArgsOnModeratorLeft
 Occurs when [on moderator left]. More...
 
EventHandler< OnModeratorsReceivedArgsOnModeratorsReceived
 Occurs when [on moderators received]. More...
 
EventHandler< OnNewSubscriberArgsOnNewSubscriber
 Occurs when [on new subscriber]. More...
 
EventHandler< OnRaidNotificationArgsOnRaidNotification
 Occurs when [on raid notification]. More...
 
EventHandler< OnReSubscriberArgsOnReSubscriber
 Occurs when [on re subscriber]. More...
 
EventHandler< OnSendReceiveDataArgsOnSendReceiveData
 Occurs when [on send receive data]. More...
 
EventHandler< OnUserBannedArgsOnUserBanned
 Occurs when [on user banned]. More...
 
EventHandler< OnUserJoinedArgsOnUserJoined
 Occurs when [on user joined]. More...
 
EventHandler< OnUserLeftArgsOnUserLeft
 Occurs when [on user left]. More...
 
EventHandler< OnUserStateChangedArgsOnUserStateChanged
 Occurs when [on user state changed]. More...
 
EventHandler< OnUserTimedoutArgsOnUserTimedout
 Occurs when [on user timedout]. More...
 
EventHandler< OnWhisperCommandReceivedArgsOnWhisperCommandReceived
 Occurs when [on whisper command received]. More...
 
EventHandler< OnWhisperReceivedArgsOnWhisperReceived
 Occurs when [on whisper received]. More...
 
EventHandler< OnWhisperSentArgsOnWhisperSent
 Occurs when [on whisper sent]. More...
 
EventHandler< OnMessageThrottledEventArgs > OnMessageThrottled
 Occurs when [on message throttled]. More...
 
EventHandler< OnWhisperThrottledEventArgs > OnWhisperThrottled
 Occurs when [on whisper throttled]. More...
 
EventHandler< OnErrorEventArgs > OnError
 Occurs when [on error]. More...
 
EventHandler< OnReconnectedEventArgs > OnReconnected
 Occurs when [on reconnected]. More...
 
EventHandler< OnVIPsReceivedArgsOnVIPsReceived
 Occurs when [on vip received]. More...
 
EventHandler< OnCommunitySubscriptionArgsOnCommunitySubscription
 Occurs when [on community subscription announcement received]. More...
 
EventHandler< OnMessageClearedArgsOnMessageCleared
 Occurs when [on message deleted]. More...
 
EventHandler< OnRequiresVerifiedEmailArgsOnRequiresVerifiedEmail
 Occurs when chatting in a channel that requires a verified email without a verified email attached to the account. More...
 
EventHandler< OnRequiresVerifiedPhoneNumberArgsOnRequiresVerifiedPhoneNumber
 Occurs when chatting in a channel that requires a verified phone number without a verified phone number attached to the account. More...
 
EventHandler< OnBannedEmailAliasArgsOnBannedEmailAlias
 Occurs when chatting in a channel that the user is banned in bcs of an already banned alias with the same Email More...
 
EventHandler< OnUserIntroArgsOnUserIntro
 Fires when the client receives a PRIVMSG tagged as an user-intro More...
 
EventHandler< OnAnnouncementArgsOnAnnouncement
 Fires when the client receives a USERNOTICE tagged as an announcement More...
 

Detailed Description

Represents a client connected to a Twitch channel. Implements the TwitchLib.Client.Interfaces.ITwitchClient

See also
TwitchLib.Client.Interfaces.ITwitchClient

Constructor & Destructor Documentation

◆ TwitchClient()

TwitchLib.Client.TwitchClient.TwitchClient ( IClient  client = null,
ClientProtocol  protocol = ClientProtocol.WebSocket,
ILogger< TwitchClient logger = null 
)

Initializes the TwitchChatClient class.

Parameters
clientProtocol Client to use for connection from TwitchLib.Communication. Possible Options Are the TcpClient client or WebSocket client.
protocolThe protocol.
loggerOptional ILogger instance to enable logging

Member Function Documentation

◆ AddChatCommandIdentifier()

void TwitchLib.Client.TwitchClient.AddChatCommandIdentifier ( char  identifier)

Adds a character to a list of characters that if found at the start of a message, fires command received event.

Parameters
identifierCharacter, that if found at start of message, fires command received event.

Implements TwitchLib.Client.Interfaces.ITwitchClient.

◆ AddWhisperCommandIdentifier()

void TwitchLib.Client.TwitchClient.AddWhisperCommandIdentifier ( char  identifier)

Adds a character to a list of characters that if found at the start of a whisper, fires command received event.

Parameters
identifierCharacter, that if found at start of message, fires command received event.

Implements TwitchLib.Client.Interfaces.ITwitchClient.

◆ Connect()

bool TwitchLib.Client.TwitchClient.Connect ( )

Start connecting to the Twitch IRC chat.

Returns
bool representing Connect() result

Implements TwitchLib.Client.Interfaces.ITwitchClient.

◆ Disconnect()

void TwitchLib.Client.TwitchClient.Disconnect ( )

Start disconnecting from the Twitch IRC chat.

Implements TwitchLib.Client.Interfaces.ITwitchClient.

◆ GetJoinedChannel()

JoinedChannel TwitchLib.Client.TwitchClient.GetJoinedChannel ( string  channel)

Returns a JoinedChannel object using a passed string/>.

Parameters
channelString channel to search for.
Returns
JoinedChannel.
Exceptions
TwitchLib.Client.Exceptions.BadStateExceptionMust be connected to at least one channel.

Implements TwitchLib.Client.Interfaces.ITwitchClient.

◆ HandleNotConnected()

static void TwitchLib.Client.TwitchClient.HandleNotConnected ( )
staticprotected

Handles the not connected.

Exceptions
TwitchLib.Client.Exceptions.ClientNotConnectedExceptionIn order to perform this action, the client must be connected to Twitch. To confirm connection, try performing this action in or after the OnConnected event has been fired.

◆ HandleNotInitialized()

static void TwitchLib.Client.TwitchClient.HandleNotInitialized ( )
staticprotected

Handles the not initialized.

Exceptions
TwitchLib.Client.Exceptions.ClientNotInitializedExceptionThe twitch client has not been initialized and cannot be used. Please call Initialize();

◆ Initialize() [1/2]

void TwitchLib.Client.TwitchClient.Initialize ( ConnectionCredentials  credentials,
List< string >  channels,
char  chatCommandIdentifier = '!',
char  whisperCommandIdentifier = '!',
bool  autoReListenOnExceptions = true 
)

Initializes the TwitchChatClient class (with multiple channels).

Parameters
credentialsThe credentials to use to log in.
channelsList of channels to join when connected
chatCommandIdentifierThe identifier to be used for reading and writing commands from chat.
whisperCommandIdentifierThe identifier to be used for reading and writing commands from whispers.
autoReListenOnExceptionsBy default, TwitchClient will silence exceptions and auto-relisten for overall stability. For debugging, you may wish to have the exception bubble up, set this to false.

Implements TwitchLib.Client.Interfaces.ITwitchClient.

◆ Initialize() [2/2]

void TwitchLib.Client.TwitchClient.Initialize ( ConnectionCredentials  credentials,
string  channel = null,
char  chatCommandIdentifier = '!',
char  whisperCommandIdentifier = '!',
bool  autoReListenOnExceptions = true 
)

Initializes the TwitchChatClient class.

Parameters
credentialsThe credentials to use to log in.
channelThe channel to connect to.
chatCommandIdentifierThe identifier to be used for reading and writing commands from chat.
whisperCommandIdentifierThe identifier to be used for reading and writing commands from whispers.
autoReListenOnExceptionsBy default, TwitchClient will silence exceptions and auto-relisten for overall stability. For debugging, you may wish to have the exception bubble up, set this to false.

Implements TwitchLib.Client.Interfaces.ITwitchClient.

◆ JoinChannel()

void TwitchLib.Client.TwitchClient.JoinChannel ( string  channel,
bool  overrideCheck = false 
)

Join the Twitch IRC chat of channel .

Parameters
channelThe channel to join.
overrideCheckOverride a join check.

Implements TwitchLib.Client.Interfaces.ITwitchClient.

◆ LeaveChannel() [1/2]

void TwitchLib.Client.TwitchClient.LeaveChannel ( JoinedChannel  channel)

Leaves (PART) the Twitch IRC chat of channel .

Parameters
channelThe JoinedChannel object to leave.
Returns
True is returned if the passed channel was found, false if channel not found.

Implements TwitchLib.Client.Interfaces.ITwitchClient.

◆ LeaveChannel() [2/2]

void TwitchLib.Client.TwitchClient.LeaveChannel ( string  channel)

Leaves (PART) the Twitch IRC chat of channel .

Parameters
channelThe channel to leave.
Returns
True is returned if the passed channel was found, false if channel not found.

Implements TwitchLib.Client.Interfaces.ITwitchClient.

◆ OnReadLineTest()

void TwitchLib.Client.TwitchClient.OnReadLineTest ( string  rawIrc)

This method allows firing the message parser with a custom irc string allowing for easy testing

Parameters
rawIrcThis should be a raw IRC message resembling one received from Twitch IRC.

Implements TwitchLib.Client.Interfaces.ITwitchClient.

◆ Reconnect()

void TwitchLib.Client.TwitchClient.Reconnect ( )

Start reconnecting to the Twitch IRC chat.

Implements TwitchLib.Client.Interfaces.ITwitchClient.

◆ RemoveChatCommandIdentifier()

void TwitchLib.Client.TwitchClient.RemoveChatCommandIdentifier ( char  identifier)

Removes a character from a list of characters that if found at the start of a message, fires command received event.

Parameters
identifierCommand identifier to removed from identifier list.

Implements TwitchLib.Client.Interfaces.ITwitchClient.

◆ RemoveWhisperCommandIdentifier()

void TwitchLib.Client.TwitchClient.RemoveWhisperCommandIdentifier ( char  identifier)

Removes a character to a list of characters that if found at the start of a whisper, fires command received event.

Parameters
identifierCommand identifier to removed from identifier list.

Implements TwitchLib.Client.Interfaces.ITwitchClient.

◆ SendMessage() [1/2]

void TwitchLib.Client.TwitchClient.SendMessage ( JoinedChannel  channel,
string  message,
bool  dryRun = false 
)

Sends a formatted Twitch channel chat message.

Parameters
channelChannel to send message to.
messageThe message to be sent.
dryRunIf set to true, the message will not actually be sent for testing purposes.

Implements TwitchLib.Client.Interfaces.ITwitchClient.

◆ SendMessage() [2/2]

void TwitchLib.Client.TwitchClient.SendMessage ( string  channel,
string  message,
bool  dryRun = false 
)

SendMessage wrapper that accepts channel in string form.

Parameters
channelThe channel.
messageThe message.
dryRunif set to true [dry run].

Implements TwitchLib.Client.Interfaces.ITwitchClient.

◆ SendQueuedItem()

void TwitchLib.Client.TwitchClient.SendQueuedItem ( string  message)

Sends the queued item.

Parameters
messageThe message.

Implements TwitchLib.Client.Interfaces.ITwitchClient.

◆ SendRaw()

void TwitchLib.Client.TwitchClient.SendRaw ( string  message)

Sends a RAW IRC message.

Parameters
messageThe RAW message to be sent.

Implements TwitchLib.Client.Interfaces.ITwitchClient.

◆ SendReply() [1/2]

void TwitchLib.Client.TwitchClient.SendReply ( JoinedChannel  channel,
string  replyToId,
string  message,
bool  dryRun = false 
)

Sends a formatted Twitch chat message reply.

Parameters
channelChannel to send Twitch chat reply to
replyToIdThe message id that is being replied to
messageReply contents
dryRunif set to true [dry run]

Implements TwitchLib.Client.Interfaces.ITwitchClient.

◆ SendReply() [2/2]

void TwitchLib.Client.TwitchClient.SendReply ( string  channel,
string  replyToId,
string  message,
bool  dryRun = false 
)

SendReply wrapper that accepts channel in string form.

Parameters
channelChannel to send Twitch chat reply to
replyToIdThe message id that is being replied to
messageReply contents
dryRunif set to true [dry run]

Implements TwitchLib.Client.Interfaces.ITwitchClient.

◆ SendWhisper()

void TwitchLib.Client.TwitchClient.SendWhisper ( string  receiver,
string  message,
bool  dryRun = false 
)

Sends a formatted whisper message to someone.

Parameters
receiverThe receiver of the whisper.
messageThe message to be sent.
dryRunIf set to true, the message will not actually be sent for testing purposes.

Implements TwitchLib.Client.Interfaces.ITwitchClient.

◆ SetConnectionCredentials()

void TwitchLib.Client.TwitchClient.SetConnectionCredentials ( ConnectionCredentials  credentials)

Sets the connection credentials.

Parameters
credentialsThe credentials.
Exceptions
TwitchLib.Client.Exceptions.IllegalAssignmentExceptionWhile the client is connected, you are unable to change the connection credentials. Please disconnect first and then change them.

Implements TwitchLib.Client.Interfaces.ITwitchClient.

Property Documentation

◆ AutoReListenOnException

bool TwitchLib.Client.TwitchClient.AutoReListenOnException
getset

Provides access to autorelistiononexception on off boolean.

true if [automatic re listen on exception]; otherwise, false.

Implements TwitchLib.Client.Interfaces.ITwitchClient.

◆ ChannelEmotes

MessageEmoteCollection TwitchLib.Client.TwitchClient.ChannelEmotes
get

The emotes this channel replaces.

The channel emotes.

Twitch-handled emotes are automatically added to this collection (which also accounts for managing user emote permissions such as sub-only emotes). Third-party emotes will have to be manually added according to the availability rules defined by the third-party.

Implements TwitchLib.Client.Interfaces.ITwitchClient.

◆ ConnectionCredentials

ConnectionCredentials TwitchLib.Client.TwitchClient.ConnectionCredentials
get

Provides access to connection credentials object.

The connection credentials.

Implements TwitchLib.Client.Interfaces.ITwitchClient.

◆ DisableAutoPong

bool TwitchLib.Client.TwitchClient.DisableAutoPong = false
getset

Will disable the client from sending automatic PONG responses to PING

true if [disable automatic pong]; otherwise, false.

Implements TwitchLib.Client.Interfaces.ITwitchClient.

◆ IsConnected

bool TwitchLib.Client.TwitchClient.IsConnected
get

The current connection status of the client.

true if this instance is connected; otherwise, false.

Implements TwitchLib.Client.Interfaces.ITwitchClient.

◆ IsInitialized

bool TwitchLib.Client.TwitchClient.IsInitialized
get

Checks if underlying client has been initialized.

true if this instance is initialized; otherwise, false.

Implements TwitchLib.Client.Interfaces.ITwitchClient.

◆ JoinedChannels

IReadOnlyList<JoinedChannel> TwitchLib.Client.TwitchClient.JoinedChannels
get

A list of all channels the client is currently in.

The joined channels.

Implements TwitchLib.Client.Interfaces.ITwitchClient.

◆ PreviousWhisper

WhisperMessage TwitchLib.Client.TwitchClient.PreviousWhisper
get

The most recent whisper received.

The previous whisper.

Implements TwitchLib.Client.Interfaces.ITwitchClient.

◆ TwitchUsername

string TwitchLib.Client.TwitchClient.TwitchUsername
get

Username of the user connected via this library.

The twitch username.

Implements TwitchLib.Client.Interfaces.ITwitchClient.

◆ Version

Version TwitchLib.Client.TwitchClient.Version
get

Assembly version of TwitchLib.Client.

The version.

◆ WillReplaceEmotes

bool TwitchLib.Client.TwitchClient.WillReplaceEmotes = false
getset

Determines whether Emotes will be replaced in messages.

true if [will replace emotes]; otherwise, false.

Implements TwitchLib.Client.Interfaces.ITwitchClient.

Event Documentation

◆ OnAnnouncement

EventHandler<OnAnnouncementArgs> TwitchLib.Client.TwitchClient.OnAnnouncement

Fires when an Announcement is received

◆ OnBanned

EventHandler<OnBannedArgs> TwitchLib.Client.TwitchClient.OnBanned

Fires when the client attempts to send a message to a channel they're banned in

◆ OnBannedEmailAlias

EventHandler<OnBannedEmailAliasArgs> TwitchLib.Client.TwitchClient.OnBannedEmailAlias

Occurs when chatting in a channel that the user is banned in bcs of an already banned alias with the same Email

◆ OnChannelStateChanged

EventHandler<OnChannelStateChangedArgs> TwitchLib.Client.TwitchClient.OnChannelStateChanged

Fires when connecting and channel state is changed, returns ChannelState.

◆ OnChatCleared

EventHandler<OnChatClearedArgs> TwitchLib.Client.TwitchClient.OnChatCleared

Fires when a channel's chat is cleared.

◆ OnChatColorChanged

EventHandler<OnChatColorChangedArgs> TwitchLib.Client.TwitchClient.OnChatColorChanged

Fires when confirmation of a chat color change request was received.

◆ OnChatCommandReceived

EventHandler<OnChatCommandReceivedArgs> TwitchLib.Client.TwitchClient.OnChatCommandReceived

Fires when command (uses custom chat command identifier) is received, returns channel, command, ChatMessage, arguments as string, arguments as list.

◆ OnCommunitySubscription

EventHandler<OnCommunitySubscriptionArgs> TwitchLib.Client.TwitchClient.OnCommunitySubscription

Fires when a community subscription is announced in chat

◆ OnConnected

EventHandler<OnConnectedArgs> TwitchLib.Client.TwitchClient.OnConnected

Fires when client connects to Twitch.

◆ OnConnectionError

EventHandler<OnConnectionErrorArgs> TwitchLib.Client.TwitchClient.OnConnectionError

Forces when bot suffers connection error.

◆ OnContinuedGiftedSubscription

EventHandler<OnContinuedGiftedSubscriptionArgs> TwitchLib.Client.TwitchClient.OnContinuedGiftedSubscription

◆ OnDisconnected

EventHandler<OnDisconnectedEventArgs> TwitchLib.Client.TwitchClient.OnDisconnected

Fires when bot has disconnected.

◆ OnDuplicate

EventHandler<OnDuplicateArgs> TwitchLib.Client.TwitchClient.OnDuplicate

Occurs when sending duplicate messages and user is not permitted to do so

◆ OnEmoteOnly

EventHandler<OnEmoteOnlyArgs> TwitchLib.Client.TwitchClient.OnEmoteOnly

Fires when the client attempts to send a non-emote message to a channel in emotes only mode

◆ OnError

EventHandler<OnErrorEventArgs> TwitchLib.Client.TwitchClient.OnError

Occurs when an Error is thrown in the protocol client

◆ OnExistingUsersDetected

EventHandler<OnExistingUsersDetectedArgs> TwitchLib.Client.TwitchClient.OnExistingUsersDetected

Fires when Twitch notifies client of existing users in chat.

◆ OnFailureToReceiveJoinConfirmation

EventHandler<OnFailureToReceiveJoinConfirmationArgs> TwitchLib.Client.TwitchClient.OnFailureToReceiveJoinConfirmation

Fires when the client was unable to join a channel.

◆ OnFollowersOnly

EventHandler<OnFollowersOnlyArgs> TwitchLib.Client.TwitchClient.OnFollowersOnly

Fires when the client attempts to send a message to a channel in followers only mode, as a non-follower

◆ OnGiftedSubscription

EventHandler<OnGiftedSubscriptionArgs> TwitchLib.Client.TwitchClient.OnGiftedSubscription

Fires when a subscription is gifted and announced in chat

◆ OnIncorrectLogin

EventHandler<OnIncorrectLoginArgs> TwitchLib.Client.TwitchClient.OnIncorrectLogin

Fires on logging in with incorrect details, returns ErrorLoggingInException.

◆ OnJoinedChannel

EventHandler<OnJoinedChannelArgs> TwitchLib.Client.TwitchClient.OnJoinedChannel

Fires when client joins a channel.

◆ OnLeftChannel

EventHandler<OnLeftChannelArgs> TwitchLib.Client.TwitchClient.OnLeftChannel

Fires when client successfully leaves a channel.

◆ OnLog

EventHandler<OnLogArgs> TwitchLib.Client.TwitchClient.OnLog

Fires whenever a log write happens.

◆ OnMessageCleared

EventHandler<OnMessageClearedArgs> TwitchLib.Client.TwitchClient.OnMessageCleared

Fires when a message gets deleted in chat.

◆ OnMessageReceived

EventHandler<OnMessageReceivedArgs> TwitchLib.Client.TwitchClient.OnMessageReceived

Fires when a new chat message arrives, returns ChatMessage.

◆ OnMessageSent

EventHandler<OnMessageSentArgs> TwitchLib.Client.TwitchClient.OnMessageSent

Fires when a chat message is sent, returns username, channel and message.

◆ OnMessageThrottled

EventHandler<OnMessageThrottledEventArgs> TwitchLib.Client.TwitchClient.OnMessageThrottled

Fires when a Message has been throttled.

◆ OnModeratorJoined

EventHandler<OnModeratorJoinedArgs> TwitchLib.Client.TwitchClient.OnModeratorJoined

Fires when a moderator joined the channel's chat room, returns username and channel.

◆ OnModeratorLeft

EventHandler<OnModeratorLeftArgs> TwitchLib.Client.TwitchClient.OnModeratorLeft

Fires when a moderator joins the channel's chat room, returns username and channel.

◆ OnModeratorsReceived

EventHandler<OnModeratorsReceivedArgs> TwitchLib.Client.TwitchClient.OnModeratorsReceived

Fires when a list of moderators is received.

◆ OnNewSubscriber

EventHandler<OnNewSubscriberArgs> TwitchLib.Client.TwitchClient.OnNewSubscriber

Fires when new subscriber is announced in chat, returns Subscriber.

◆ OnNoPermissionError

EventHandler TwitchLib.Client.TwitchClient.OnNoPermissionError

Fires when TwitchClient receives generic no permission error from Twitch.

◆ OnPrimePaidSubscriber

EventHandler<OnPrimePaidSubscriberArgs> TwitchLib.Client.TwitchClient.OnPrimePaidSubscriber

Fires when a current Prime gaming subscriber converts to a paid subscription.

◆ OnR9kMode

EventHandler<OnR9kModeArgs> TwitchLib.Client.TwitchClient.OnR9kMode

Fires when the client attempts to send a message in a channel with r9k mode enabled, and message was not permitted

◆ OnRaidedChannelIsMatureAudience

EventHandler TwitchLib.Client.TwitchClient.OnRaidedChannelIsMatureAudience

Fires when newly raided channel is mature audience only.

◆ OnRaidNotification

EventHandler<OnRaidNotificationArgs> TwitchLib.Client.TwitchClient.OnRaidNotification

Fires when a raid notification is detected in chat

◆ OnRateLimit

EventHandler<OnRateLimitArgs> TwitchLib.Client.TwitchClient.OnRateLimit

Occurs when send message rate limit has been applied to the client in a specific channel by Twitch

◆ OnReconnected

EventHandler<OnReconnectedEventArgs> TwitchLib.Client.TwitchClient.OnReconnected

Occurs when a reconnection occurs.

◆ OnRequiresVerifiedEmail

EventHandler<OnRequiresVerifiedEmailArgs> TwitchLib.Client.TwitchClient.OnRequiresVerifiedEmail

Occurs when chatting in a channel that requires a verified email without a verified email attached to the account.

◆ OnRequiresVerifiedPhoneNumber

EventHandler<OnRequiresVerifiedPhoneNumberArgs> TwitchLib.Client.TwitchClient.OnRequiresVerifiedPhoneNumber

Occurs when chatting in a channel that requires a verified phone number without a verified phone number attached to the account.

◆ OnReSubscriber

EventHandler<OnReSubscriberArgs> TwitchLib.Client.TwitchClient.OnReSubscriber

Fires when current subscriber renews subscription, returns ReSubscriber.

◆ OnSelfRaidError

EventHandler TwitchLib.Client.TwitchClient.OnSelfRaidError

Fires when TwitchClient attempts to host a channel it is in.

◆ OnSendReceiveData

EventHandler<OnSendReceiveDataArgs> TwitchLib.Client.TwitchClient.OnSendReceiveData

Fires when data is either received or sent.

◆ OnSlowMode

EventHandler<OnSlowModeArgs> TwitchLib.Client.TwitchClient.OnSlowMode

Fires when the client attempts to send a message in a channel with slow mode enabled, without cooldown expiring

◆ OnSubsOnly

EventHandler<OnSubsOnlyArgs> TwitchLib.Client.TwitchClient.OnSubsOnly

Fires when the client attempts to send a message to a channel in subs only mode, as a non-sub

◆ OnSuspended

EventHandler<OnSuspendedArgs> TwitchLib.Client.TwitchClient.OnSuspended

Fires when the client attempts to send a message to a channel that has been suspended

◆ OnUnaccountedFor

EventHandler<OnUnaccountedForArgs> TwitchLib.Client.TwitchClient.OnUnaccountedFor

Fires when data is received from Twitch that is not able to be parsed.

◆ OnUserBanned

EventHandler<OnUserBannedArgs> TwitchLib.Client.TwitchClient.OnUserBanned

Fires when a viewer gets banned by any moderator.

◆ OnUserIntro

EventHandler<OnUserIntroArgs> TwitchLib.Client.TwitchClient.OnUserIntro

Fires when the client receives a PRIVMSG tagged as an user-intro

◆ OnUserJoined

EventHandler<OnUserJoinedArgs> TwitchLib.Client.TwitchClient.OnUserJoined

Fires when a new viewer/chatter joined the channel's chat room, returns username and channel.

◆ OnUserLeft

EventHandler<OnUserLeftArgs> TwitchLib.Client.TwitchClient.OnUserLeft

Fires when a PART message is received from Twitch regarding a particular viewer

◆ OnUserStateChanged

EventHandler<OnUserStateChangedArgs> TwitchLib.Client.TwitchClient.OnUserStateChanged

Fires when a user state is received, returns UserState.

◆ OnUserTimedout

EventHandler<OnUserTimedoutArgs> TwitchLib.Client.TwitchClient.OnUserTimedout

Fires when a viewer gets timedout by any moderator.

◆ OnVIPsReceived

EventHandler<OnVIPsReceivedArgs> TwitchLib.Client.TwitchClient.OnVIPsReceived

Fires when VIPs are received from chat

◆ OnWhisperCommandReceived

EventHandler<OnWhisperCommandReceivedArgs> TwitchLib.Client.TwitchClient.OnWhisperCommandReceived

Fires when command (uses custom whisper command identifier) is received, returns command, Whispermessage.

◆ OnWhisperReceived

EventHandler<OnWhisperReceivedArgs> TwitchLib.Client.TwitchClient.OnWhisperReceived

Fires when a new whisper arrives, returns WhisperMessage.

◆ OnWhisperSent

EventHandler<OnWhisperSentArgs> TwitchLib.Client.TwitchClient.OnWhisperSent

Fires when a whisper message is sent, returns username and message.

◆ OnWhisperThrottled

EventHandler<OnWhisperThrottledEventArgs> TwitchLib.Client.TwitchClient.OnWhisperThrottled

Fires when a Whisper has been throttled.


The documentation for this class was generated from the following file: