Conversation
There was a problem hiding this comment.
Pull request overview
This PR refactors the Discord bot codebase from a module-level command pattern to a more modular Cog-based architecture. The main countdown bot functionality is moved from src/countdown_bot.py to src/countdown_cog.py as a commands.Cog subclass, while bot initialization is centralized in src/main.py. The LogHandler class is also refactored to store the bot reference internally rather than requiring it as a parameter to each method call.
Key changes:
- Introduced
CountdownCogclass to encapsulate countdown commands using the discord.py Cog pattern - Centralized bot initialization and configuration in
main.py - Refactored
LogHandlerto store bot reference in constructor, simplifying method signatures
Reviewed changes
Copilot reviewed 7 out of 8 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| src/main.py | Added bot initialization, logger setup, and cog registration logic |
| src/countdown_cog.py | New file containing CountdownCog class with rc and vrc commands migrated from countdown_bot.py |
| src/countdown_bot.py | Deleted file - functionality moved to countdown_cog.py |
| src/log_handler.py | Refactored to accept bot in constructor and removed bot parameter from logging methods |
| src/load_env.py | Changed load_bot_token() to return None instead of raising exception when token not found |
| uv.lock | Updated package name from "workspace" to "racebot" |
| pyproject.toml | Added docstring-code-format configuration for Ruff |
| .devcontainer/devcontainer.json | Added editor settings for formatting and linting |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.
src/countdown_cog.py is renamed from src/countdown_bot.py. Its logic is not changed.
main.py load all environment variables.
src/log_handler.py
bot argument is removed. Because it can load from ctx