> ## Documentation Index
> Fetch the complete documentation index at: https://docs.nexdev.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Configuration

> Everything lives in nex_queue/config.lua. It's split into five sections:

Everything lives in **`nex_queue/config.lua`**. It's split into five sections:

1. `Config.Server` — bot token, IDs, timings
2. `Config.Interface` — branding, theme, button row
3. `Config.Tiers` — Discord role → tier label
4. `Config.Whitelist` — optional role-gated access
5. `Config.Permissions` — bypass roles + priority points

Restart `nex_queue` after editing (`restart nex_queue` in the console) so changes take effect.

***

## `Config.Server` — runtime

| Key                 | Type             | What it does                                                                                                                                                               |
| ------------------- | ---------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `DiscordServerID`   | string           | Your Discord guild ID. **Required.**                                                                                                                                       |
| `DiscordBotToken`   | string           | Your bot token. **Required.** Server-side only.                                                                                                                            |
| `ReservedSlots`     | number           | How many slots off the top of `sv_maxclients` to keep free for bypassed staff. `0` = use every slot.                                                                       |
| `HaltDuration`      | number (seconds) | After a queued player joins, the slot stays "reserved" this long so the next player has time to load in. Default `30`.                                                     |
| `EmptyQueueWait`    | number (seconds) | Fast-track: if a player is the **only** one in the queue and the server has room, they get in after this many seconds instead of the full wait. `0` = effectively instant. |
| `RefreshRate`       | number (ms)      | How often the player's queue card re-renders. Default `1000`.                                                                                                              |
| `SaveFrequency`     | number (ms)      | How often the queue snapshot is persisted to KVP.                                                                                                                          |
| `DataExpiry`        | number (seconds) | Stale snapshots older than this are discarded on boot.                                                                                                                     |
| `EnableLiveFeed`    | bool             | Turn the auto-updating Discord embed on/off.                                                                                                                               |
| `LiveFeedChannelID` | string           | Channel ID for the live embed. Required when `EnableLiveFeed = true`.                                                                                                      |
| `DebugMode`         | bool             | Verbose console logging. Turn **off** in production.                                                                                                                       |

<Warning>
  You **do not** set the player cap here. NEX Queue reads `sv_maxclients` directly from your `server.cfg`. `ReservedSlots` only carves slots off the top of that number for staff bypass.
</Warning>

***

## `Config.Interface` — branding

The card the player sees while they wait.

### Text

| Key                                               | What it does                                                                      |
| ------------------------------------------------- | --------------------------------------------------------------------------------- |
| `ServerShortName`                                 | Short label shown on Boarding Pass / FactSet / Cards themes (e.g. `"Divine LA"`). |
| `Title`                                           | The card's title bar (e.g. `"Queue System"`).                                     |
| `Header`                                          | Header text used by the Classic theme.                                            |
| `PosLabel`, `PrioLabel`, `TimeLabel`, `TierLabel` | Translate these to your community language if you need.                           |
| `StatusQueue`                                     | Status string while the player is waiting (e.g. `"In Priority Queue"`).           |
| `StatusBoarding`                                  | Status string when the player is being let in (e.g. `"Now Boarding"`).            |

### Images

| Key             | Recommended                                                                      |
| --------------- | -------------------------------------------------------------------------------- |
| `BannerImage`   | Wide banner shown at the top of most themes. Leave `""` to hide. \~1500×500 PNG. |
| `ServerIcon`    | Square server logo. Top-left of every card. \~128×128 PNG with transparency.     |
| `LoadingGif`    | Spinner used by the Classic theme.                                               |
| `DefaultAvatar` | Fallback avatar for queued players with no Discord avatar set.                   |
| `AvatarSize`    | `"Small"`, `"Medium"`, or `"Large"`.                                             |

Use a CDN or `r2.fivemanage.com` — Discord-hosted images may rate-limit.

### Theme

```lua theme={null}
Config.Interface.Theme = "compactbar"
```

One of: `classic`, `banner`, `factset`, `boardingpass`, `compactbar`, `minimal`, `centered`, `cards`. See [Themes](/nex_queue/themes) for previews.

### Buttons

The action-row at the bottom of every theme. Two shapes:

```lua theme={null}
{ title = "Shop",      url    = "https://yourstore.com/" }   -- opens a URL
{ title = "Wait List", action = "waitlist" }                 -- opens an in-card panel listing everyone in queue
```

You can have up to 3. Use `Buttons = {}` to hide them.

***

## `Config.Tiers` — Discord role → tier label

Sets what label shows under the player's name (Diamond, Gold, etc.). **Order matters** — the *first* tier whose role the player holds wins. Put your highest tier on top.

```lua theme={null}
Config.Tiers = {
    { name = "Diamond Tier",  role = "ROLE_ID" },
    { name = "Platinum Tier", role = "ROLE_ID" },
    -- ...
}

Config.DefaultTier = "Standard"   -- shown when the player has none of the roles
```

This is **display only** — it doesn't affect ordering. Ordering comes from `Config.Permissions.PriorityLevels` below.

***

## `Config.Whitelist`

```lua theme={null}
Config.Whitelist = {
    Enabled = false,
    Roles = { "ROLE_ID", "ROLE_ID" },
    KickMessage = "This server is whitelist only..."
}
```

Flip `Enabled = true` to refuse anyone who doesn't hold one of `Roles`. Bypass roles still get in. See [Whitelist & priority](/nex_queue/whitelist-and-priority) for details.

***

## `Config.Permissions`

```lua theme={null}
Config.Permissions = {
    BypassRoles = { "STAFF_ROLE_ID" },

    PriorityLevels = {
        ["DIAMOND_ROLE_ID"]  = 8500,
        ["PLATINUM_ROLE_ID"] = 5000,
        -- ...
    }
}
```

* **`BypassRoles`** — anyone in any of these roles skips the queue entirely (and the whitelist).
* **`PriorityLevels`** — `roleId → points`. A player's effective priority is the **sum** of points across all matching roles they hold. Higher = served first.

Full breakdown in [Whitelist & priority](/nex_queue/whitelist-and-priority).

***

## Persistence — how the queue survives restarts

The queue is held in memory and a snapshot is written to KVP every `SaveFrequency` ms. On boot, snapshots older than `DataExpiry` seconds are thrown away, so a player who disconnected hours ago won't magically reappear at the front.

You don't manage any files — there's nothing to back up.

## Restart vs. hot-reload

| Change                                      | Needs `restart nex_queue`?                                          |
| ------------------------------------------- | ------------------------------------------------------------------- |
| Anything in `Config.Server`                 | Yes                                                                 |
| `Config.Interface.Theme`                    | No — see [Themes — hot-swap](/nex_queue/themes#hot-swap-at-runtime) |
| Any other `Config.Interface` text/image key | Yes                                                                 |
| `Config.Tiers`                              | Yes                                                                 |
| `Config.Whitelist`                          | Yes                                                                 |
| `Config.Permissions`                        | Yes                                                                 |

## Runtime exports

You can read queue state from your other scripts. All exports are namespaced to `nex_queue`.

| Export                                             | Returns                                              |
| -------------------------------------------------- | ---------------------------------------------------- |
| `exports.nex_queue:GetNexQueueCount()`             | Total players currently in queue                     |
| `exports.nex_queue:GetNexQueueFullList()`          | Sorted list of waiters (highest priority first)      |
| `exports.nex_queue:GetPlayerNexStatus(src)`        | Per-player snapshot (priority, tier, position, etc.) |
| `exports.nex_queue:GetNexThemeList()`              | List of every valid theme name                       |
| `exports.nex_queue:GetNexActiveTheme()`            | The currently active theme                           |
| `exports.nex_queue:SetNexActiveTheme("themeName")` | Swap theme without a restart                         |
| `exports.nex_queue:GetDiscordName(src)`            | The connecting player's Discord username             |
| `exports.nex_queue:GetDiscordNickname(src)`        | Their server nickname                                |
| `exports.nex_queue:GetDiscordAvatar(src)`          | URL to their avatar                                  |
| `exports.nex_queue:GetDiscordRoles(src)`           | Array of role IDs they hold                          |
| `exports.nex_queue:GetGuildName()`                 | Your guild name                                      |
| `exports.nex_queue:GetGuildMemberCount()`          | Approximate member count                             |
| `exports.nex_queue:GetGuildOnlineMemberCount()`    | Approximate online count                             |
| `exports.nex_queue:GetGuildIcon()`                 | URL to your guild icon                               |
| `exports.nex_queue:GetGuildRoleList()`             | The full role list, cached from Discord              |

Useful for things like an in-game `/online` command, a dashboard widget, or wiring tier info into your hud.
