Skip to content

Initial project setup

Oleg Ovcharenko edited this page Feb 22, 2022 · 1 revision
  1. Grab the code at https://github.com/UncleVasya/Dota2-EU-Ladder

  2. Install python 3.7.1 or newer: https://www.python.org/downloads/release/python-379/

  3. Install virtual environments manager for python:

pip install virtualenv
  1. In the project folder create virtualenv:
virtualenv .virtualenv

This should create a .virtualenv folder inside project folder.

  1. Activate virtualenv:
.virtualenv\Scripts\activate.bat

If successful, you will have (.virtualenv) at the start of your command line.


All commands to work with project/bots/website should be ran from virtualenv.


  1. Install dependencies for the project:
pip install -r requirements.txt
  1. Create a database:
python manage.py migrate

Now you should have a db.sqlite3 file in the project folder.

  1. Try to run inhouse website:
python manage.py runserver

This will give you the link, you can open it to see if it works.

  1. Keep that cmd window running, open a new one. Don't forget to activate virtualenv.

  2. In the new cmd let's create an admin user:

python manage.py createsuperuser

Now you are able to login to http://localhost:8000/admin Nothing to do there yet.


  1. Create a few steam accounts for the bot. Bot logins and passwords should be the same, just add a number after each one. For example
login: clarity_ih1, password: clarity_potion1
login: clarity_ih2, password: clarity_potion2
login: clarity_ih3, password: clarity_potion3

3 should be enough, at least for the start.

  1. Create a discord bot account here: https://discord.com/developers/applications Invite it to your server.

  2. Add bots credentials. Open .virtualenv/Scripts/activate.bat in a text editor. Add these lines after set ... line:

set "BOT_LOGIN=***"
set "BOT_PASSWORD=***"
set "LOBBY_PASSWORD=***"
set "LEAGUE_ID=***"
set "DISCORD_BOT_TOKEN=***"

Replace all *** with actual values.

  • if you don't have a dota ticket for the league you can put 0 there.
  • bot login should be a part before the number. So like clarity_ih.
  • you can get discord token on Bot tab of your discord bot page.
  1. re-activate virtualenv for it to pick up new environment variables:
deactivate
.virtualenv/Scripts/activate.bat

  1. Setup ih channels on discord. Bot needs 5 channels:
  • #inhouse-queue - main channel for players to join, leave and view queues
  • #inhouse-chat - players can use bot commands there.
  • #inhouse-polls - outdated, but I was too lazy to remove it from the code;
  • #open-queue - admin channel for the open queue (here admins can use commands to remove or add players to the queue);
  • #elite-queue - admin channel for the elite queue;

Last 3 channels can be hidden from non-admins.

  1. Now we need to let bot know about our discord channels.

In website admin panel (localhost:8000/admin) there is Discord Channels setting. Add ids of discord channels.

To see discord channel id, turn on developer mode in discord settings => Appearance => Advanced (scroll to the bottom of the page). Now you can click right mouse button on every thing in discord to see its id.

  1. Add discord queue channels to admin panel. Create a QueueChannel object for both queue channels: https://images2.imgbox.com/31/4c/ZOhWbRQE_o.png

Also when creating bot steam accounts you have to disable 2FA for each of them.

  1. Let's try and start our discord bot:
python manage.py discord_bot

If all good, it should respond to commands. Try !register in inhouse-chat.

  1. Keep that cmd window running, open a new one and let's start a dota bot:
python manage.py dota_bot -n 2

n is the number of bots.


  1. Random tips:
  • you can change dota lobby name in admin panel => Ladder settings;
  • after you registered as a player in inhouse-chat, you can go to admin => Players => Crispy Bacon and checkmark bot access to give yourself admin perms for discord and dota bots.
  • as you see, you'll always have cmd windows open with scripts running: website, discord bot, dota bot.

This instruction might look long and scary but once you started doing steps you will see that it's not that difficult. ☺️

Clone this wiki locally