m455.casa

Connecting to Twitch with WeeChat

2021-01-08

A while ago, a friend/IRC aficionado told me that Twitch uses IRC under the hood. It wasn’t until recently that I decided to go down a rabbit hole to learn how to connect to Twitch with WeeChat. It turns out it isn’t difficult at all, so I’m going to show you how to do exactly that!

Normally, I’d make this all nice and technical-writer-y, but I haven’t written a less-structured post in a while, and those kinds of posts are my favourite to write, so let’s begin!

Page overview

Getting an authentication token

Okay! So, before you can connect, you will need to get an authentication token from Twitch, because your regular password won’t work! To get one of these, go to the Twitch Chat OAuth Password Generator page, and click the “Connect” button.

After clicking the “Connect” button, you should see a code on your screen that looks similar to the one below:

oauth:llkasjdfkjdsfasdfkj32134234

I just typed random letters and numbers, but let’s pretend that’s my actual code.

Adding Twitch as a server to WeeChat

Now that we have a code, we can use it as a password for WeeChat. Let’s go ahead and setup WeeChat so we connect to Twitch’s IRC server as soon as we open up WeeChat. In the commands below, I’m going to use my Twitch username m455b as my username, and the authentication code above as my password:

/server add twitch irc.chat.twitch.tv/6697 -ssl
/set irc.server.twitch.username "m455b"
/set irc.server.twitch.password oauth:llkasjdfkjdsfasdfkj32134234
/set irc.server.twitch.autoconnect on
/set irc.server.twitch.autojoin "#m455b,#friends-username,#other-friends-username"

Tip: If you want to store your password more securely, you can replace the password command with the two commands below:

/secure set twitch_password oauth:llkasjdfkjdsfasdfkj32134234
/set irc.server.twitch.password "${sec.data.twitch_password}"

In the commands above, I have #friends-username and #other-friends-username (ignore the missing punctuation, quotes aren’t supported in channel names on IRC). These should be replaced with real Twitch usernames, because Twitch treats usernames as IRC channels.

For example, if you follow someone on Twitch called coolperson123, and their Twitch URL is twitch.tv/coolperson123, then you would add their Twitch channel to the autojoin list above as #coolperson123. You can see this in action above, where I’ve added my own Twitch channel, #m455b. This allows me to chat with my viewers on WeeChat, instead of having to open my browser to chat.

What doesn’t work

Twitch’s IRC documentation

For more information about Twitch’s IRC server, check out Twitch’s Chatbots & IRC Guide page.