igdb: auto-refresh twitch token; category -> game_type filter
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>
This commit is contained in:
+21
-8
@@ -20,13 +20,6 @@ The bot now supports real-time video game information through IGDB (Internet Gam
|
||||
- **Category**: Select appropriate category
|
||||
3. Note down your **Client ID**
|
||||
4. Generate a **Client Secret**
|
||||
5. Get an access token using this curl command:
|
||||
```bash
|
||||
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'
|
||||
```
|
||||
6. Save the `access_token` from the response
|
||||
|
||||
### 2. Configure the Bot
|
||||
|
||||
@@ -35,6 +28,25 @@ Update your `config.toml` file:
|
||||
```toml
|
||||
# IGDB Configuration for game information
|
||||
igdb-client-id = "your_actual_client_id_here"
|
||||
igdb-client-secret = "your_actual_client_secret_here"
|
||||
enable-game-info = true
|
||||
```
|
||||
|
||||
With the client secret configured, the bot fetches an app access token from
|
||||
Twitch itself and refreshes it automatically before it expires (Twitch app
|
||||
tokens live ~60 days) — no manual token handling needed.
|
||||
|
||||
Alternatively, a static token still works (legacy setup — it expires after
|
||||
~60 days and then game lookups fail with 401 until you replace it):
|
||||
|
||||
```bash
|
||||
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'
|
||||
```
|
||||
|
||||
```toml
|
||||
igdb-client-id = "your_actual_client_id_here"
|
||||
igdb-access-token = "your_actual_access_token_here"
|
||||
enable-game-info = true
|
||||
```
|
||||
@@ -99,7 +111,8 @@ The integration provides two OpenAI functions:
|
||||
- Verify client ID and access token are set
|
||||
|
||||
2. **Authentication errors**
|
||||
- Regenerate access token (they expire)
|
||||
- Prefer `igdb-client-secret` — the bot then refreshes tokens itself
|
||||
- With a static `igdb-access-token`: regenerate it (they expire)
|
||||
- Verify client ID matches your Twitch app
|
||||
|
||||
3. **No game results**
|
||||
|
||||
Reference in New Issue
Block a user