-
Notifications
You must be signed in to change notification settings - Fork 3
Overview
Twitch chat is based upon the IRC protocol, but doesn't implement all of it's features. In turn, Twitch added some commands that are not present on regular IRC servers. If you have some experience with IRC, interacting with Twitch IRC and using libtwirc
should be pretty easy. If you have no experience, you should still get the hang of it rather quickly, as IRC is a straight-forward protocol.
Communication with the Twitch IRC chat servers works by sending certain plain-text messages back and forth in an asynchronous manner. The server will reply to some messages that you send, but not all. Some messages from the server result from the actions of other users, some are information directly form the server. Every message contains at the very minimum a command, but can optionally hold tags, a prefix and parameters. Here are two examples for IRC messages:
PING :tmi.twitch.tv
:[email protected] PRIVMSG #domsson :Hey guys, what's up?
Anyway, libtwirc
takes care of most things for you. The important take-away is that the asynchronous nature of the protocol means that just because you sent a command to the server doesn't mean you can expect it to immediately take effect. Instead, you usually have to wait for the appropriate responses from the server first.
libtwirc
will connect to the Twitch chat for you and allow you to send messages to and receive messages from the chat server. Incoming messages will be parsed into events that are easy to process. Tags, prefix, command and parameters will be individually available to you. What's left for you to do is to write event handler functions that take care of the incoming events.
See section events.
To carry out actions in chat, like joining channels (streams), sending messages to the chat or sending whispers to users, you can use the many provided command functions in libtwirc
.
See section commands.