A Discord bot that manages tournament registrations using PostgreSQL. The bot integrates with Matcherino to track tournament participants and provides admin commands to manage registrations.
- User Registration: Users can register for tournaments using
/register
command - Role Assignment: Automatically assigns a "Registered" role to registered users
- Admin Commands: Admins can view and manage registered users
- Matcherino Integration: Syncs with Matcherino tournament data
- PostgreSQL Database: All registration data is stored in a PostgreSQL database
- Clone this repository:
git clone <repository-url>
cd matcherino-bot
- Create a virtual environment and install dependencies:
python -m venv venv
source venv/bin/activate # On Windows: .\venv\Scripts\Activate.ps1
pip install -r requirements.txt
- Create a
.env
file in the root directory with your credentials:
BOT_TOKEN=your_discord_bot_token
DATABASE_URL=postgresql://username:password@localhost/database_name
MATCHERINO_TOURNAMENT_ID=your_tournament_id
- Run the bot:
python bot.py
- Clone this repository:
git clone <repository-url>
cd matcherino-bot
-
Create an
.env
file with your credentials (see above) -
Build and run with Docker Compose:
docker-compose up -d
- Create a directory for your configuration:
mkdir -p matcherino_bot
cd matcherino_bot
- Create a
.env
file with your credentials:
BOT_TOKEN=your_discord_bot_token
DATABASE_URL=postgresql://postgres:your_password@db/matcherino
MATCHERINO_TOURNAMENT_ID=your_tournament_id
GITHUB_USERNAME=yourusername # Replace with the GitHub username of the container owner
- Download the docker-compose file and start the containers:
curl -O https://raw.githubusercontent.com/yourusername/matcherino-bot/main/docker-compose.ghcr.yml
docker-compose -f docker-compose.ghcr.yml up -d
The bot automatically creates the necessary tables on startup, but you need:
- A PostgreSQL server running
- A database created for the bot to use
- Proper connection details configured in the DATABASE_URL
/register
- Register for tournaments/check-status
- Check your registration status
!registered
- List all registered users!export
- Export registered users to CSV!sync-teams
- Manually sync teams with Matcherino
This repository includes configuration files for deploying on Unraid servers:
- Using Docker with the provided compose files
- GitHub Actions for automated deployment
- GitHub Container Registry integration
- Unraid Docker Templates
See the Unraid Deployment Guide for detailed instructions.
bot.py
- Main Discord bot codedb.py
- Database interaction and managementmatcherino_scraper.py
- Integration with Matcherino APIsync_teams.py
- Team synchronization logic- Docker and deployment configuration files
This project includes a GitHub Actions workflow that automatically:
- Builds the Docker image when you push changes
- Publishes the image to GitHub Container Registry
- Optionally deploys to your Unraid server (when configured)
To enable automatic deployment to Unraid:
- Generate an SSH key pair
- Add the public key to your Unraid server
- Add the private key and other required secrets to your GitHub repository
- Set the
UNRAID_DEPLOY
variable totrue
in repository variables
For detailed setup instructions, see the Unraid Deployment Guide.
- Fork the repository
- Create a feature branch
- Commit your changes
- Push to the branch
- Create a new Pull Request
MIT