Skip to content

ak811/bomb-party

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Bomb Party (Discord Bot)

A Discord bot that runs a Bomb Party–style word game in a designated channel. Players join a lobby, then compete across multiple rounds by submitting English words that contain a displayed letter sequence.

  • Built with discord.py 2.4.0
  • Uses a local JSON dictionary (data/words.json)
  • Designed for one active session per channel

Features

  • Manual start with a join lobby (buttons + commands)
  • Join/Leave UI buttons (Discord Views)
  • Think phase: players type without sending (the bot deletes messages from joined players to keep secrecy)
  • Send window: only the first message from each joined player counts
  • Duplicate-word handling: if multiple players submit the same valid word, points are split evenly
  • Configurable timings and round settings via config/constants.py

How the game works

Each round:

  1. Bot posts a sequence (e.g. art)
  2. Think phase begins (default: 8s)
    • If players send messages early, the bot attempts to delete those messages (joined players only)
  3. Send phase begins (default: 3.5s)
    • Players send one message; only the first word is used
  4. Bot validates:
    • Word contains the sequence
    • Word exists in the bot’s dictionary (with simple plural handling)
  5. Bot awards points and posts round results

At the end, the bot posts a leaderboard.


Requirements

  • Python 3.10+ (recommended; zoneinfo is in stdlib and discord.py supports 3.10+ well)
  • A Discord application + bot token
  • Permissions to:
    • Read/Send Messages
    • Manage Messages (optional but strongly recommended for think-phase deletions)
    • Embed Links

Dependencies are pinned in requirements.txt:

  • discord.py==2.4.0
  • python-dotenv==1.0.1

Setup

1) Create a Discord Bot

In the Discord Developer Portal:

  1. Create an application
  2. Add a bot user
  3. Copy the bot token (keep it secret)

Enable Privileged Gateway Intents (very important):

  • Message Content Intent (required to read answers)
  • Server Members Intent (used by this bot)

The code sets:

  • intents.message_content = True
  • intents.members = True

2) Configure .env

Copy .env.example to .env:

cp .env.example .env

Edit .env:

DISCORD_BOT_TOKEN="your_token_here"
COMMAND_PREFIX=!

3) Set the game channel ID

The bot restricts commands to a single channel ID:

File: config/constants.py

BOMB_PARTY_CHANNEL_ID = 1424518289626894468

Replace it with your channel’s ID:

  1. Enable Developer Mode in Discord
  2. Right-click the channel → Copy Channel ID
  3. Paste it into BOMB_PARTY_CHANNEL_ID

4) Install and run

python -m venv .venv
# Windows:
.venv\Scripts\activate
# macOS/Linux:
source .venv/bin/activate

pip install -r requirements.txt
python bot.py

Usage

All commands must be used in the configured Bomb Party channel.

Commands

  • !bomb_party (or !bm)
    Shows help.

  • !bomb_party start
    Opens a join lobby for JOIN_WINDOW_SECONDS (default: 30s).
    The creator auto-joins. The game starts if at least 2 players joined.

  • !bomb_party join
    Joins the currently open lobby.

  • !bomb_party leave
    Leaves the currently open lobby.

You can also join/leave using the Join / Leave buttons on the lobby message.


Configuration

File: config/constants.py

Key settings:

  • TIME_TO_ANSWER (default: 8)
    Think phase length.

  • SEND_WINDOW_SECONDS (default: 3.5)
    How long players have to send after think ends.

  • TIME_BETWEEN_QUESTIONS (default: 3)
    Gap between rounds.

  • ROUNDS_PER_GAME (default: 10)

  • ROUND_POINTS (default: 100)
    Points per valid word (split among duplicate submissions).

  • JOIN_WINDOW_SECONDS (default: 30)


Dictionary

File: data/words.json is a JSON array of words.

The bot loads this file at startup via utils/dictionary.py.

Prompt generation

Prompts are generated by selecting a random 3–5 letter word, then taking a random substring of length 3 by default.

You can tweak prompt length here:

get_random_prompt(length: int = 3)

Word validation

A submitted word is valid if:

  • It contains the prompt sequence (substring check)
  • It exists in the dictionary set, with light plural handling:
    • iesy
    • es → removed
    • s → removed

If you want stricter or more expansive validation, update is_valid_english_word().


Permissions and caveats

Think-phase message deletion

During the think phase, the bot tries to delete messages from joined players to discourage early sending.

To make this work reliably, give the bot:

  • Manage Messages permission in the game channel

If not granted, the game still works, but players can leak answers by sending early and the bot may be unable to delete them.

Abuse prevention

The bot caps deletions at 20 per think phase (MAX_DELETES = 20).


License

MIT. See LICENSE.

About

Bomb Party (Discord Bot)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages