Skip to content

Latest commit

 

History

History
79 lines (58 loc) · 3.1 KB

README.md

File metadata and controls

79 lines (58 loc) · 3.1 KB

DEV

DevWars Bot

DevWarsBot on twitch.tv/devwars

nodejs version tmi.js version Dependabot Badge

Welcome to the DevWars Bot codebase. This bot is responsible for many interactions during a live game, such as: betting, voting, earning coins, etc.

What is DevWars?

DevWars.tv is a live game show for developers that is currently streamed on Twitch. People of all levels participate in an exhilarating battle to create the best website they can within 60 minutes. Teams are formed of 3 people, with the team's members each controlling a single language - HTML, CSS and JavaScript.

Getting Started

Prerequisites

  • Nodejs: 14.5.x
  • Twitch: Account username and oauth
  • (optional) DevWars API: Run DevWars API locally to test endpoints the bot hits

Dependency Installation

Run npm run install to install dependent node_modules.

Environment Variables

Make a copy of the .env.example file in the same directory and rename the given file to .env. This will be loaded up into the application when it first starts running. These are required configuration settings to ensure correct function. Process through the newly created file and make the required changes if needed.

Twitch Config

Make a copy of the twitch.config.example.json file and rename the given file to twitch.config.json. This will be loaded and maintained by the Twitch service, used to communicate to the api. Using a JSON file will allow the automatic updating/refreshing of the access token when it expires.

To obtain the initial accessToken and refreshToken:

  1. Register Your Application here
    • oAuth Redirect Url = http://localhost
    • Category = Chat Bot
  2. Get Code with
GET https://id.twitch.tv/oauth2/authorize
    --data-urlencode
    ?client_id=<your client ID>
    &redirect_uri=<your redirect URI>
    &response_type=code&scope=moderator:read:chatters
  1. Get accessToken and refreshToken
POST https://id.twitch.tv/oauth2/token
    ?client_id=<your client ID>
    &client_secret=<your client secret>
    &code=<authorization code received above>
    &grant_type=authorization_code
    &redirect_uri=<your redirect URI>

Testing

Running npm run test will start the testing process.

Development

Running npm start will run the bot

License

You can check out the full license here

This project is licensed under the terms of the MIT license.