I loved IRC. I still like it, but I don’t really use it anymore as there are less and less use to it. Most communities moved to Matrix, Discord, Slack, or Mattermost.

For long years my favourite client was BitchX, later I moved to Irssi, and now I use WeeChat.

There is still one big platform where I use IRC still, and that’s Twitch. Yes, Twitch has an IRC server where bots can join and monitor chat messages. But how?

OAuth Token

First we need an OAuth Token. There is a tool for that on twitchapps.

  1. Open the tool.
  2. Read the text, or skip as you wish.
  3. Click “Connect”
  4. Copy the oauth key. It will start with oauth:.

As the text said (but in case you skipped it) you can revoke this token from your Twitch Settings

Start WeeChat

From this point, all commands will be issued inside WeeChat.

Secure Passwords

We can store our OAuth Token as a plain text value in WeeChat configuration, but we shouldn’t. For that we can store sensitive information as a secret in WeeChat (that’s one of the reasons I moved to WeeChat a few years ago).

First we have to set a passphrase. It should be secure enough, but not too long as we have to type in it on every time we start WeeChat:

/secure passphrase very long passphrase

Now we can save the password into our secure storage:

/secure set twitch_password xxxxxxx

Add Server

First add Twitch server:

/server add twitch irc.twitch.tv/6697 -nicks=TWITCH_NAME -username=TWITCH_NAME

We didn’t set the password with /server add, we could, but we didn’t. Let’s set the password. The oauth: prefix is part of the password.

If you saved the password with oauth: prefix:

/set irc.server.twitch.password "${sec.data.twitch_password}"

And if you saved it without the oauth: prefix:

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

Now save the irc section of WeeChat configuration.

/save irc

A simple /save is enough in all places, but I like scoped saves.

Connect and Join

Finally, we can connect to the server and join channels:

/connect twitch
/join #CHANNEL_NAME

Channel name is the username of the streamer, basically the username at the end of their twitch URL.

We can set up some channels to auto-join when we connect to Twitch:

/set irc.server.twitch.autojoin "#channel1,#channel2"
/save irc

We can set dynamic auto-join, this will add channels to autojoin when we join. It’s important to know, it does NOT save the config, so you have to call /save after you joined a channel.

/set irc.server.twitch.autojoin_dynamic on
/save irc

Join/Part Messages

By default, Twitch does not show join/part messages, so we can’t see when someone joins a channel, but we can enable it with CAP REQ (capability request). To make it permanent, we can set it as an auto-command on connect:

/set irc.server.twitch.command "/quote CAP REQ :twitch.tv/membership"
/save irc

One Last Step

Technically it’s not an extra step, everything should be saved, but it’s better to save in case we missed a save somewhere.

/save