feat: Implement P1 Discord Bot with /bind Slash Command - #1
Conversation
This commit introduces the foundational architecture for Project Chimera, an AI-powered League of Legends Discord bot following hexagonal architecture. ## Features Added: - Discord bot initialization with discord.py 2.3+ - `/bind` slash command for Riot-Discord account linking interface - `/unbind` and `/profile` command placeholders - Health check and logging system with file output - Environment-based configuration using Pydantic Settings ## Architecture: - Hexagonal architecture (Ports & Adapters) structure - Type-safe data contracts with Pydantic V2 - Async/await throughout for non-blocking operations - Clear separation: core domain logic, adapters, contracts ## Project Structure: - src/core/: Domain logic (future business rules) - src/adapters/: External integrations (Discord bot adapter) - src/contracts/: Pydantic data models (UserBinding, DiscordInteraction) - src/config.py: Environment configuration with validation ## Development Setup: - Python 3.11+ with type hints - Poetry-compatible pyproject.toml with Black, Ruff, MyPy configs - pytest with async support and coverage reporting - Comprehensive README with setup instructions - .env.example template for configuration ## Testing: - test_setup.py validates environment and dependencies - Async test infrastructure ready - Coverage reporting configured This implements the P1 phase requirements as defined in the project roadmap. Future phases will add Riot API integration, database persistence, and AI-powered match analysis features. Ref: CLI 1 (Frontend) of Project Chimera multi-CLI architecture
…ts preferring main tooling
…ts preferring main tooling
There was a problem hiding this comment.
6 issues found across 15 files
Prompt for AI agents (all 6 issues)
Understand the root cause of the following 6 issues and fix them.
<file name="README.md">
<violation number="1" location="README.md:27">
The setup step points to a non-existent directory (`lolbot/.conductor/jackson`), so following it will fail and halt the installation workflow.</violation>
<violation number="2" location="README.md:134">
The documented pytest command targets a `tests/` directory that does not exist in this repo, so it will always fail.</violation>
</file>
<file name="src/contracts/user_binding.py">
<violation number="1" location="src/contracts/user_binding.py:80">
Please add the Discord snowflake regex constraint here so the request model rejects invalid IDs at validation time.</violation>
<violation number="2" location="src/contracts/user_binding.py:85">
Please apply the same Riot region validation here so BindingRequest filters out unsupported regions up front.</violation>
</file>
<file name="main.py">
<violation number="1" location="main.py:91">
Calling adapter.run() inside the async main() nests discord.Client.run inside the event loop created by asyncio.run(main()), which raises RuntimeError and stops the bot from starting. Await the adapter's async start method instead.</violation>
</file>
<file name="setup.sh">
<violation number="1" location="setup.sh:39">
Ensure the dependency installation stops the script when it fails so the "Setup complete" message is not printed on error.</violation>
</file>
React with 👍 or 👎 to teach cubic. Mention @cubic-dev-ai to give feedback, ask questions, or re-run the review.
| ### Testing | ||
|
|
||
| ```bash | ||
| pytest tests/ -v --asyncio-mode=auto |
There was a problem hiding this comment.
The documented pytest command targets a tests/ directory that does not exist in this repo, so it will always fail.
Prompt for AI agents
Address the following comment on README.md at line 134:
<comment>The documented pytest command targets a `tests/` directory that does not exist in this repo, so it will always fail.</comment>
<file context>
@@ -0,0 +1,182 @@
+### Testing
+
+```bash
+pytest tests/ -v --asyncio-mode=auto
+```
+
</file context>
| ## 🚀 Quick Start | ||
| ```bash | ||
| git clone <repository-url> | ||
| cd lolbot/.conductor/jackson |
There was a problem hiding this comment.
The setup step points to a non-existent directory (lolbot/.conductor/jackson), so following it will fail and halt the installation workflow.
Prompt for AI agents
Address the following comment on README.md at line 27:
<comment>The setup step points to a non-existent directory (`lolbot/.conductor/jackson`), so following it will fail and halt the installation workflow.</comment>
<file context>
@@ -0,0 +1,182 @@
+
+```bash
+git clone <repository-url>
+cd lolbot/.conductor/jackson
+```
+
</file context>
|
|
||
| region: str = Field( | ||
| "na1", | ||
| description="Preferred region" |
There was a problem hiding this comment.
Please apply the same Riot region validation here so BindingRequest filters out unsupported regions up front.
Prompt for AI agents
Address the following comment on src/contracts/user_binding.py at line 85:
<comment>Please apply the same Riot region validation here so BindingRequest filters out unsupported regions up front.</comment>
<file context>
@@ -0,0 +1,168 @@
+
+ region: str = Field(
+ "na1",
+ description="Preferred region"
+ )
+
</file context>
|
|
||
| discord_id: str = Field( | ||
| ..., | ||
| description="Discord User ID" |
There was a problem hiding this comment.
Please add the Discord snowflake regex constraint here so the request model rejects invalid IDs at validation time.
Prompt for AI agents
Address the following comment on src/contracts/user_binding.py at line 80:
<comment>Please add the Discord snowflake regex constraint here so the request model rejects invalid IDs at validation time.</comment>
<file context>
@@ -0,0 +1,168 @@
+
+ discord_id: str = Field(
+ ...,
+ description="Discord User ID"
+ )
+
</file context>
| logger.info("Bot initialization complete. Connecting to Discord...") | ||
|
|
||
| # Run the bot (this blocks) | ||
| adapter.run() |
There was a problem hiding this comment.
Calling adapter.run() inside the async main() nests discord.Client.run inside the event loop created by asyncio.run(main()), which raises RuntimeError and stops the bot from starting. Await the adapter's async start method instead.
Prompt for AI agents
Address the following comment on main.py at line 91:
<comment>Calling adapter.run() inside the async main() nests discord.Client.run inside the event loop created by asyncio.run(main()), which raises RuntimeError and stops the bot from starting. Await the adapter's async start method instead.</comment>
<file context>
@@ -0,0 +1,108 @@
+ logger.info("Bot initialization complete. Connecting to Discord...")
+
+ # Run the bot (this blocks)
+ adapter.run()
+
+ except KeyboardInterrupt:
</file context>
| adapter.run() | |
| await adapter.start() |
|
|
||
| # Install requirements | ||
| echo "Installing dependencies..." | ||
| pip install -r requirements.txt |
There was a problem hiding this comment.
Ensure the dependency installation stops the script when it fails so the "Setup complete" message is not printed on error.
Prompt for AI agents
Address the following comment on setup.sh at line 39:
<comment>Ensure the dependency installation stops the script when it fails so the "Setup complete" message is not printed on error.</comment>
<file context>
@@ -0,0 +1,50 @@
+
+# Install requirements
+echo "Installing dependencies..."
+pip install -r requirements.txt
+
+echo ""
</file context>
| pip install -r requirements.txt | |
| pip install -r requirements.txt || exit 1 |
feat: Implement P1 Discord Bot with /bind Slash Command
Summary
This PR implements the foundational P1 phase of Project Chimera, an AI-powered League of Legends Discord bot. The implementation follows hexagonal architecture principles with strict type safety and modern Python best practices.
Key Features
discord.py2.3+/bindslash command for Riot-Discord account linking interface/unbindand/profilecommand placeholderschimera_bot.log)Architecture Highlights
Project Structure
Developer Experience
pyproject.tomlwith Black, Ruff, MyPy configurations.env.exampletemplate for quick configurationTesting Infrastructure
test_setup.pyfor environment validationTest Plan
/bindcommand registers and responds with embed.envfilemypy src/blackandruffRoadmap Context
This PR delivers P1 (Frontend Foundation) of the multi-CLI architecture:
Next Steps (P2+)
/讲道理command with LLM-powered match analysisRelated Issues
Closes #[issue_number] (if applicable)
Notes
.envbefore runningSummary by cubic
Implements the P1 Discord bot (CLI 1) with a working /bind slash command and a hexagonal foundation. Adds health checks, logging, environment-driven config, and type-safe contracts to set up future Riot OAuth and persistence.
New Features
Migration