Chatbot for Twitch
I invest a lot of resources into creating best in class open source packages. You can support me by buying one of my paid products.
I highly appreciate you sending us a postcard from your hometown, mentioning which of my prpjects you are using. You'll find my address on my contact page. I publish all received postcards on my virtual postcard wall.
This section is inspired by my friends at Spatie.
Clone the project
git clone https://github.com/fwartner/twitch-chat-bot.git
Go to the project directory
cd live-chat-bot
Install dependencies
npm install
Start the server
npm run start
To get the chatbot working you'll need to obtain an oauth token for the user which is impersonated by the chatbot. I suggest using https://twitchapps.com/tmi.
NOTE: Only the part behind oauth:
is needed for the configuration.
Create your local .env
file by copying the .env.example
:
cp .env.example .env
Fill out the required field:
- TWITCH_USERNAME: The username for the chatbot
- TWITCH_OAUTH: The key you just obtained from twitchapps.com
- TWITCH_CHANNEL: The channel on Twitch you want to interact with
- WEBSITE: Your website
The chatbot can also filter and automatically delete words or messages.
To add words that will be filtered by the bot simply edit the src/constants.js
file:
...
export const BLOCKED_WORDS = [
'hiphop', // Add more words here..
]
...