# Bot

Create the Discord application, connect the token, invite the bot to your city's server and set its name, avatar, color and emojis.

Source: https://fivedash.fivex.gg/docs/en/discord/bot

The FiveDash bot is **your city's bot**: you create the application on Discord, with your city's name and avatar, and FiveDash makes it work. This page shows how to create the application, connect the token, invite the bot to your Discord server, and take care of its profile and the look of its messages. It's for whoever sets up the organization's bot.

## Before you start

* The **Discord** module must be in your organization's plan. See [Plans and billing](https://fivedash.fivex.gg/docs/en/getting-started/plans-and-billing).
* You need a FiveM server added in the panel. The bot is tied to that server.
* Access level on the **Bot** page (in **Settings → Members**):

| Level         | What it allows                                                                                                         |
| ------------- | ---------------------------------------------------------------------------------------------------------------------- |
| **View**      | The bot's profile and look (read only). The page shows "Your access only lets you view the bot."                       |
| **Configure** | Connect, change the token and edit the profile. It's also the level that runs the first setup and disconnects the bot. |

* On Discord, whoever invites the bot needs the **Manage Server** permission in the city's server.

## Create the application and connect the token

Open **Discord** in the sidebar. While the bot isn't ready, the page shows **Connect your city's bot**. The first step is **Create and connect the bot**.

### Create the application in the Developer Portal

Click **Open Developer Portal**. In Discord's Developer Portal, click **New Application** and give it your city's name, for example "Cidade Exemplo".

### Copy the token

In the application's **Bot** tab, click **Reset Token** and copy the token.

### Turn on the intents

Still in the **Bot** tab, under **Privileged Gateway Intents**, turn on **Server Members Intent** and **Message Content Intent** and save the changes on Discord.

### Paste the token in the panel

Back in FiveDash, paste the token in **Bot token** and click **Connect bot**. The panel shows **Checking token…** and then **Bot connected**.

> We store the token encrypted. Once saved, nobody can see it, not even you. If you need a new one, generate it in **Bot → Reset Token** in the Developer Portal.

The panel accepts the token even with quotes, spaces or a `Bot ` prefix. Messages you may see:

| Message                                                                         | What to do                                                                                                                     |
| ------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------ |
| This doesn't look like a bot token.                                             | Copy the token from the **Bot** tab in the Developer Portal, not the Client Secret or the Application ID.                      |
| Discord rejected this token.                                                    | Generate a new one in **Bot → Reset Token** and paste it again.                                                                |
| This token doesn't belong to a bot.                                             | Use the token from an application's **Bot** tab.                                                                               |
| This bot is already connected to another FiveDash server.                       | Each bot lives in a single FiveDash server. Create another application for this server.                                        |
| This token belongs to another bot. Disconnect the current bot before switching. | After setup is finished, you can only switch to a token of the same bot. To use another bot, disconnect the current one first. |

### Intents the bot uses

| Intent                     | Required    | What it's for                                                                                                                                                           |
| -------------------------- | ----------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Server Members Intent**  | Yes         | Seeing who's in the server: joins, leaves, verification, welcome and roles. Without it, setup can't be finished.                                                        |
| **Message Content Intent** | Recommended | Reading message text: logs, tickets (the AI attendant included), suggestions, clock-in, creators' posts, typed whitelist answers and protection's link and spam layers. |

The bot doesn't ask for the presence intent.

## Invite the bot to your Discord server

The second step is **Add it to your server**.

### Open the invite

Click **Add to Discord**. Discord opens the authorization screen with the permissions the bot asks for.

### Authorize it in your city's server

Pick your city's Discord server and authorize. Keep the permissions ticked.

### Come back to the panel

Go back to the FiveDash tab. The list updates on its own while it shows **Waiting for the bot to join a server…**.

### Pick the server

Under **Where the bot joined**, select the server and click **Use this server**. The panel shows **Setting up the server…**, registers the commands and moves on to the checks.

If the bot doesn't show up, open **Bot not showing up?**:

* You need the **Manage Server** permission on the Discord server.
* If someone else created the application, turn on **Public Bot** in the **Bot** tab.
* **Requires OAuth2 Code Grant** must be turned off. While it's on, the invite doesn't work.
* After authorizing, come back to this tab. The list updates on its own.

To put the bot in another Discord server while still in setup, use **Add to another server** or **Change**. After setup is finished, the panel asks you to disconnect the bot before switching servers.

### Permissions the invite asks for

The invite asks for **Administrator** plus each permission below. That way, if someone unticks Administrator on Discord's screen, the bot still gets the rest. Names are as in Discord's English UI.

| Permission               | Checked in step 3     |
| ------------------------ | --------------------- |
| View Channels            | Yes                   |
| Send Messages            | Yes                   |
| Embed Links              | Yes                   |
| Attach Files             | Yes                   |
| Read Message History     | Yes                   |
| Add Reactions            | Yes                   |
| Use External Emojis      | Yes                   |
| Manage Messages          | Yes                   |
| Manage Channels          | Yes                   |
| Manage Roles             | Yes                   |
| Manage Nicknames         | Yes                   |
| Manage Webhooks          | Yes                   |
| Kick Members             | Yes                   |
| Ban Members              | Yes                   |
| Timeout Members          | Yes                   |
| Create Public Threads    | On each module's page |
| Manage Threads           | On each module's page |
| Send Messages in Threads | On each module's page |
| View Audit Log           | On each module's page |
| Manage Server            | On each module's page |
| Connect                  | On each module's page |
| Speak                    | On each module's page |

Administrator isn't required: the check passes if the bot's role has the 15 permissions marked "Yes".

> The bot can only give or take roles that sit below its own. In Discord's **Server Settings → Roles**, drag the bot's role above the roles it will manage (verified, unlocked, creators and others).

## Check the permissions and finish

The third step is **Check the permissions**. The panel checks everything directly on Discord before turning the bot on.

| Check                        | Required                   | When it's pending                                                                                                             |
| ---------------------------- | -------------------------- | ----------------------------------------------------------------------------------------------------------------------------- |
| **Server permissions**       | Yes                        | Shows "Missing: …" with the list. Click **Update permissions** to authorize again.                                            |
| **Server Members Intent**    | Yes                        | Turn it on in **Bot → Privileged Gateway Intents** and save. Use **Open Bot tab**.                                            |
| **Message Content Intent**   | No (**Recommended**)       | Shows **Warning**. Turn it on in the same screen as Server Members Intent.                                                    |
| **Interactions endpoint**    | Yes, if Discord rejects it | FiveDash sets the address that receives commands on its own. If Discord can't validate it, click **Check again** in a moment. |
| **/status and /ip commands** | Yes                        | Shows how many commands were registered. If it fails, click **Add again**.                                                    |

Once the required items show **All good**, click **Finish**. The panel shows "(bot name) is ready!", suggests typing `/status` in any channel to try it, and offers **Go to the bot's panel**. Right after, the bot shows as **Starting** on the overview; within a few minutes it turns **Online**.

## Profile and look

Open **Discord → Bot**. The **Bot settings** page shows how the bot appears on Discord and in the messages it sends, with a **Discord preview** of the profile and of a reply. Changes only apply after **Save** in the bar that shows at the bottom (**Discard** undoes them).

### Profile

| Field        | What it does                            | Rules                                                                                                         |
| ------------ | --------------------------------------- | ------------------------------------------------------------------------------------------------------------- |
| **Name**     | How the bot shows up on Discord.        | 2 to 32 characters. No `@`, `#`, `:` or ` ``` `. No word "discord". Discord allows changing it twice an hour. |
| **Avatar**   | The bot's picture. Opens a square crop. | PNG, JPG, WebP or GIF, up to 10 MB. GIFs become static. **Change avatar** / **Remove avatar**.                |
| **Banner**   | The image at the top of the profile.    | Best at 680 × 240. **Change banner** / **Remove banner**.                                                     |
| **About me** | The bot's profile bio.                  | Up to 400 characters. Supports Discord formatting: Ctrl+B for bold, Ctrl+I for italic.                        |

### Messages

| Field          | What it does                                                                                                             | Default                  |
| -------------- | ------------------------------------------------------------------------------------------------------------------------ | ------------------------ |
| **Main color** | The embeds' side stripe and the background of the **Highlight** pack. Pick a ready-made color or **Pick another color**. | `#5865F2` (Discord blue) |
| **Emoji pack** | The icons in the bot's replies.                                                                                          | **Default**              |

Emoji packs:

| Pack          | How it looks                                                                 |
| ------------- | ---------------------------------------------------------------------------- |
| **Default**   | Discord's own emojis.                                                        |
| **Lines**     | Thin icons, subtle on any theme.                                             |
| **Highlight** | Icons on the bot's main color. Changing the **Main color** redraws the pack. |

The **Lines** and **Highlight** packs are uploaded as your bot's own emojis (application emojis) and work in any server. If Discord asks to slow down, the panel shows "Discord asked us to wait before uploading more emojis. Save again in a few seconds."

### Emoji picker

In module texts (panels, buttons, messages), the **Insert emoji** button opens a picker with three tabs:

| Tab                 | What's in it                                                                                                                                                                  |
| ------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Bot pack**        | The icons of the pack picked above, by category (Status, Highlights, People, Security, Communication, Game, Places and weather, Shop and money, Objects, Arrows and actions). |
| **Common emojis**   | Standard emojis, with **Recent**, categories and **Skin tone**.                                                                                                               |
| **From the server** | Your Discord server's own emojis. If there are none, add them in Discord's **Server Settings → Emoji**.                                                                       |

## Change the token or disconnect

On the Discord **Overview**, the **More bot options** menu (only for people with **Configure** on **Bot**) has:

* **Change token**: paste a new token from the same bot and click **Save token**. To use another bot, disconnect this one first.
* **Disconnect bot**: the commands go away, the bot leaves your Discord server and the token is deleted from FiveDash. To use it again, connect and invite it once more.

> Disconnecting deletes from FiveDash the images you uploaded to the bot's modules (panels, messages, moderation proof and others). Only use it if you're switching bots for good.

If Discord rejects the saved token (for example, after a **Reset Token** in the Developer Portal), the overview shows **Discord rejected this bot's token** and the **Bot** page won't save changes. Generate a token in **Bot → Reset Token** and use **Save new token**.

## FAQ

**Do I need to give the bot Administrator?**
No. The invite asks for Administrator to make things easier, but the check only requires the 15 permissions in the table.

**Why won't the bot's name change?**
Discord only allows renaming twice an hour. If too many accounts already use the name, Discord rejects it and the panel asks for another one.

**Is Message Content Intent required?**
Not to finish setup, but without it Discord hides message text. Logs, tickets, suggestions, clock-in and the link and spam protection depend on it.

## Next steps

[Discord overview](https://fivedash.fivex.gg/docs/en/discord/overview)Follow the bot's status and the modules.
[Commands](https://fivedash.fivex.gg/docs/en/discord/commands)Every slash command the bot registers.
[Verification](https://fivedash.fivex.gg/docs/en/discord/verification)Turn on the captcha for newcomers.
[Team and permissions](https://fivedash.fivex.gg/docs/en/dashboard/team-and-permissions)Give Configure to whoever looks after the bot.
