# Exports & integrations

Optional examples for connecting your other server resources.

## Before you start

These exports are optional. Use them to connect Wolfden Rich Presence to your other resources. Keep the resource folder named `wd_richpresence`, and make sure it is started before resources that call its exports.

## Client exports

### Refresh the photo

Checks the character's look and uploads a new photo if it changed. Pass `true` to upload a new photo even when the look is the same. Uploads are still limited to one every 2 minutes per player.

```lua
exports.wd_richpresence:RefreshMugshot()
exports.wd_richpresence:RefreshMugshot(true)
```

Call it from a clothing script after the player saves their look, if that script is not listed in `Config.AppearanceEvents`.

### Show a temporary message

Replaces the rotating messages until you clear it. [Placeholders](#/docs/wd_richpresence/presence) work. `{street}` and `{zone}` stay empty while `ShowLocation` is off.

```lua
exports.wd_richpresence:SetPresenceOverride('In a police chase | {job}')

-- Later, return to the normal rotating messages
exports.wd_richpresence:ClearPresenceOverride()
```

The message is also cleared when the player logs out or switches character.

### Get the photo link

Returns the current character's photo URL, or `nil` if there is none yet.

```lua
local url = exports.wd_richpresence:GetMugshotUrl()
```

## Server exports

### Refresh a player's photo

```lua
exports.wd_richpresence:RefreshMugshot(source)
exports.wd_richpresence:RefreshMugshot(source, true) -- upload even if the look is unchanged
```

Returns `false` if the player is not online.

### Get a player's photo link

Useful for an MDT, ID card or staff panel. Returns `nil` if the player has no photo yet.

```lua
local url = exports.wd_richpresence:GetMugshotUrl(source)
```

## Framework events

Wolfden Rich Presence listens to these framework events. Custom multicharacter or framework resources must trigger them for character changes to be detected.

| Framework | Character loaded | Logout | Job change |
| --- | --- | --- | --- |
| Qbox | `QBCore:Client:OnPlayerLoaded` | `qbx_core:client:playerLoggedOut`, `QBCore:Client:OnPlayerUnload` | `QBCore:Client:OnJobUpdate` |
| QBCore | `QBCore:Client:OnPlayerLoaded` | `QBCore:Client:OnPlayerUnload` | `QBCore:Client:OnJobUpdate` |
| ESX | `esx:playerLoaded` | `esx:onPlayerLogout` | `esx:setJob` |
| Standalone | First `playerSpawned` | Not used | Not used |
