Welcome to the Twitch Bot Project! This project is designed to enhance your Twitch streaming experience by integrating various functionalities such as Spotify playback, League of Legends rank information, and more.
- Twitch Integration: Connects to your Twitch channel and interacts with viewers.
- Spotify Integration: Displays the current playing song and manages Spotify playback.
- League of Legends Integration: Provides rank information and other game stats.
- Express Web Server: Serves as the backend for various web functionalities.
- Node.js (v23.1.0 or higher)
- npm (Node Package Manager)
- pm2 (Process Manager for Node.js)
- dotenv
- twitchbot
- inquirer
- axios
- express
- body-parser
- qs
- concurrently
First, clone the repository to your local machine:
git clone https://github.com/Timmsy1998/nodejs-twitch-bot.git
cd nodejs-twitch-bot
Install the required dependencies:
npm run setup
This will install all the necessary dependencies in the root, chatBot
, and webServer
directories, and also install pm2
globally.
The setup script will guide you through the process of setting up your environment variables and creating the .env
file. Make sure to have your Twitch and Spotify credentials ready.
Use the following command to start the chatbot and web server:
npm run start
This command will use pm2
to start the bot and web server as defined in workspaceStart.config.js
.
Here is a detailed directory structure of the project:
twitchBot/
βββ chatBot/
β βββ logs/ # Directory for chatbot logs
β βββ modules/ # Modules for chatbot functionalities
β β βββ api/ # API wrappers for external services
β β β βββ lolAPIwrapper.js # Riot Games API wrapper
β β β βββ twitchAPIwrapper.js # Twitch API wrapper
β β βββ commands/ # Commands for the chatbot
β β β βββ broadcaster/ # Broadcaster-specific commands
β β β β βββ clearquotes.js
β β β β βββ restart.js
β β β βββ fun/ # Fun commands
β β β β βββ 8ball.js
β β β β βββ addquote.js
β β β β βββ clip.js
β β β β βββ joke.js
β β β β βββ quote.js
β β β βββ general/ # General commands
β β β β βββ commands.js
β β β β βββ discord.js
β β β β βββ followage.js
β β β β βββ uptime.js
β β β βββ leagueOfLegends/ # League of Legends commands
β β β β βββ currentgame.js
β β β β βββ rank.js
β β β β βββ runes.js
β β β βββ moderation/ # Moderation commands
β β β β βββ delquote.js
β β β β βββ runq.js
β β β β βββ setGame.js
β β β β βββ setTitle.js
β β β βββ spotify/ # Spotify commands
β β β βββ songrequest.js
β β βββ events/ # Event handlers for the chatbot
β β β βββ connected.js # Handler for connection events
β β β βββ message.js # Handler for message events
β β βββ handlers/ # Handlers for various chatbot tasks
β β β βββ aliasHandler.js
β β β βββ commandHandler.js
β β β βββ cooldownHandler.js
β β β βββ keywordHandler.js
β β β βββ permissionHandler.js
β β βββ utils/ # Utility functions
β β βββ refreshSpotifyToken.js
β βββ node_modules/
β βββ templates/
β β βββ exampleCommand.js
β βββ main.js
β βββ package-lock.json
β βββ package.json
βββ webServer/
β βββ logs/ # Directory for webserver logs
β β βββ console.log
β β βββ info.log
β βββ node_modules/
β βββ public/ # Public static files
β β βββ callback.html # OAuth callback page
β β βββ leagueRank.html # League rank overlay
β β βββ now-playing.html # Now playing overlay
β βββ routes/ # Routes for the web server
β β βββ league.js # Routes for League of Legends integration
β β βββ spotify.js # Routes for Spotify integration
β β βββ twitch.js # Routes for Twitch integration
β βββ main.js # Main entry point for the web server
β βββ package-lock.json
β βββ package.json
βββ dataStorage/
β βββ followage.json # Stored followage data
β βββ lolAccounts.json # Stored League of Legends account data
β βββ quotes.json # Stored quotes
βββ node_modules/
βββ global.js # Global configuration loader
βββ LICENSE # License file
βββ logger.js # Shared logging utility
βββ .env # Environment variables
βββ .gitignore # Git ignore file
βββ package-lock.json # NPM lock file
βββ package.json # NPM package file
βββ setup.js # Setup script for initializing the project
βββ workspaceStart.config.js # PM2 configuration for starting the project
Feel free to fork this repository and submit pull requests. For major changes, please open an issue first to discuss what you would like to change.
This project is licensed under the MIT License. See the LICENSE file for details.
Enjoy your enhanced Twitch streaming experience! π