3.9 KiB
3.9 KiB
IGDB Integration Setup Guide
The bot now supports real-time video game information through IGDB (Internet Game Database) API integration. This allows the AI to provide accurate, up-to-date information about games when users ask gaming-related questions.
Features
- Game Search: Find games by name with fuzzy matching
- Game Details: Get comprehensive information including ratings, platforms, developers, genres, and summaries
- AI Integration: Seamless function calling - the AI automatically decides when to fetch game information
- Smart Formatting: Game data is formatted in a user-friendly way for the AI to present
Setup Instructions
1. Get IGDB API Credentials
- Go to Twitch Developer Console
- Create a new application:
- Name: Your bot name (e.g., "Fjerkroa Discord Bot")
- OAuth Redirect URLs:
http://localhost(not used but required) - Category: Select appropriate category
- Note down your Client ID
- Generate a Client Secret
- Get an access token using this curl command:
curl -X POST 'https://id.twitch.tv/oauth2/token' \ -H 'Content-Type: application/x-www-form-urlencoded' \ -d 'client_id=YOUR_CLIENT_ID&client_secret=YOUR_CLIENT_SECRET&grant_type=client_credentials' - Save the
access_tokenfrom the response
2. Configure the Bot
Update your config.toml file:
# IGDB Configuration for game information
igdb-client-id = "your_actual_client_id_here"
igdb-access-token = "your_actual_access_token_here"
enable-game-info = true
3. Update System Prompt (Optional)
The system prompt has been updated to inform the AI about its gaming capabilities:
system = "You are a smart AI assistant with access to real-time video game information through IGDB. When users ask about games, game recommendations, release dates, platforms, or any gaming-related questions, you can search for accurate and up-to-date information."
Usage Examples
Once configured, users can ask gaming questions naturally:
- "Tell me about Elden Ring"
- "What are some good RPG games released in 2023?"
- "Is Cyberpunk 2077 available on PlayStation?"
- "Who developed The Witcher 3?"
- "What's the rating of Baldur's Gate 3?"
The AI will automatically:
- Detect gaming-related queries
- Call IGDB API functions to get real data
- Format and present the information naturally
Technical Details
Available Functions
The integration provides two OpenAI functions:
-
search_games
- Parameters:
query(string),limit(optional integer, max 10) - Returns: List of games matching the query
- Parameters:
-
get_game_details
- Parameters:
game_id(integer from search results) - Returns: Detailed information about a specific game
- Parameters:
Game Information Included
- Basic Info: Name, summary, rating (critic and user)
- Release Info: Release date/year
- Technical: Platforms, developers, publishers
- Classification: Genres, themes, game modes
- Extended (detailed view): Storyline, similar games, screenshots
Error Handling
- Graceful degradation if IGDB is unavailable
- Fallback to regular AI responses if API fails
- Proper error logging for debugging
Troubleshooting
Common Issues
-
"IGDB integration disabled" in logs
- Check that
enable-game-info = true - Verify client ID and access token are set
- Check that
-
Authentication errors
- Regenerate access token (they expire)
- Verify client ID matches your Twitch app
-
No game results
- IGDB may not have the game in their database
- Try alternative spellings or official game names
Rate Limits
- IGDB allows 4 requests per second
- The integration includes automatic retry logic
- Large queries are automatically limited to prevent timeouts
Disabling IGDB
To disable IGDB integration:
enable-game-info = false
The bot will continue working normally without game information features.