# Configuration

Every setting in config.lua and server_config.lua.

## Configuration files

Wolfden Rich Presence has two configuration files. Restart the resource after changing either one.

| File | Contains | Sent to players |
| --- | --- | --- |
| `config.lua` | Discord application, presence text, photos, command | Yes |
| `server_config.lua` | Image host, API key, self-hosting, upload limits | Never |

Keep API keys in `server_config.lua` or in `server.cfg`, never in `config.lua`.

## General

| Setting | Default | What it does |
| --- | --- | --- |
| `Config.Debug` | `false` | Prints every step to the F8 console and the server console |
| `Config.Framework` | `'auto'` | Detects your framework. Force one with `'qbox'`, `'qbcore'`, `'esx'` or `'standalone'` |
| `Config.ServerName` | `'My Roleplay Server'` | Fills `{server_name}` and titles player notifications |
| `Config.PlayerCount.Interval` | `30` | Seconds between player count updates |

## Discord

`Config.Discord` holds your Application ID, logo names and buttons. See [Discord application](#/docs/wd_richpresence/discord-app).

## Presence

| Setting | Default | What it does |
| --- | --- | --- |
| `ShowLocation` | `false` | Shows the player's street and zone. While off, location is never sent to Discord |
| `RefreshInterval` | `15` | Seconds between presence updates; minimum 5 |
| `RotationInterval` | `10` | Seconds between rotating messages; `0` shows only the first |

`Config.Presence` also holds the messages, fallback text and job names. See [Presence text](#/docs/wd_richpresence/presence).

## Character photos

| Setting | Default | What it does |
| --- | --- | --- |
| `Enabled` | `true` | Turns character photos on or off |
| `InitialDelay` | `5000` | Milliseconds to wait after a character loads before the first photo |
| `PedReadyTimeout` | `30000` | Maximum milliseconds to wait for the character to be visible |
| `HeadshotTimeout` | `5000` | Maximum milliseconds to wait for the game to prepare the headshot |
| `NuiTimeout` | `5000` | Maximum milliseconds to convert the headshot into an image |
| `OutputSize` | `256` | Photo size in pixels, from 64 to 512 |
| `AppearanceDebounce` | `2500` | Milliseconds to wait after a clothing event |
| `AutoRefreshInterval` | `30` | Seconds between automatic look checks; `0` turns them off |
| `UploadBps` | `100000` | Upload bandwidth in bytes per second, so uploads never cause lag |
| `UploadResponseTimeout` | `60000` | Maximum milliseconds to wait for the server to finish an upload |
| `MaxUrlLength` | `256` | Longest image link Discord accepts |

`Config.AppearanceEvents`, `Config.Command` and `Config.Locale` are covered in [Character photos](#/docs/wd_richpresence/mugshots).

## Image host

Set `ServerConfig.ImageHost` to `'fivemanage'` or `'self'`, then fill in the matching section. See [Image hosting](#/docs/wd_richpresence/image-hosting).

| Setting | Default | What it does |
| --- | --- | --- |
| `Fivemanage.ApiKey` | `''` | Your API token. Leave empty to use `wd_richpresence_fivemanage_key` from `server.cfg` |
| `Fivemanage.DeleteOldImages` | `true` | Deletes a character's previous photo when a new one is uploaded |
| `SelfHosted.PublicUrl` | `''` | Your HTTPS domain that forwards to this server. Required for `'self'` |
| `SelfHosted.DeleteOldImages` | `true` | Deletes a character's previous photo file when a new one is stored |

The Fivemanage `Endpoint`, `FieldName` and `DeleteEndpoint` values are already correct and do not need changing.

## Upload limits

| Setting | Default | What it does |
| --- | --- | --- |
| `ServerConfig.Upload.Cooldown` | `120` | Seconds between uploads for each player |
| `ServerConfig.Upload.MaxPayloadBytes` | 2 MB | Largest upload the server accepts |
| `ServerConfig.Upload.MaxDimension` | `1024` | Largest photo width or height in pixels |
| `ServerConfig.Upload.RequestTimeout` | `20` | Seconds before storing a photo is treated as failed |
| `ServerConfig.Upload.TicketLifetime` | `60` | Seconds a player has to send an upload after the server approves it |
| `ServerConfig.AutoCreateTable` | `true` | Creates the database table on start |
