search_games used `where name ~ "<q>"*`: prefix-only, diacritic- and
word-order-sensitive -- "MARVEL Tōkon" found nothing though IGDB has
it. Switch to IGDB's native `search` clause (relevance-ranked,
diacritic-insensitive).
fetch_url and image downloads read bodies with content.read(n), which
returns only the first buffered chunk (~7 KB): pages collapsed to
their <title>. httpread.read_capped collects chunks up to the byte
cap; image downloads read limit+1 so over-limit files are still
rejected instead of cached truncated (IMG-10).
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Static app tokens expire after ~60 days -> every lookup failed with
401. With igdb-client-secret set, the bot fetches the token via
client-credentials OAuth itself, refreshes a day before expiry and
retries once on 401; a static igdb-access-token still works.
IGDB renamed games.category to game_type: the category = 0 filter in
search_games silently matched nothing even with a valid token.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
## Major Features Added
- **Enhanced igdblib.py**:
* Added search_games() method with fuzzy game search
* Added get_game_details() for comprehensive game information
* Added AI-friendly data formatting with _format_game_for_ai()
* Added OpenAI function definitions via get_openai_functions()
- **OpenAI Function Calling Integration**:
* Modified OpenAIResponder to support function calling
* Added IGDB function execution with _execute_igdb_function()
* Backward compatible - gracefully falls back if IGDB unavailable
* Auto-detects gaming queries and fetches real-time data
- **Configuration & Setup**:
* Added IGDB configuration options to config.toml
* Updated system prompt to inform AI of gaming capabilities
* Added comprehensive IGDB_SETUP.md documentation
* Graceful initialization with proper error handling
## Technical Implementation
- **Function Calling**: Uses OpenAI's tools/function calling API
- **Smart Game Search**: Includes ratings, platforms, developers, genres
- **Error Handling**: Robust fallbacks and logging
- **Data Formatting**: Optimized for AI comprehension and user presentation
- **Rate Limiting**: Respects IGDB API limits
## Usage
Users can now ask natural gaming questions:
- "Tell me about Elden Ring"
- "What are good RPG games from 2023?"
- "Is Cyberpunk 2077 on PlayStation?"
The AI automatically detects gaming queries, calls IGDB API, and presents
accurate, real-time game information seamlessly.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Replace complex async mocking that was causing timeouts with simplified tests
- Fix test parameter mismatches in igdblib and logging tests
- Create reliable simplified test versions for Discord bot and OpenAI responder
- All 40 tests now pass quickly and reliably in ~3-4 seconds
- Maintain significant coverage improvements:
* bot_logging.py: 60% → 100%
* igdblib.py: 0% → 100%
* openai_responder.py: 45% → 47%
* discord_bot.py: 43% → 46%
* Overall coverage: 50% → 59%
Tests are now stable and suitable for CI/CD pipelines.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Fix infinite retry loop in ai_responder.py that caused test_fix1 to hang
- Add missing picture_edit parameter to all AIResponse constructor calls
- Set up complete development toolchain with Black, isort, Bandit, and MyPy
- Create comprehensive Makefile for development workflows
- Add pre-commit hooks with formatting, linting, security, and type checking
- Update test mocking to provide contextual responses for different scenarios
- Configure all tools for 140 character line length and strict type checking
- Add DEVELOPMENT.md with setup instructions and workflow documentation
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
- Try to keep at least 3 messages from each channel in the history
- Use post processed messages for the history, instead of the raw
messages from the openai API