Home
twitch bot setup guide for wrangel
- You get a permission token from twitch, through a series of extra "register an account" steps. The permission token goes in a program you write which interacts with your chat while it's running.
- You use a pre-written unofficial software library to connect to your twitch chat. Your program does whatever else you tell it to do. It uses the permission token to do specific stuff in your chat room.
- There are twitch libraries for c++, c#, java, python, node and probably others. You pick the language you want. Each library includes all the routines for connecting to your chat channel, reading data over a network, and writing responses as a background process.
- You just have to write how your program plays with the string data that the library gets for you.
(for a bot named 'wrangbot':)
To get the token:
- Make sure you don't have anything listening on your local machine on port 3000
- Make a twitch account called wrangbot
- Go to wrangbot's settings, verify email & enable 2fa
- While logged in as wrangbot, go to https://dev.twitch.tv/console
- register an app also named wrangbot
- set its oauth redirect to http://localhost:3000
- at https://dev.twitch.tv/console, you should be able to click 'manage' to get wrangbot's client id and secret number
- Install the twitch cli on your local machine. the process depends on your OS but it's easy https://dev.twitch.tv/docs/cli/
- Configure the 'twitch' utility in a cli to tell it it's handling wrangbot
-
- twitch configure -i CLIENT_ID -s SECRET
-
- Use the twitch utility's token command to request specific permissions for your bot
- if you want it to manage channel points, read chat, and write chat messages, the command looks like this, quotes included
-
- twitch token -u -s "channel:manage:redemptions chat:read chat:edit"
-
- this should output a token for you, which goes in the source code of the program you write.
- more permissions are listed at https://dev.twitch.tv/docs/authentication/scopes/
To write the program:
Documentation for your twitch library should show you where to pass the token, set the command prefix, respond to specific chatter names, etc. You can get pretty far without knowing how to program. If you do know how to program that's very helpful.
The library I've used is twitchio for python. It has a couple walkthroughs.