Quantum Bank is a feature-rich Discord economy bot with advanced banking features, built using Discord.py and MongoDB.
- ๐ฆ Complete banking system with accounts, transactions, and interest
- ๐ฐ Multiple account types (Savings, Checking, Fixed Deposits)
- ๐ณ Credit system with credit scores and loan management
- ๐น Advanced economy features including investments and stock market simulation
- ๐ฎ Economy-based minigames and activities
- ๐ Secure transactions with detailed logging
- ๐ User-friendly statistics and leaderboards
- ๐จ Colorful console logs with JSON formatting
- ๐ Seamless MongoDB integration for reliable data storage
- โก High performance design with sharding and clustering support
/create_account - Create a new bank account with KYC verification
/balance - Check your current bank account balance
/passbook - Check your account balance and view your passbook
/view_transactions - View your transaction history
/view_account_details - View your account details
/apply_loan amount:1000 term_months:12 - Apply for a personal loan
/repay_loan amount:100 - Make a payment towards your loan
/loan_status - Check your loan status
/credit_score - Check your credit score and credit history
/credit_report - View your detailed credit report
/generate_upi - Generate a UPI ID for your account
/change_branch new_branch:"New York" - Change your bank branch
/loan_calculator amount:5000 term_months:24 - Calculate loan payments
- Python 3.8 or higher
- MongoDB database (local or Atlas)
- Discord Bot Token
-
Clone the repository:
git clone https://github.com/your-username/quantum-bank-bot.git cd quantum-bank-bot -
Install uv if you don't have it yet:
curl -LsSf https://astral.sh/uv/install.sh | shOr on Windows:
powershell -c "irm https://astral.sh/uv/install.ps1 | iex" -
Install the package with dependencies (uv will automatically create a virtual environment):
uv pip install -e "."For development setup, include development dependencies:
uv pip install -e ".[development]" -
Create a
.envfile in the root directory with the following variables:BOT_TOKEN=your_discord_bot_token MONGO_URI=your_mongodb_connection_string MAL_CLIENT_ID=your_myanimelist_client_id # Optional, for anime commands ACTIVITY_STATUS=Quantum Bank | /help # Custom status DEBUG=false # Set to true for debug mode -
Run the bot using uv scripts:
uv run run
Or with debug mode:
uv run run-debug
The project includes several useful commands:
# Run the bot
python -m launcher
# Run the bot in debug mode
python -m launcher --debug
# Run the bot with high performance settings
python -m launcher --performance high
# Run the bot with verbose logging
python -m launcher --log-level verbose
# Run the bot with quiet logging (only warnings and errors)
python -m launcher --log-level quiet
# Run tests
pytest
# Run only unit tests
pytest tests/unit
# Run only integration tests
pytest tests/integration
# Run tests with coverage report
pytest --cov=./ --cov-report=term
# Run linting
ruff check .
# Format code
black .
# Check formatting without changing files
black --check .
# Fix linting issues and format code in one command
ruff check --fix . && black .After installation via uv pip install -e ".", you can also run:
# Run the bot using the entry point
quantum-bankQuantum Bank supports advanced configuration options for scaling and performance. These can be accessed using specialized scripts:
# Run with high performance mode
uv run run-performance-high
# Run with verbose logging
uv run run-verbose
# Run with quiet logging (only warnings and errors)
uv run run-quiet
# Run with debug mode
uv run run-debugFor more specific configurations, you'll need to use the launcher directly:
# Run with specific number of shards
python -m launcher --shards 3
# Run as part of a cluster
python -m launcher --cluster 0 --clusters 3
# Combine multiple options
python -m launcher --performance high --log-level verbose --shards 3You can also configure these options via environment variables in your .env file:
BOT_TOKEN=your_discord_bot_token
MONGO_URI=mongodb://username:password@host:port/dbname
DEBUG=false
PERFORMANCE_MODE=medium # Options: low, medium, high
SHARD_COUNT=1
The bot can be easily deployed using Docker:
# Build and run using docker-compose (development mode)
docker-compose --profile dev up -d
# Build and run using docker-compose (production mode)
docker-compose --profile prod up -d
# View logs
docker-compose logs -f botFor custom configurations, edit the .env file or override environment variables in docker-compose.yml.
- Bot: Main Discord bot service
- MongoDB: Database for storing accounts, transactions, etc.
- Redis: Optional caching and shared state for clustered deployments
For multiple bot instances (clustered deployment):
# Scale to 3 bot instances in production mode
docker-compose --profile prod up -d --scale bot=3Don't forget to properly configure your .env with appropriate sharding settings.
For production use on a VPS, we recommend:
- A VPS with at least 1GB RAM
- Setting up a systemd service for auto-restart
- Using a monitoring solution like PM2
Example systemd service file (/etc/systemd/system/quantum-bank.service):
[Unit]
Description=Quantum Bank Discord Bot
After=network.target
[Service]
User=quantum
WorkingDirectory=/opt/quantum-bank
ExecStart=/usr/bin/python3 -m launcher --performance medium
Restart=always
RestartSec=10
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=quantum-bank
[Install]
WantedBy=multi-user.targetEnable and start the service:
sudo systemctl enable quantum-bank
sudo systemctl start quantum-bankContributions are welcome! Please see CONTRIBUTING.md for guidelines.
This project is licensed under the MIT License - see the LICENSE file for details.
- Discord.py
- Motor
- All contributors who have helped to improve this project
