Forked from csgo-league-bot
-
First you must have a bot instance to run this script on. Follow Discord's tutorial here on how to set one up. Be sure to invite it to a server before launch the bot.
- The required permissions is
administrator
.
- The required permissions is
-
Setup and get an API token for the CS:GO League web API along with the host base URL.
-
Install libpq-dev (Linux only?). This is needed to install the psycopg2 Python package.
- Linux command is
sudo apt-get install libpq-dev
.
- Linux command is
-
Run
pip3 install -r requirements.txt
in the repository's root directory to get the necessary libraries.- Note that python-Levenshtein requires your system to have a C++ compiler (Visual Studio C++ compiler for Windows or g++ for Linux). This library may be replaced in the future to eliminate this requirement.
-
Install PostgreSQL 9.5 or higher.
- Linux command is
sudo apt-get install postgresql
. - Windows users can download here.
- Linux command is
-
Run the psql tool with
sudo -u postgres psql
and create a database by running the following commands:CREATE ROLE csgoleague WITH LOGIN PASSWORD 'yourpassword'; CREATE DATABASE csgoleague OWNER csgoleague;
Be sure to replace
'yourpassword'
with your own desired password. -
Create an environment file named
.env
with in the repository's root directory. Fill this template with the requisite information you've gathered...DISCORD_BOT_TOKEN= #Bot token from the Discord developer portal # NOTE: Bot automatically create required channels/emojis/role DISCORD_LEAGUE_CATEGORY= # League category name DISCORD_LEAGUE_ROLE= # League role name DISCORD_LEAGUE_TEXT_QUEUE= # League queue channel name DISCORD_LEAGUE_TEXT_COMMANDS= # League commands channel name DISCORD_LEAGUE_TEXT_RESULT= # League results channel name DISCORD_LEAGUE_VOICE_LOBBY= # League lobby voice channel name DISCORD_LEAGUE_LANGUAGE=en # Bot language CSGO_LEAGUE_API_KEY= # API from the CS:GO League web backend .env file CSGO_LEAGUE_API_URL= # URL where the web panel is hosted POSTGRESQL_USER= # "csgoleague" (if you used the same username) POSTGRESQL_PASSWORD= # The DB password you set POSTGRESQL_DB= # "csgoleague" (if you used the same DB name) POSTGRESQL_HOST= # The IP address of the DB server (127.0.0.1 if running on the same system as the bot)
-
Apply the database migrations by running
python3 migrate.py up
. -
Run the launcher Python script by running,
python3 launcher.py
.
q!remove <mention>
- Remove the mentioned user from the queue
q!empty
- Empty the queue
q!cap <integer>
- Set the capacity of the queue to the specified value
q!teams <random|autobalance|captains>
- Set the team creation method
q!captains <rank|random|volunteer>
- Set the captain selection method
q!maps <random|vote|captains>
- Set the map selection method
q!mpool {+|-}<map name>
- Add/Remove maps to default map pool
q!link
- Link a player on the backend
q!unlink
- Unlink a player on the backend
q!stats
- See your stats
q!leaders
- See the top players in the server
q!check
- Check if the player has been linked his account and give him role if so
q!teams
- View the team creation method
q!captains
- View the captain selection method