> ## 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.

# Discord setup

> NEX Queue talks to Discord through a bot you control. The bot reads role memberships and (optionally) posts a live waitlist embed. This page walks you through creating it.

NEX Queue talks to Discord through a bot **you control**. The bot reads role memberships and (optionally) posts a live waitlist embed. This page walks you through creating it.

You only do this once. Save the token somewhere safe — anyone with it can act as your bot.

## 1. Create the application & bot

1. Go to [discord.com/developers/applications](https://discord.com/developers/applications).
2. Click **New Application**, name it (e.g. *MyServer Queue*), accept terms.
3. In the left sidebar open **Bot**.
4. Set a profile picture and username for the bot if you want.
5. Click **Reset Token** → **Yes, do it** → **Copy**.
   * This is your `DiscordBotToken`. **Paste it somewhere safe immediately** — Discord will only show it once.

## 2. Enable the right intents

Still on the **Bot** page, scroll down to **Privileged Gateway Intents** and turn on:

* ✅ **Server Members Intent** — required (the bot reads role membership)
* ✅ **Presence Intent** — optional, only useful for the live-feed online count

Click **Save Changes**.

<Danger>
  If you skip **Server Members Intent**, the bot will see every player as a non-member of every role — meaning no priority, no tier, and if whitelist is on, no one can join. This is the #1 cause of "everyone is getting kicked" tickets.
</Danger>

## 3. Invite the bot to your guild

1. In the sidebar, open **OAuth2** → **URL Generator**.
2. Under **Scopes**, check **`bot`**.
3. Under **Bot Permissions**, check at minimum:
   * **View Channels**
   * **Send Messages**
   * **Manage Messages** *(only needed if you use the live feed)*
   * **Read Message History** *(only needed if you use the live feed)*
4. Copy the generated URL at the bottom, open it in a browser, pick your guild, **Authorize**.

The bot should now appear in your server's member list (offline is fine — it goes online when the resource starts).

## 4. Turn on Developer Mode (in your own Discord)

You need this to grab IDs from your guild.

* Discord → **User Settings** → **Advanced** → **Developer Mode** **ON**.

Now right-clicking any user, role, channel, or server gives you a **Copy ID** option.

## 5. Collect the IDs you'll paste into `config.lua`

You'll need:

| ID                          | How to grab it                                                         | Goes into                                                                                                       |
| --------------------------- | ---------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------- |
| **Guild (server) ID**       | Right-click your server name → **Copy Server ID**                      | `Config.Server.DiscordServerID`                                                                                 |
| **Bot token**               | From step 1                                                            | `Config.Server.DiscordBotToken`                                                                                 |
| **Channel ID** *(optional)* | Right-click the channel for the live feed → **Copy Channel ID**        | `Config.Server.LiveFeedChannelID`                                                                               |
| **Role IDs**                | Server Settings → **Roles** → right-click each role → **Copy Role ID** | `Config.Tiers`, `Config.Permissions.PriorityLevels`, `Config.Permissions.BypassRoles`, `Config.Whitelist.Roles` |

<Info>
  Role IDs are also visible in **Server Settings → Roles** — hover the **⋯** menu next to a role. Both work.
</Info>

## 6. (Optional) Live waitlist channel

If you want the auto-updating queue embed:

1. Make a channel like `#queue-status` and lock writing to **the bot only** (so players can't spam it).
2. Make sure the bot has **View Channel**, **Send Messages**, and **Manage Messages** there.
3. Copy the channel ID and put it in `Config.Server.LiveFeedChannelID`.
4. In `Config.Server`, leave `EnableLiveFeed = true`.

The bot reuses a single message and edits it in place — it will not flood the channel.

## 7. Done

Head back to [Installation — Step 4](/nex_queue/installation#step-4-fill-in-config-lua) to paste these into `config.lua`. The full mapping of every config key lives in [Configuration](/nex_queue/configuration).

## Security checklist

* ❗ Never commit `config.lua` to a public GitHub repo with the token in it.
* ❗ Never paste the token in a Discord ticket or screenshot. Treat it like a password.
* If you ever think the token leaked, return to **Discord Developer Portal → Bot → Reset Token** and update `config.lua`.
* The token is server-side only — it is **never** sent to FiveM clients.
