Installation & Setup
The installation steps, the configuration and how to create your own Discord bot.
Installation Process
Section titled “Installation Process”Step 1: File Transfer
Section titled “Step 1: File Transfer”- Download the ZIP package
- Extract to a local folder
- Set FTP transfer mode to binary
- Upload files to your server’s resources folder
- Add to server.cfg
- Restart your server
Step 2: Server Configuration
Section titled “Step 2: Server Configuration”Add the resource to your server.cfg somewhere ON TOP as one of the first starting resources:
ensure night_discordapiStep 3: Configuration Setup
Section titled “Step 3: Configuration Setup”Configure /config/config.lua (see configuration section below).
Configuration
Section titled “Configuration”Note: This resource requires a Discord bot to function. You must create your own Discord bot application. How to do this is covered in the next step.
Basic Configuration
Section titled “Basic Configuration”Config = { -- Discord Bot Token Discord_Bot_Token = "",
-- Discord Guild/Server Configuration Discord_Guild_Names = { ["YOUR_GUILD_ID"] = "Your Guild Name", ["ANOTHER_GUILD_ID"] = "Another Guild Name", },
-- Discord Role Mapping Discord_Role_Names = { ["ROLE_ID"] = "Role_Name", ["ANOTHER_ROLE_ID"] = "Another_Role", },
-- Logging Level (0 = INFO/ERROR/WARN only, 1+ = includes DEBUG) Discord_API_Log_Level = 1,}Configuration Details
Section titled “Configuration Details”- Discord_Bot_Token: Your Discord bot token
- Discord_Guild_Names: Map Discord server IDs to readable names
- Discord_Role_Names: Map Discord role IDs to custom role names
- Discord_API_Log_Level: Control logging verbosity
Discord Bot Token
Section titled “Discord Bot Token”You must provide your own Discord bot token. Follow the tutorial above to create your bot and obtain the token:
Discord_Bot_Token = "YOUR_BOT_TOKEN_HERE"Creating Your Own Discord Bot
Section titled “Creating Your Own Discord Bot”📺 How to Create a Discord Bot - Quick Tutorial
Step 1: Create a New Application
Section titled “Step 1: Create a New Application”- Go to Discord Developer Portal
- Click “New Application”
- Enter a name for your application (e.g., “My FiveM Server Bot”)
- Click “Create”
Step 2: Set Up the Bot
Section titled “Step 2: Set Up the Bot”- In your application’s settings, select the “Bot” tab
- Click “Add Bot” and confirm by clicking “Yes, do it!”
- Customize your bot’s username and profile picture as desired
Step 3: Retrieve the Bot Token
Section titled “Step 3: Retrieve the Bot Token”- Under the “Bot” tab, click the “Reset Token” button to generate a new token
- Copy the token and store it securely - this token is essential for your bot’s functionality
Step 4: Set Up OAuth2 for Bot Permissions
Section titled “Step 4: Set Up OAuth2 for Bot Permissions”- Navigate to the “OAuth2” tab in your application’s settings
- Under “Scopes”, select “bot”
- In the “Bot Permissions” section, choose the permissions your bot requires:
- Read Messages/View Channels
- Any other functionalities to obtain member (role) information
- Copy the generated URL
Step 5: Invite the Bot to Your Server
Section titled “Step 5: Invite the Bot to Your Server”- Paste the copied URL into your browser
- Select the server you want to add the bot to and click “Authorize”
- Complete any CAPTCHA verification if prompted