Connecting to Twitch Chat via irssi

Connecting to Twitch Chat via irssi


  • Share on Pinterest

Because I like to idle in all my favorite IRC servers/channels from my remote server due to its network connectivity being a lot more reliable than my own home network, I wanted to also be able to idle in my Twitch’s chat, as well as idle in the chats of the people I follow (however do be respectful and ask the broadcaster if it is indeed okay for you to idle in their channel). Running IRC on a remote server also has the advantage of being able to connect to it from anywhere I want.

I personally use irssi which is pretty much the best IRC client you could ever want. So with that, I figured I’d do a quick write up on how to configure irssi to connect to your (or any) Twitch user’s chat.


Guide

First step is creating the network within irssi:

# Command
/network add -nick twitchusername nameofnetwork
# Example
/network add -nick crunchprank Twitch

The Second step consists of adding a server to that network. You will need your OAuth Token for your Twitch account which can be found here. You can choose to use either a non-SSL port (6667) or an SSL port (6697). Be sure to include the -ssl flag if using 6697 as indicated in the below example.

# Non-SSL Command
/server add -auto -network nameofnetwork irc.chat.twitch.tv 6667 oauth:password
# Example
/server add -auto -network Twitch irc.chat.twitch.tv 6667 oauth:WPlLjuzxbyztnuzOjYrr
# SSL Command
/server add -auto -ssl -network nameofnetwork irc.chat.twitch.tv 6697 oauth:password
# Example
/server add -auto -ssl -network Twitch irc.chat.twitch.tv 6697 oauth:WPlLjuzxbyztnuzOjYrr

In case you’re wondering, the above -auto tag is optional. What this means is when you connect to this network, it will automatically connect to this server.

The third step is optional and relates to the MEMBERSHIP capability that was recently adjusted by Twitch (further details at the end of this blog). But simply put, this enables JOIN and PART messages - say if you’d like to see when users join and leave your Twitch chat (channel). You simply need to request this information be sent to your client, which can be done in irssi by using the /quote command in combination with autosendcmd which just sends a command instantly upon connection.

# Command
/network add -autosendcmd "/somecommand here" nameofnetwork
# Example
/network add -autosendcmd "/quote CAP REQ :twitch.tv/membership" Twitch

And the final step is where we add the channel to the network you created in the first step. The channel name is simply your Twitch name (or replace this name with any other broadcaster whose channel you’d like to join).

# Command
/channel add -auto #twitchusername nameofnetwork
# Example
/channel add -auto #crunchprank Twitch

Again, the -auto tag is optional.

And that does it. All you need to do now is connect to that network. Which is accomplished simply by the following:

# Command
/connect nameofnetwork
# Example
/connect Twitch

One thing that I would suggest you go ahead and do once you get that sorted out, is ignore the user jtv. It will ping you information that you simply don’t need or care about. Of course, feel free to leave it. But if you do want to ignore it, just type:

/ignore jtv

Anyway I hope this will help some of you guys out. Got any questions or recommendations? Hit up the comments below!


Membership Update

Back in June (2016), the Twitch devs pushed out a temporary change to disable JOIN and PART messages for performance optimization in preparation for E3. Once E3 was over, they announced the end of JOIN/PART and they re-enabled MEMBERSHIP (documentation here). What that means is in order to get the information that was previously sent to a client by default, you now have to specifically tell your client to request it from Twitch. In this tutorial’s case, we are requesting that information to be once again sent to us by default via the raw or /quote command to twitch.tv/membership. Personally, anything that Twitch does to optimize their infrastructure’s service is a good thing in my book. Plus I’m not a huge fan of the particular Twitch bots that would greet users when they entered a channel — sometimes lurkers just wanna lurk. Ultimately though I think the main reason is that join/part has never, ever been reliable in the first place. The messages are horribly delayed by sometimes well over a minute or two which just made them not entirely useful.