All checks were successful
Build Docker Image / build (pull_request) Successful in 1m22s
Remove manual semver validation from PR checks. Versions are now auto-generated on merge to main by counting existing monthly tags. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2.6 KiB
2.6 KiB
Paper Dynasty Discord Bot
Baseball card game Discord bot. discord.py with cog-based commands, SQLModel for database ops.
Commands
python -m pytest # Run tests
python paperdynasty.py # Start bot
pip install -r requirements.txt # Install dependencies
Architecture
- Cogs (
cogs/): Command modules — gameplay, economy, players, admins - Game engine (
in_game/): Turn-based simulation, AI manager, dice mechanics, WPA calculations - UI (
utilities/): Buttons, dropdowns, embeds - Database: Production uses FastAPI database directly; dev may use separate PostgreSQL via SQLModel
Key Patterns
- Cards generated from MLB statistics with complex rating calculations
- Card ratings split by handedness (
vs_hand: 'R'or'L') - Multiple cardsets (seasons) with different priorities for gameplay
- Use factory data in testing as often as possible
Deployment & Troubleshooting
Production
- Host:
ssh sba-bots(10.10.0.88, aliaspd-bots) - Path:
/home/cal/container-data/paper-dynasty - Container:
paper-dynasty_discord-app_1 - Image:
manticorum67/paper-dynasty-discordapp - Health:
GET http://localhost:8080/health(HTTP server inhealth_server.py) - Versioning: CalVer (
YYYY.MM.BUILD) — auto-generated on merge tomain
Logs
- Container logs:
ssh sba-bots "docker logs --since 1h paper-dynasty_discord-app_1" - Log file (in container):
/usr/src/app/logs/discord.log(rotating, 32MB, 5 backups) - Dev log mount:
../dev-logs→/usr/src/app/logs
Key Env Vars
BOT_TOKEN, GUILD_ID, API_TOKEN, DATABASE (Dev/Prod), LOG_LEVEL, SCOREBOARD_CHANNEL, TZ=America/Chicago
Common Issues
- Bot not responding → check
docker logs, verifyBOT_TOKENandGUILD_ID - API errors → verify
DATABASEis set toProdorDev, checkAPI_TOKENmatches the database API - Game engine errors → check
/usr/src/app/logs/discord.logfor detailed tracebacks - Health endpoint not responding →
health_server.pyruns on port 8080 inside the container
CI/CD
Gitea Actions on PR to main — builds Docker image, auto-generates CalVer version on merge.
tea pulls create --repo cal/paper-dynasty --head <branch> --base main --title "title" --description "description"
Other Containers on Same Host
paper-dynasty_adminer_1, paper-dynasty_db_1, sba-website_sba-web_1, sba-ghost_sba-ghost_1
Development Notes
- Connect to proper docker socket when running tests
- Plans go in
./.claude/plans/with descriptive filenames