Skip to content

Latest commit

Β 

History

History
165 lines (134 loc) Β· 6.55 KB

README.md

File metadata and controls

165 lines (134 loc) Β· 6.55 KB

Twitch Bot Project

Node.js npm JavaScript

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.

Features

  • 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.

Prerequisites

  • Node.js (v23.1.0 or higher)
  • npm (Node Package Manager)
  • pm2 (Process Manager for Node.js)

Dependencies

  • dotenv
  • twitchbot
  • inquirer
  • axios
  • express
  • body-parser
  • qs
  • concurrently

Setup Instructions

1. Clone the Repository

First, clone the repository to your local machine:

git clone https://github.com/Timmsy1998/nodejs-twitch-bot.git
cd nodejs-twitch-bot

2. Install Dependencies

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.

3. Configure Environment Variables

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.

4. Start the Bot and Web Server

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.

Directory Structure

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

Contributing

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.

License

This project is licensed under the MIT License. See the LICENSE file for details.


Enjoy your enhanced Twitch streaming experience! πŸš€