Skip to content
Alex Baines edited this page Jun 3, 2018 · 2 revisions

This will explain how to use insobot as (the basis for) your own bot on Twitch.

Things to know before you start

  • Insobot only runs on GNU/Linux (or the Bash on Ubuntu on Windows thing, so I've heard)
  • This guide will set up your own Twitch account for the bot to run as - it won't be called insobot in Twitch chat.
    • If you do want the insobot account as a bot in your chat then contact me instead of reading this.

Initial Setup

To start with, read the Quickstart guide. You'll need to clone the repo somewhere, run make, and then begin editing a copy of insobot.sh.example like it says. TIP: If you name the copy start-twitch.sh or anything beginning with start- it'll be excluded from git.

Inside this new file:

set IRC_SERV to 'irc.chat.twitch.tv'.
set IRC_USER to the lowercase twitch username you want the bot to run as.
(You probably want to create a new twitch account specifically for the bot)

set IRC_CHAN to your lowercase twitch username prefixed with a #.
This will be the initial channel that the bot joins whens it starts up. You can add multiple channels here separated by commas, but don't worry about it too much as you can use !join later if needed.

set IRC_ADMIN to your (not the bot's) twitch username.
This will allow you to use privileged commands like !join, or anything marked ADMIN on the main github page command list.

Next, you will need to get an oauth password for Twitch's IRC interface
https://twitchapps.com/tmi/ is a good place to do this. Make sure you are logged in with the bot's account first.
Now you can uncomment the export IRC_PASS line and set it to 'oauth:asdfsffhskdjfhkjh' (replacing with what you got from the previous step)

There is one last change needed to this file if you want Twitch-specific commands like !uptime or !fnotify to work: you will need to set INSOBOT_TWITCH_CLIENT_ID to a Client-ID issued by Twitch for their HTTP API.
You can either go to https://glass.twitch.tv/console/apps and register a new app (using either your or the bot's account), or you can try the Client-ID of jzkbprff40iqj646a697cyrvl0zt2m6. This one used to be hardcoded in Twitch's own web UI and still works afaik.

Choosing modules for Twitch

You probably want to limit the modules that the bot will run with to make sense for twitch.

Either open up src/Makefile or create a new file called src/config.mk.
The Makefile includes src/config.mk but it isn't in git - so the advantage of using that one is your settings won't be overwritten.

You'll want to modify (or add) a line of the form:
MODULES := core alias automod whitelist twitch karma psa markov

core is the only required module, the rest add extras:

  • alias allows creating simple !keyboard style macros which you can use to answer FAQs.
  • automod gives some rudimentary spambot protection
  • whitelist allows you to use !wl+ and !wl- to add/remove people from the bot's whitelist.
    • This affects whether they can use commands marked WLIST in the main github command list.
  • twitch handles !uptime, !fnotify, !vod and similar twitch-specific commands.
  • karma tracks ++ and --'s to names, and provides the !karma command for fun.
  • psa is similar to alias but auto-responds or says stuff on a timer. see this for more info
  • markov is the random sentence generator.

Feel free to add/remove any as you see fit.

NOTE: After you change MODULES you should run make clean && make.

Now you're ready to run your .sh to start up the bot
If everything goes well, it should connect and join your channel. If not, you're welcome to contact me and I'll try to help troubleshoot.

Important - enabling / managing modules

After the bot joins your channel, you may find that some of the modules you put in MODULES don't appear to be working! This is most likely because they have not yet been enabled.
Use the !m command to see which modules are enabled in the current channel and !mon/!moff to toggle them.

Advanced configuration

For more configuration options, take a look at src/config.h where you can change the ! prefix char to something else if it interferes with another bot.

If you're feeling adventurous take a look at src/module.h and this blog which is the basis for creating your own modules. Maybe you could write a nice subscriber notifier or song-request module for your twitch channel. If you do, and would like to share it then I'm happy to accept pull requests!

Thanks for reading and good luck.

Clone this wiki locally