Skip to content

Latest commit

 

History

History
247 lines (186 loc) · 7.08 KB

README.md

File metadata and controls

247 lines (186 loc) · 7.08 KB


dota-ihl-bot

node Travis (.org) Coveralls github David Greenkeeper badge Snyk badge GitHub Discord

A Discord bot for hosting Dota 2 inhouse leagues.

Need help? Check the wiki or create an issue.

Table of Contents

Features

  • Matchmaking Discord bot
  • League settings customization
  • Multiple lobby queue options
    • Player Draft - Automatically selected captains take turns picking teams
    • Autobalanced - Automatically created teams based on badge or inhouse Elo rating
    • Challenge - Players challenge each other to captain—followed by player draft
  • Dota 2 lobby hosting
  • Match stats tracking
    • Leaderboard
    • Inhouse Elo rating

Requirements

Local Setup

Installation

Runtime

Docker Setup

Getting Started

Clone the dota-ihl-bot repository.

# Clone this repository
$ git clone https://github.com/devilesk/dota-ihl-bot

dota-ihl-bot uses the dotenv module to load environment variables from a .env file, so you'll need to create one now.

# Create an empty .env configuration file
$ touch .env

Use the following template to fill in your .env file. Check the wiki page for more details.

DB_NAME=ihl
DB_USERNAME=postgres
DB_PASSWORD=password
DB_HOST=127.0.0.1
DB_PORT=5432
DB_LOG_SQL=false

MATCH_POLL_INTERVAL=5000
STEAM_API_KEY=

TOKEN=
COMMAND_PREFIX=!
OWNER_DISCORD_ID=

LOGGER_SILENT=false
LOGGER_LEVEL=debug
LOGGER_EXCEPTIONLOGFILE=exceptions.log
LOGGER_DIRNAME=logs
LOGGER_FILENAME=application-%DATE%.log
LOGGER_DATEPATTERN=YYYY-MM-DD-HH
LOGGER_ZIPPEDARCHIVE=true
LOGGER_MAXSIZE=20m
LOGGER_MAXFILES=14d

CLIENT_ID=
CLIENT_SECRET=
CALLBACK_URL=
PORT=
STEAM_RETURN_URL=
STEAM_REALM=

If you want to install and run everything locally yourself, then continue to Local Setup.

If you want to install and run with Docker, then skip to Docker Setup.

Local Setup

Install the dota-ihl-bot package.

# Go into the repository
$ cd dota-ihl-bot

# Delete dependency lock file
$ rm package-lock.json

# Install dependencies
$ npm install
  • Note: package-lock.json is deleted before running npm install to work around current bugs with npm failing to install git dependencies.

    # Not deleting package-lock.json gives an error
    $ npm install
    npm ERR! code ENOLOCAL
    npm ERR! Could not install from "node_modules/steam/steam-resources@github:seishun/node-steam-resources#v1.2.0" as it does not contain a package.json file.

    Alternatively, just running npm ci to install will work.

Create the Postgres database.

# Create PostgreSQL database and run migrations
$ npm run db:init

Now you're ready to start the bot.

# Run the bot
$ npm start

Docker Setup

First, you'll need to build the docker container.

# Build the docker container
$ make

Now you can run the container and start developing in it.

# Run the container for development
$ make dev

To run in production, you'll need a .env file called .env.production.

# Run with production configuration
$ make prod

Documentation

Check the wiki for user documentation.

Bot command README documentation in commands/<group> folders:

Code documentation hosted on github pages and generated using JSDoc.

# Generate docs
$ npm run docs

Tests

$ npm test

Built With

Major dependencies:

Testing:

Acknowledgements

Thanks to the Reddit Dota 2 League for support and testing!

License

forthebadge