A Twitch node.js bot designed to run commands (!uptime, etc.). Also has a frontend in Vue.js for command permissions and watching chat.
Before you get started, you will need:
- Node (latest version works fine), used for the chat bot
- xampp (or another local hosting server), used for the frontend
How to install the chat bot:
- Download the files to a directory. Easiest option is to download as zip, then unzip it to a folder of your choice.
- Navigate in the terminal to the directory you created. Type in
npm install
to download all packages needed. - Goto the config folder. Change
dummy-server-vars.js
to justserver-vars.js
and input your bot username, password, and channel name. You may need to make a new Twitch developer account for this. - Go to the main directory and type in
node server.js
. If everything goes well, you should see the console pop up and have it wait for actions. - Experiment with the different commands! Write your own!
Code Points of Interest:
command-permissions
: This is where each command has a variable for its ability to be used. If you add/remove commands, also add/remove an appropriate variable. You can either manually set permissions here or change them in the front end.//add your commands here
: After this comment is the processing loop. First, each message gets checked for length and if commands are on cooldown. Then they're checked for content and if a match is found, an appropriate action happens.client.send
will have your bot send a message in chat. Make sure to respect the cooldown mechanics by locking it in your actions and usingsetTimeout
to turn off the cooldown./** END server setup **/
: Marks the end of the bot code. The code after is used for the front end if you choose to use it.
How to install the frontend:
- (if needed) Move the folder to a directory you can access through your hosting server. In XAMPP, it is likely
xampp/htdocs/
. - Open the said directory in your browser to make sure it works.
- Open up
js/app.js
and changethis.channel="sketchspace"
to whatever your channel to be. - (optional) Go to
server.js
and change your port number from 3000 to whatever you want. Also injs/app.js
, go near the bottom and change127.0.0.1:3000
to whatever you set your new port number. Verify your changes work.
Future Plans:
I want to make this run off a Raspberry PI 3 with a touch screen by my streaming setup. So whenever I go live, I press a few buttons, then I have a small screen by my setup to make changes.
Contact:
Send all questions/comments to olindgallet@olingallet.com