git.m455.casa

m455.casa

clone url: git://git.m455.casa/m455.casa


html/archive/2021/connecting-to-twitch-with-weechat.html

1 <!DOCTYPE html>
2 <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
3 <head>
4 <meta charset="utf-8" />
5 <meta name="generator" content="pandoc" />
6 <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes" />
7 <title>Connecting to Twitch with WeeChat</title>
8 <style>
9 code{white-space: pre-wrap;}
10 span.smallcaps{font-variant: small-caps;}
11 span.underline{text-decoration: underline;}
12 div.column{display: inline-block; vertical-align: top; width: 50%;}
13 div.hanging-indent{margin-left: 1.5em; text-indent: -1.5em;}
14 ul.task-list{list-style: none;}
15 </style>
16 <style>
17 body {
18 line-height: 1.5;
19 font-family: sans-serif;
20 font-size: 18px;
21 margin: 20px auto;
22 max-width: 630px;
23 }
24
25 a {
26 color: blue;
27 }
28
29 code, pre {
30 background-color: #fddee3;
31 font-size: 14px;
32 }
33
34 pre {
35 padding: 25px 25px;
36 overflow: auto;
37 }
38
39 pre code {
40 white-space: pre;
41 }
42
43 img {
44 max-width: 100%;
45 }
46
47 table {
48 border-collapse: collapse;
49 }
50
51 table caption {
52 font-weight: bold;
53 margin: 10px 0px;
54 text-align: left;
55 }
56
57 th, td {
58 border: 1px solid #000;
59 padding: 4px;
60 }
61
62 blockquote {
63 border-left: 3px solid #000;
64 padding-left: 10px;
65 }
66
67 .border {
68 border: 1px solid #000;
69 margin: 25px 0px;
70 padding: 5px 25px;
71 }
72
73 @media only screen and (max-width: 700px) {
74 body {
75 margin: 10px;
76 }
77 }
78
79 @media (prefers-color-scheme: dark) {
80 body {
81 background-color: #111;
82 color: #eee;
83 }
84 a {
85 color: #009fff;
86 }
87 code, pre {
88 background-color: #111;
89 color: #fd6363;
90 }
91 pre {
92 padding: 15px 25px;
93 }
94 blockquote {
95 border-left: 3px solid #666;
96 }
97 .border, th, td {
98 border: 1px solid #666;
99 }
100 }
101 </style>
102 </head>
103 <body>
104 <main>
105 <h2 id="connecting-to-twitch-with-weechat">Connecting to Twitch with WeeChat</h2>
106 <p>2021-01-08 00:00</p>
107 <p>A while ago, <a href="https://archangelic.space">a friend</a>/IRC aficionado told me that <a href="https://twitch.tv">Twitch</a> 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!</p>
108 <p>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!</p>
109 <h3 id="page-overview">Page overview</h3>
110 <!-- vim-markdown-toc GFM -->
111 <ul>
112 <li><a href="#getting-an-authentication-token">Getting an authentication token</a></li>
113 <li><a href="#adding-twitch-as-a-server-to-weechat">Adding Twitch as a server to WeeChat</a></li>
114 <li><a href="#what-doesnt-work">What doesn’t work</a></li>
115 <li><a href="#twitchs-irc-documentation">Twitch’s IRC documentation</a></li>
116 </ul>
117 <!-- vim-markdown-toc -->
118 <h3 id="getting-an-authentication-token">Getting an authentication token</h3>
119 <p>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 <a href="https://twitchapps.com/tmi/">Twitch Chat OAuth Password Generator</a> page, and click the “Connect” button.</p>
120 <p>After clicking the “Connect” button, you should see a code on your screen that looks similar to the one below:</p>
121 <pre><code>oauth:llkasjdfkjdsfasdfkj32134234</code></pre>
122 <p>I just typed random letters and numbers, but let’s pretend that’s my actual code.</p>
123 <h3 id="adding-twitch-as-a-server-to-weechat">Adding Twitch as a server to WeeChat</h3>
124 <p>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 <code>m455b</code> as my username, and the authentication code above as my password:</p>
125 <pre><code>/server add twitch irc.chat.twitch.tv/6697 -ssl
126 /set irc.server.twitch.username &quot;m455b&quot;
127 /set irc.server.twitch.password oauth:llkasjdfkjdsfasdfkj32134234
128 /set irc.server.twitch.autoconnect on
129 /set irc.server.twitch.autojoin &quot;#m455b,#friends-username,#other-friends-username&quot;</code></pre>
130 <aside class="border">
131 <p>
132 <strong>Tip</strong>: If you want to store your password more securely, you can replace the password command with the two commands below:
133 </p>
134 <pre>
135 /secure set twitch_password oauth:llkasjdfkjdsfasdfkj32134234
136 /set irc.server.twitch.password "${sec.data.twitch_password}"
137 </pre>
138 </aside>
139 <p>In the commands above, I have <code>#friends-username</code> and <code>#other-friends-username</code> (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.</p>
140 <p>For example, if you follow someone on Twitch called <code>coolperson123</code>, and their Twitch URL is <code>twitch.tv/coolperson123</code>, then you would add their Twitch channel to the <code>autojoin</code> list above as <code>#coolperson123</code>. You can see this in action above, where I’ve added my own Twitch channel, <code>#m455b</code>. This allows me to chat with my viewers on WeeChat, instead of having to open my browser to chat.</p>
141 <h3 id="what-doesnt-work">What doesn’t work</h3>
142 <ul>
143 <li>SASL doesn’t work, but secure passwords do.</li>
144 <li>I haven’t tried it yet, but you might able to type <code>/slowoff</code> in your own channel or one you moderate to remove the messages-per-time-frame limit that Twitch has.</li>
145 </ul>
146 <h3 id="twitchs-irc-documentation">Twitch’s IRC documentation</h3>
147 <p>For more information about Twitch’s IRC server, check out Twitch’s <a href="https://dev.twitch.tv/docs/irc/guide/">Chatbots &amp; IRC Guide</a> page.</p>
148 </main>
149 </body>
150 </html>