A Discord bot for managing Pokémon draft tournaments with Google Sheets integration.
- Read tournament format metadata from Google Sheets
- Automatically create Discord channels and roles for tournaments
- Interactive draft system with dropdown menus
- Pick validation and Google Sheets updates
- Tournament state management
pip install -r requirements.txt- Go to Discord Developer Portal
- Create a new application
- Go to the "Bot" section and create a bot
- Copy the bot token
- Enable the following bot permissions:
- Read Messages/View Channels
- Send Messages
- Manage Channels
- Manage Roles
- Use Slash Commands
- Read Message History
- Invite the bot to your server with the appropriate permissions
You have two options for authentication:
- Go to Google Cloud Console
- Create a new project or select an existing one
- Enable the Google Sheets API
- Go to "Credentials" → "Create Credentials" → "Service Account"
- Create a service account and download the JSON key file
- Save the JSON file as
credentials.jsonin the project root - Share your Google Sheet with the service account email (found in the JSON file)
- Go to Google Cloud Console
- Create a new project or select an existing one
- Enable the Google Sheets API
- Go to "Credentials" → "Create Credentials" → "OAuth 2.0 Client ID"
- Choose "Desktop app" as the application type
- Download the credentials and save as
credentials.json - Run the OAuth setup script:
python setup_oauth.py
- This will open a browser window for authentication
- After authentication, a
token.jsonfile will be created
Create a .env file in the project root:
DISCORD_BOT_TOKEN=your_discord_bot_token_here
GOOGLE_SHEETS_ID=your_google_sheet_id_here
GOOGLE_CREDENTIALS_FILE=credentials.json
TOURNAMENT_ROLE_PREFIX=Tournament
DRAFT_CHANNEL_NAME=draftTo find your Google Sheet ID:
- Open your Google Sheet
- Look at the URL:
https://docs.google.com/spreadsheets/d/SHEET_ID_HERE/edit - The
SHEET_ID_HEREis what you need
Your Google Sheet should have at least two sheets:
Contains the list of available Pokémon with headers in the first row:
| Name | Tier | ... |
|---|---|---|
| Charizard | OU | ... |
| Pikachu | OU | ... |
- First row must contain headers (Name, Tier, etc.)
- Each subsequent row is a Pokémon
- The "Name" column is required
This sheet will be auto-created with headers if it doesn't exist:
- User
- Pokemon
- Round
- Pick
- Timestamp
python bot.py-
!draft [pokemon]- Draft a Pokémon- Without arguments: Opens a dropdown menu to select from available Pokémon
- With argument: Directly drafts the specified Pokémon (e.g.,
!draft Charizard) - Only works when it's your turn to draft
-
!status- View current draft status- Shows current round, pick number, recent picks, and who's up next
-
!setup- Set up tournament channels and roles- Creates a draft channel (default name: "draft")
- Creates a tournament participant role
-
!startdraft [@user1] [@user2] ...- Start a new draft- Specify participants by mentioning them
- If no participants are specified, uses members with the tournament role
- Requires at least 2 participants
- Example:
!startdraft @Player1 @Player2 @Player3
- Admin runs
!setupto create channels and roles - Admin adds participants to the tournament role (or mentions them in
!startdraft) - Admin runs
!startdraftto begin the draft - Players use
!draftwhen it's their turn - The bot validates picks, updates Google Sheets, and announces selections
- Draft continues in snake format until all rounds are complete
- "Google Sheets is not configured": Check that
GOOGLE_SHEETS_IDis set in.envandcredentials.jsonexists - "Unable to authenticate": Ensure your credentials file is valid and the sheet is shared with the service account (if using service account)
- "No active draft": Run
!startdraftfirst - "It's not your turn": Wait for your turn in the draft order