Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/cdc-bot/main/llms.txt

Use this file to discover all available pages before exploring further.

CDC Bot is a Python application built on discord.py. Running it yourself requires Python, the required packages, and a Discord bot token.

Prerequisites

  • Python 3.10 or later
  • A Discord bot application with a valid bot token
  • The bot application must have the following intents enabled in the Discord Developer Portal: Server Members Intent, Message Content Intent, and all other intents (the bot uses discord.Intents.all())

Installation

1

Clone the repository

git clone https://github.com/cdc-bot/main.git
cd main
2

Install dependencies

CDC Bot depends on discord.py. Install it using pip:
pip install discord.py
3

Set the bot token

CDC Bot reads its Discord token from the CDC_TOKEN environment variable:
export CDC_TOKEN="your-bot-token-here"
Replace your-bot-token-here with the token from the Discord Developer Portal.
4

Start the bot

python main.py
The bot prints ready when it has connected and loaded all extensions.

Environment variables

VariableRequiredDescription
CDC_TOKENYesDiscord bot token. Obtain from the Discord Developer Portal.
CDC_DEBUGNoSet to 1 to enable debug logging and restrict slash command registration to a test guild.

Data files

CDC Bot writes data to JSON files in the same directory it runs from:
FileContents
currency.jsonAll user balances, inventories, and job assignments
marriages.jsonAll active marriages and cheating records
preferences.jsonPer-user preference settings
server-preferences.jsonPer-server configuration settings
Back up these JSON files regularly to avoid data loss if the host machine has issues.

Syncing slash commands

By default, CDC Bot does not call bot.tree.sync() on startup (it is commented out). A bot owner can trigger a sync using the /dev sync command while the bot is running. This registers all slash commands with Discord globally.
The /dev command is restricted to the hardcoded owner user ID. Only the original bot owner can run it.

Keeping the bot running

For production use, run CDC Bot under a process manager to restart it if it crashes:
systemd service example
[Unit]
Description=CDC Bot
After=network.target

[Service]
Type=simple
WorkingDirectory=/path/to/cdc-bot
Environment=CDC_TOKEN=your-token-here
ExecStart=/usr/bin/python3 main.py
Restart=on-failure

[Install]
WantedBy=multi-user.target

Build docs developers (and LLMs) love