From 94f3b1dc975903bfab0c656791b81d5281467c53 Mon Sep 17 00:00:00 2001 From: Cal Corum Date: Thu, 26 Mar 2026 13:04:19 -0500 Subject: [PATCH 1/2] fix: apply open-packs hotfix to cogs/economy.py Port the Check-In Player pack fix from the hotfix branch to the legacy economy.py cog (which production currently loads instead of economy_new). - Filter auto-open pack types from the manual open-packs menu - Add pretty_name fallback for hyphenated pack type names - Add ruff noqa for pre-existing star import warnings Co-Authored-By: Claude Opus 4.6 (1M context) --- cogs/economy.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/cogs/economy.py b/cogs/economy.py index ebb4058..3baecf4 100644 --- a/cogs/economy.py +++ b/cogs/economy.py @@ -1,3 +1,4 @@ +# ruff: noqa: F403, F405 import copy import helpers @@ -695,6 +696,9 @@ class Economy(commands.Cog): ) return + # Pack types that are auto-opened and should not appear in the manual open menu + AUTO_OPEN_TYPES = {"Check-In Player"} + # Group packs by type and customization (e.g. Standard, Standard-Orioles, Standard-2012, Premium) p_count = 0 p_data = { @@ -711,6 +715,11 @@ class Economy(commands.Cog): p_group = None logger.debug(f"pack: {pack}") logger.debug(f"pack cardset: {pack['pack_cardset']}") + if pack["pack_type"]["name"] in AUTO_OPEN_TYPES: + logger.debug( + f"Skipping auto-open pack type: {pack['pack_type']['name']}" + ) + continue if pack["pack_team"] is None and pack["pack_cardset"] is None: p_group = pack["pack_type"]["name"] # Add to p_data if this is a new pack type @@ -773,6 +782,9 @@ class Economy(commands.Cog): pretty_name = f"{key.split('-')[0]} - {key.split('-')[3]}" elif "Cardset" in key: pretty_name = f"{key.split('-')[0]} - {key.split('-')[3]}" + else: + # Pack type name contains a hyphen (e.g. "Check-In Player") + pretty_name = key if pretty_name is not None: embed.add_field(name=pretty_name, value=f"Qty: {len(p_data[key])}") From f704b099338a25bc9502eec80cc3eec78e5d8211 Mon Sep 17 00:00:00 2001 From: Cal Corum Date: Wed, 1 Apr 2026 11:59:44 -0500 Subject: [PATCH 2/2] chore: add .env.example with placeholder values Document all required environment variables for running the Discord bot, including bot token, API credentials, database config, and webhook URL. References paper-dynasty-database#9 --- .env.example | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 .env.example diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..2ae2d0e --- /dev/null +++ b/.env.example @@ -0,0 +1,54 @@ +# Paper Dynasty Discord Bot - Environment Configuration +# Copy this file to .env and fill in your actual values. +# DO NOT commit .env to version control! + +# ============================================================================= +# BOT CONFIGURATION +# ============================================================================= + +# Discord bot token (from Discord Developer Portal) +BOT_TOKEN=your-discord-bot-token-here + +# Discord server (guild) ID +GUILD_ID=your-guild-id-here + +# Channel ID for scoreboard messages +SCOREBOARD_CHANNEL=your-scoreboard-channel-id-here + +# ============================================================================= +# API CONFIGURATION +# ============================================================================= + +# Paper Dynasty API authentication token +API_TOKEN=your-api-token-here + +# Target database environment: 'dev' or 'prod' +# Default: dev +DATABASE=dev + +# ============================================================================= +# APPLICATION CONFIGURATION +# ============================================================================= + +# Logging level: DEBUG, INFO, WARNING, ERROR +# Default: INFO +LOG_LEVEL=INFO + +# Python hash seed (set for reproducibility in tests) +PYTHONHASHSEED=0 + +# ============================================================================= +# DATABASE CONFIGURATION (PostgreSQL — used by gameplay_models.py) +# ============================================================================= + +DB_USERNAME=your_db_username +DB_PASSWORD=your_db_password +DB_URL=localhost +DB_NAME=postgres + +# ============================================================================= +# WEBHOOKS +# ============================================================================= + +# Discord webhook URL for restart notifications +RESTART_WEBHOOK_URL=https://discord.com/api/webhooks/your-webhook-id/your-webhook-token