I got around twitch chat downtime by connecting to the IRC server directly. Gives me some ideas!
A few days ago, I was trying to watch one of my favorite twitch streamers but the stupid platform kept going down!
I noticed that one user was unaffected by the downtime. He was capable of chatting in the livestream even though all of our chatrooms had gone offline. He mentioned a small tidbit about how he was chatting and watching from his Playstation.
🤔 This got me thinking about the chat servers on the Twitch.TV website. I did some more research on their chat system and it appears that they are using a variation on IRC and OAuth. Some quick reading on IRC and Chatbots lead me to believe I could fix my chatting issues by connecting directly to the twitch IRC server.
Reading the Chatbot/IRC docs provides the server address, port and all other connection information you would need.
The instructions include a step that tells you how to get your OAuth token using a community-made webapp.
For some reason, I did not feel comfortable using this public app to print out my OAuth token. I figured I could probably get my token by reading the auth headers in the network traffic. I was right.
You can use your browser's DevTools to watch your network traffic and read the messages being sent accross the irc websocket in your browser. I won't tell you exactly how, but this might help?
I decided to go with HexChat, but any IRC client will do. Simply enter the information we just got and you're on!
irc.chat.twitch.tv is the IRC server address, 6697 is the Port. This is the data that we retrieved from the IRC document (linked above).
Notice that SSL is enabled because we're using port 6697, the SSL port mentioned in the doc.
At this point, you're good to go. "Twitch" is the server that you connect to. Going forward, you can join channels.
For example, if your friend's livestream account is "SuperFriend420", simply lowercase the username and add a "#" sign ahead of it.
To chat in the SuperFriend420 livestream, join the channel #superfriend420.
This opens a lot of doors for automation. IRC has existed for a long time and so it is supported by many clients.
HexChat has an API for Lua, Python, etc. which allows you to react to chats in real-time. You can practically turn yourself into a bot so your automations can exist in any channel you join.
You won't need to 🤞 that your favorite streamer has your favorite bot in their chatroom. YOU are the bot.
Additionally, this allows you to see when users join and leave your chatroom and plenty of other IRC benefits.
Pretty interesting, I think.
I'm going to mess around with automating some of my behavior.
Thanks for reading! :)