We’ll be doing all of this by spinning up a new Node.js app from scratch, using tmi.js to listen in on Twitch, and deploying it all to Heroku for production. Particularly, we’ll build our bot to recognize the exclamation point pattern (ex: !command), parse the particular command being sent, and using it to map to a list of available commands. We’ll be building a chat bot that listens to messages on a Twitch channel and upon receiving a command, responds with a custom message. The goal of the library is provide a way for developers to programmatically listen to Twitch events and when those events occur, perform some sort of action.Īs we talked about earlier, there are a variety of ways you can use this type of utility, but in our case, we’ll be using it to build a simple chat bot. It ends up being exactly what it sounds like, which is a mechanism to interface with, or interact with, Twitch’s messaging system. Starting off, tmi.js stands for “Twitch Messaging Interface”. The great thing is to interact with Twitch, we can use libraries like tmi.js available on npm that we can run on a node server, giving us an easy way to get a new bot up and running.
#Creating chat bots for twitch free#
While Heroku isn’t the only kid on the block, it’s one of the most popular, between the ease of getting a new server up and running and the fact that it’s free tier supports running a single bot server 24/7 (after validating a credit card and without running anything else). They support a wide variety of services like running a Node.js server or spinning up a new Postgres database. Heroku is a platform that allows developers to deploy apps to the cloud. This can include info about the host, the guest, simple shortcuts for links, or even some kind of game that let’s the audience interact with the stream.īut either way, that bot ultimately gets deployed to a server where it “lives” and can actively keep running, listening to that Twitch stream, which is where Heroku comes in. Part of the fun with chat bots, whether for Twitch or any other platform (like Discord), is these bots can be used to provide more interaction and self-help for the stream.
![creating chat bots for twitch creating chat bots for twitch](https://eheidi.dev/storage/images/6zv0gpgrpofyonf5oo83.png)
#Creating chat bots for twitch update#
It can also be used as a mechanism to regularly send updates to the chat, such as if you wanted to help update the audience about the stream or if you wanted to promote something every so often. That chat bot is essentially a server that’s hosted somewhere on the internet, that will “listen” to the chat, reading each message, and trying to understand it, to determine whether or not it needs to take action on that message or respond. If you’ve spent some time watching some Twitch streams, you may have noticed users posting with the word “bot” in their name or some sort of automated system that could be used for anything from ads to custom commands.