Some checks failed
Build Docker Image / build (pull_request) Failing after 15s
Remove historical changelogs, redundant documentation references, and content already covered by parent/sub-directory CLAUDE.md files. Update deployment section to reflect Gitea Actions workflow. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2.3 KiB
2.3 KiB
Discord Bot v2.0
SBA fantasy league Discord bot. discord.py with async Python, Pydantic models, FastAPI backend.
Commands
- Run:
python bot.py - Test:
python -m pytest --tb=short -q - Test specific:
python -m pytest tests/test_services.py -v
IMPORTANT: Patterns That Prevent Real Bugs
Docker Hub Repository Name
manticorum67/major-domo-discordapp
There is NO DASH between "discord" and "app". Not discord-app, not discordapp-v2.
Git Workflow
NEVER commit directly to main. Always use feature branches:
git checkout -b feature/name # or fix/name
Double Emoji in Embeds
EmbedTemplate.success/error/warning/info/loading() auto-add emoji prefixes.
- Do NOT put emoji in the
titleparameter of these methods (causes double emoji) - Use
EmbedTemplate.create_base_embed()when you want custom emoji in titles
Autocomplete Functions
Define autocomplete as standalone functions OUTSIDE the class, not as methods.
- See
commands/players/info.py:20-67for canonical example
Model Requirements
- Database entities require
idfields:Player(id=123, ...),Team(id=456, ...) - Use explicit None checks (
if obj is None:) notif not obj: - Use "Raise or Return" pattern - don't return Optional unless specifically required
New Commands Must Use
from utils.decorators import logged_command
from utils.logging import get_contextual_logger
class MyCog(commands.Cog):
def __init__(self, bot):
self.bot = bot
self.logger = get_contextual_logger(f'{__name__}.MyCog') # Required
@discord.app_commands.command(name="example")
@logged_command("/example")
async def example(self, interaction, param: str):
# Business logic only - decorator handles logging, timing, errors
Deployment
Builds and deploys are handled by Gitea Actions. Just create a PR to main:
/home/cal/.claude/scripts/gitea-create-pr.sh cal/major-domo-bot <branch> main "title" "description"
Gitea validates the version, builds the Docker image, and deploys on merge.
API Reference
- OpenAPI spec: https://sba.manticorum.com/api/openapi.json (use WebFetch for current endpoints)
Sub-directory Documentation
Each package has its own CLAUDE.md with detailed patterns:
commands/, services/, models/, views/, tasks/, tests/, utils/