Skip to content

csgo-league/csgo-league-bot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Maintenance GitHub release PRs Welcome Open Source Love svg3

CS:GO League Bot

A Discord bot to manage CS:GO PUGs. Connects to the CS:GO League web API.

Our support discord can be found here.

Author

cameronshinn - Developer / Maintainer

Watch for releases

So as to keep the latest version of the plugin I recommend watching the repository

Watch releases

Share the love

If you appreciate the project then please take the time to star our repository.

Star us

Commands

q!help - Display the help menu

q!about - Display basic info about this bot

q!link - Link Discord account to Steam to start playing

q!unlink - Unlink Steam account and delete all user data

q!join - Join the queue

q!leave - Leave the queue

q!view - Display who is currently in the queue

q!remove <user mention> - Remove the mentioned user from the queue (need server kick perms)

q!empty - Empty the queue (need server kick perms)

q!cap [<new capacity>] - Set or view the capacity of the queue (need admin perms)

q!ban <user mention> ... [<days>d] [<hours>h] [<minutes>m] - Ban all mentioned users from joining the queue (need server ban perms)

q!unban <user mention> ... - Unban all mentioned users so they can join the queue (need server ban perms)

q!teams [{captains|autobalance|random}] - Set or view the team creation method (need admin perms)

q!captains [{volunteer|rank|random}] - Set or view the captain selection method (need admin perms)

q!maps [{captains|vote|random}] - Set or view the map selection method (need admin perms)

q!mpool {+|-}<map name> ... - Add or remove maps from the map pool (need admin perms)

q!stats - See your stats

q!leaders - See the top players in the server

Setup (Linux)

  1. First you must have a bot instance to run this script on. Follow the discord.py tutorial here on how to set one up. Be sure to invite it to a server to use it.

    • The necessary OAuth2 invite permission scopes integer is 1090808896 as shown here.

    • Enable the "server members intent" for your bot, as shown here.

  2. Setup and get an API token for the CS:GO League web API along with the host base URL.

  3. Install libpq-dev with sudo apt-get install libpq-dev. This is needed to install the psycopg2 Python package.

  4. Run pip3 install -r requirements.txt in the repository's root directory to get the necessary libraries.

  5. Install PostgreSQL 9.5 or higher with sudo apt-get install postgresql.

  6. Run the psql tool with sudo service postgresql start && 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.

  7. 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=B0tT0k3nFr0mD3v3l0p3rP0rtal
    
    CSGO_LEAGUE_API_KEY=W3bAP1K3y  # From web php.env file
    CSGO_LEAGUE_API_URL=https://MyCSGOLeagueWebsite.com
    
    POSTGRESQL_USER=csgoleague
    POSTGRESQL_PASSWORD=YourPassword  # SET YOUR OWN PASSWORD DO NOT USE THIS
    POSTGRESQL_DB=csgoleague
    POSTGRESQL_HOST=127.0.0.1  # 127.0.0.1 if running on the same system as the bot

    Optionally you may set these environment variables another way.

  8. Apply the database migrations by running python3 migrate.py up.

  9. Run the launcher Python script by calling python3 launcher.py -e {server ID}. You will only need to use the -e flag when running for the first time to create the emojis in your server (be sure to give the bot the "manage emojis" permission in your server). Look here for help finding your Discord server's ID.

Contributions

Code Style

This project adheres to the PEP8 style guide with 120 character line limits.

Branches

Create a branch if you're working on an issue with the issue number and name like so: 100_Title-Separated-By-Dashes.

Commit Messages

Phrase commits in the present tense, e.g. Fix bug instead of Fixed bug.