# Installation

## Step 1:

First you need to create a discord bot. Head over to the [Discord Developer Portal](https://discord.com/developers/applications) and Create a New Application:

<figure><img src="https://2631480003-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4QAjI5SanbBqgNBHmTwd%2Fuploads%2Fr1DPQ86kTvxa4E0yrrUV%2Fimage.png?alt=media&#x26;token=c26e6903-a02d-4edb-be2b-1baf00b0ceda" alt=""><figcaption><p>Creating a New Application</p></figcaption></figure>

## Step 2:

Once you created your discord bot application you want to setup your bot application settings by going to the **Installation** section of the settings. The settings you set should look similar to the below screenshot. Overall you want to check the **Guild Install Method** and you want to make sure your **Default Install Settings** at least have the **"bot"** scope and **"Connect", "Read Message History"** & **"Read Message/View Channels"** Permissions.&#x20;

<figure><img src="https://2631480003-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4QAjI5SanbBqgNBHmTwd%2Fuploads%2FNmA0tq86TUWhpg7X3QLt%2Fimage.png?alt=media&#x26;token=a36fed3d-3db1-44df-89b5-3ad738da9bd0" alt=""><figcaption></figcaption></figure>

## Step 3:

Next you want to head over to the **Bot** section of the settings make sure your bot has all of the correct **Privileged Gateway Intents**. Make sure yours look similar to the below screenshot

<figure><img src="https://2631480003-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4QAjI5SanbBqgNBHmTwd%2Fuploads%2Fm9ZYDEjBSse5xTZQYZQ8%2Fimage.png?alt=media&#x26;token=5170c8ba-273e-43b1-9bda-e4a66eb14fb3" alt=""><figcaption></figcaption></figure>

## Step 4:&#x20;

Reset your discord bot's token by clicking **Reset Token** Once you have done that you should copy your token then navigate the **config folder** insider the scripts resource folder, Inside of that folder you will find a **token.json file**. Open that file and Replace the **"PLACE\_YOUR\_TOKEN\_HERE"** with your bots token. **Make sure you never share this token with ANYONE**:

<figure><img src="https://2631480003-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4QAjI5SanbBqgNBHmTwd%2Fuploads%2FQgRbDTezJDLCSstyeFzk%2Fimage.png?alt=media&#x26;token=b91cb3ba-b60e-426b-8e17-4440b8e949c3" alt=""><figcaption></figcaption></figure>

### SECURITY NOTICE:

**For security purposes:** after the first time you run the script the token you place in the token.json file will be **INSTANTLY CLEARED AUTOMATICALLY** by the script so no one can read it and stored in your servers database. That way if your server is under attack by a hacker who wants to read or dump your resource files they wont get your bot's token stored in the token.json file as it will no longer be there.&#x20;

## Step 5:

head back over to the **Installation** section and copy the auto generated **Discord Provided Link**.  Once you copied the link paste it in your browser and it should prompt you to join the bot into your servers. make sure you join the bot into your FiveM server's discord server and also make sure it has permissions to view your announcements channel<br>

<figure><img src="https://2631480003-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4QAjI5SanbBqgNBHmTwd%2Fuploads%2FumUxSi907UAAc7GtWJjA%2Fimage.png?alt=media&#x26;token=6593b304-342d-4b7a-89cd-4ed4eade8816" alt=""><figcaption></figcaption></figure>

## Step 6:

Delete your current loading screen script. By default for **QB-Core** the loading screen script is called **qb-loading.** For **ESX** the default loading screen script is called **esx\_loadingscreen**

## Step 7:

run the **token.sql** file in the **\_\_install** folder of the script into your database.

## Step 8:

Navigate to your discord server & copy your announcements channel ID, you can do this by right clicking on your announcements channel and then click **Copy Chanel ID** ***(You must have Discord Developer Mode Enabled to do this)***

## Step 9:

Go to **config > server\_config.json** file and paste your announcements channel ID where it says **"YOUR\_CHANNEL\_ID\_HERE"**

## Step 10:

Configure to your liking in **config > client\_config.js** **PLEEEASEEEE** read all of the comments in the client\_config.js file **carefully**.\
\
**DO NOT USE A .webm FILE FOR VIDEO, IT WILL NOT WORK**

## Step 11:&#x20;

Start your server and let the script build, Pay attention to the server sided console to see the build process. Once its done building and your server is joinable restart your server again&#x20;

**(you must restart it again because the discord announcements don't show in the loading screen the first time you run the script in your server after that it will automatically update announcements and work correctly without having to do any extra restarts)**

### Here is a screenshot that shows what it looks like when the script is finished building \[circled in <mark style="color:yellow;">yellow</mark>] (from server sided console):

<figure><img src="https://2631480003-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4QAjI5SanbBqgNBHmTwd%2Fuploads%2FTGixaFEk7AyfnpUD8ino%2Fimage.png?alt=media&#x26;token=ced4431d-1c08-40c0-b6b9-7e085b124e33" alt=""><figcaption></figcaption></figure>

## Enjoy!!!
