A Discord bot for Foxhole damage calculations
AedileBot is a Discord bot designed for the Foxhole gaming community, providing damage calculations and bunker health analysis tools.
- π―Advanced Damage Calculations - Combat math for weapons vs. targets
- π°Bunker Analysis Tools - Complex health, mitigation, and repair cost calculations
- π§ Intelligent Fuzzy Matching - Natural language processing for user-friendly commands
- β‘Discord Slash Commands - Modern interface with autocomplete functionality
- π³Docker Support - Easy deployment and scaling
- Quick Start
- Installation
- Configuration
- Usage
- Core Commands
- Dependencies
- Deployment
- Troubleshooting
- Contributing
- License
-
Invite the Bot (if hosted):
[Bot invitation link will be provided by maintainers] -
Basic Usage:
/kill target:Silverhand weapon:75mm /bunker_kill weapon:satchel total_size:15 tier:Tier 3 /help
-
Clone and Setup:
git clone https://github.com/your-repo/aedilebot.git cd aedilebot cp src/.env.sample src/.env # Edit src/.env with your Discord bot token
-
Run with Docker:
docker compose up -d
-
Invite Bot to Server:
- Use Discord Developer Portal to get bot invitation link
- Ensure bot has necessary permissions (Send Messages, Use Slash Commands)
- Python 3.12+ (for manual installation)
- Docker & Docker Compose (for containerized deployment)
- Discord Bot Token from Discord Developer Portal
-
Clone the repository:
git clone https://github.com/your-repo/aedilebot.git cd aedilebot -
Configure environment:
cp src/.env.sample src/.env
Edit
src/.env:DEPLOYMENT_TOKEN=your_production_bot_token_here DEV_SERVER_TOKEN=your_development_bot_token_here
-
Set Discord bot token for Docker:
export DISCORD_BOT_TOKEN=your_bot_token_here -
Deploy with Docker Compose:
docker compose up -d
-
Verify deployment:
docker compose logs aedile
-
Clone and setup Python environment:
git clone https://github.com/your-repo/aedilebot.git cd aedilebot python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install dependencies:
pip install -r requirements.txt
-
Configure environment:
cp src/.env.sample src/.env # Edit src/.env with your bot tokens -
Run the bot:
cd src python main.py
Configure the bot using the src/.env file:
| Variable | Description | Required |
|---|---|---|
DEPLOYMENT_TOKEN |
Discord bot token for production | Yes |
DEV_SERVER_TOKEN |
Discord bot token for development | Optional |
https_proxy |
HTTP proxy URL if needed | Optional |
-
Create Application:
- Go to Discord Developer Portal
- Create new application and bot
- Copy bot token to your
.envfile
-
Bot Permissions: Required permissions for the bot:
Send MessagesUse Slash CommandsEmbed LinksRead Message History
-
Invite Bot: Generate invitation URL with required permissions and add to your Discord server.
AedileBot supports both slash commands and natural language queries. Below are the available commands with examples and detailed descriptions:
- Purpose: Display help information and available commands.
- Example:
Displays a list of all available commands and their usage.
/help
- Purpose: Calculate shots needed to kill a target.
- Parameters:
target(string, required): Target name with autocomplete.weapon(string, required): Weapon name with autocomplete.
- Example:
Result: It takes 3 75mm to kill a Silverhand - Mk. IV (SvH)
/kill target:Silverhand weapon:75mm
- Purpose: Show detailed statistics for any entity (weapons, vehicles, or structures).
- Parameters:
entity(string, required): Entity name with autocomplete.
- Example:
Displays health, mitigation, and repair costs for the specified entity.
/statsheet entity:Bunker Core
- Purpose: Advanced bunker damage calculations.
- Parameters:
weapon(string, required): Weapon for attack.total_size(integer, required): Total bunker pieces (including garrisons).tier(choice, required): Bunker tier (1, 2, or 3).green_dots(integer, optional): Internal edges (estimated if not provided).red_dots(integer, optional): External edges (estimated if not provided).mg,atg,howi, etc. (integer, optional): Number of each garrison type.
- Example:
Result: It takes 61 Alligator Charge to kill a meta with 24225 health (56.94% breachable) and 1800 bmat repair cost (13.46 health/bmat) (tier 3, 15 pieces, 22 green, 16 red, 2 mg, 1 atg, 1 hg) (red or green estimated due to not being specified)
/bunker_kill weapon:satchel total_size:15 tier:Tier 3 mg:2 atg:1 howi:1
AedileBot understands natural language for intuitive usage:
-
Examples:
How many 40mm to kill trench? How much 150mm to destroy Patridia? How many satchels to kill t3 bunker core husk? How many 68mm to disable HTD?The bot uses fuzzy matching to understand variations in spelling and terminology.
The bot uses JSON databases for game data:
data/Weapons.json- Weapon statistics and damage typesdata/Targets.json- Vehicle and structure datadata/Damage.json- Damage type mitigation valuesdata/Location_names.json- Town and relic names
The DamageCalculator class handles:
- Damage mitigation based on target type and weapon damage type
- Bunker complexity modeling with structural integrity calculations
- Multi-tier structure support with different mitigation values
- Veterancy and location bonuses for enhanced accuracy
Core Python packages (see requirements.txt):
discord>=2.0.0 # Discord API integration
fuzzywuzzy>=0.18.0 # Fuzzy string matching
python-levenshtein>=0.12.0 # String distance calculations
python-dotenv>=0.19.0 # Environment variable management
dnspython>=1.16.0 # DNS resolution
PyNaCl>=1.4.0 # Voice support (optional)
async-timeout>=3.0.1 # Async operation timeouts-
Prepare production environment:
# Clone repository git clone https://github.com/your-repo/aedilebot.git cd aedilebot # Set production token export DISCORD_BOT_TOKEN=your_production_token
-
Deploy with Docker Compose:
docker compose up -d
-
Monitor deployment:
# Check logs docker compose logs -f aedile # Check status docker compose ps
-
Update deployment:
git pull origin main docker compose down docker compose up -d --build
-
Setup production environment:
# Create dedicated user sudo useradd -m -s /bin/bash aedilebot sudo su - aedilebot # Clone and setup git clone https://github.com/your-repo/aedilebot.git cd aedilebot python -m venv venv source venv/bin/activate pip install -r requirements.txt
-
Configure systemd service (Linux):
# /etc/systemd/system/aedilebot.service [Unit] Description=AedileBot Discord Bot After=network.target [Service] Type=simple User=aedilebot WorkingDirectory=/home/aedilebot/aedilebot/src Environment=PATH=/home/aedilebot/aedilebot/venv/bin ExecStart=/home/aedilebot/aedilebot/venv/bin/python main.py Restart=always [Install] WantedBy=multi-user.target
-
Start and enable service:
sudo systemctl daemon-reload sudo systemctl enable aedilebot sudo systemctl start aedilebot
# Check bot status
docker compose logs aedile
# Common causes:
# - Invalid bot token
# - Missing permissions
# - Network connectivity issuesSolutions:
- Verify bot token in
.envfile - Check bot permissions in Discord server
- Ensure bot is online in Discord Developer Portal
The application did not respond
Solutions:
- Ensure slash commands are synced:
# Check logs for: "Synced X commands" - Wait up to 1 hour for Discord to propagate commands globally
- Try commands in DM with bot first
This weapon does no damage to this entity
Solutions:
- Check weapon and target names with
/statsheet - Verify entities exist in database
- Some combinations may be intentionally impossible
# Monitor memory usage
docker stats aedileSolutions:
- Increase container memory limits
- Restart bot periodically for memory cleanup
- Consider upgrading server specifications
Enable debug mode by setting in src/main.py:
utils.debugging = TrueThis provides detailed calculation logs and error information.
We welcome contributions to AedileBot! Whether you're fixing bugs, adding features, or improving documentation, your help makes the project better for everyone.
-
Fork and clone:
git fork https://github.com/your-repo/aedilebot.git git clone https://github.com/your-username/aedilebot.git cd aedilebot -
Setup development environment:
python -m venv venv source venv/bin/activate # Windows: venv\Scripts\activate pip install -r requirements.txt
-
Configure development bot:
cp src/.env.sample src/.env # Add your development bot token to DEV_SERVER_TOKEN
- Python Style: Follow PEP 8 guidelines
- Documentation: Add docstrings for new functions and classes
- Testing: Test changes with various weapon/target combinations
- Commit Messages: Use clear, descriptive commit messages
aedilebot/
βββ src/ # Main application code
β βββ main.py # Entry point and utilities
β βββ bot.py # Discord bot interface and commands
β βββ calculator.py # Damage calculation engine
β βββ parse.py # Data parsing and management
β βββ fuzzy.py # Fuzzy matching algorithms
β βββ utils.py # Utility functions
βββ data/ # Game data files
β βββ Weapons.json # Weapon statistics
β βββ Targets.json # Vehicle/structure data
β βββ Damage.json # Damage type definitions
β βββ *.json # Other game data
βββ scripts/ # Data processing scripts
βββ data_manual/ # Manual data overrides
βββ docs/ # Documentation
-
Game Data Updates:
- Currently undocumented
-
New Commands:
- Add command handler in
src/bot.py - Implement calculation logic in
src/calculator.py - Add fuzzy matching support in
src/fuzzy.py
- Add command handler in
-
Calculation Improvements:
- Modify
DamageCalculatorclass - Update damage type handling
- Add new mitigation calculations
- Modify
-
Create feature branch:
git checkout -b feature/your-feature-name
-
Make changes and test:
# Test your changes thoroughly python src/main.py -
Commit and push:
git add . git commit -m "Add: descriptive commit message" git push origin feature/your-feature-name
-
Create Pull Request:
- Describe changes and motivation
- Include testing steps
- Reference any related issues
When reporting bugs or requesting features:
- Use GitHub Issues with appropriate labels
- Include reproduction steps for bugs
- Provide context for feature requests
- Check existing issues to avoid duplicates
This project is licensed under the GNU Affero General Public License v3.0 (AGPL-3.0).
- β Commercial use allowed
- β Modification allowed
- β Distribution allowed
- β Private use allowed
- βNetwork use is distribution - source must be provided
- βSame license required for derivatives
- βState changes must be documented
See the LICENSE file for complete terms and conditions.
This project uses several open-source libraries:
- Discord.py: MIT License
- FuzzyWuzzy: GPL v2 License
- Python-Levenshtein: GPL v2 License