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

# Discord Bot

> Seamlessly integrate your website with your Discord server. Enable players to link their accounts, sync roles/usernames, and more.

### LeaderOS Discord Bot Features

* **Role Synchronization:** Synchronizes users roles with your Discord server and matches their Discord username with their in-game username.
* **Username Synchronization:** Changes the Discord username of users to match their in-game username.
* **Quick Setup:** Quickly set up our Discord bot by simply inviting and connecting it. No need to host it on any server.

### Installation

1. Enable the Discord Bot module from the **Dashboard > Settings > Modules** page.
   <img src="https://mintcdn.com/leaderos/RSiB1c7CNJn9Y9yJ/images/integrations/discord-bot2-module2.png?fit=max&auto=format&n=RSiB1c7CNJn9Y9yJ&q=85&s=2156eafa282603b51faf74e9f57d2575" alt="Image" width="826" height="270" data-path="images/integrations/discord-bot2-module2.png" />
2. Click the "Connect Discord Server" button on the **Dashboard > Settings > Discord Bot** page.
   <img src="https://mintcdn.com/leaderos/RSiB1c7CNJn9Y9yJ/images/integrations/discord-bot2-connect11.png?fit=max&auto=format&n=RSiB1c7CNJn9Y9yJ&q=85&s=c59ae9a270aecfaf9c9bedb61a90f6b5" alt="Image" width="1136" height="614" data-path="images/integrations/discord-bot2-connect11.png" />
3. Complete the steps on the opened page:
   * **Step 1:** Invite the Discord bot.
     <img src="https://mintcdn.com/leaderos/RSiB1c7CNJn9Y9yJ/images/integrations/discord-bot2-invite.png?fit=max&auto=format&n=RSiB1c7CNJn9Y9yJ&q=85&s=c1a8985657e06eab4b929804e8e9023d" alt="Image" width="944" height="1166" data-path="images/integrations/discord-bot2-invite.png" />
   * **Step 2:** Use the "/link \<TOKEN>" command to establish the connection with the invited bot.
     <img src="https://mintcdn.com/leaderos/RSiB1c7CNJn9Y9yJ/images/integrations/discord-bot2-link1.png?fit=max&auto=format&n=RSiB1c7CNJn9Y9yJ&q=85&s=079525780fd97842f7d9137ea374a0ea" alt="Image" width="1244" height="792" data-path="images/integrations/discord-bot2-link1.png" />
     <img src="https://mintcdn.com/leaderos/RSiB1c7CNJn9Y9yJ/images/integrations/discord-bot2-link2.png?fit=max&auto=format&n=RSiB1c7CNJn9Y9yJ&q=85&s=cb895700111a190b921ac48f383be037" alt="Image" width="768" height="310" data-path="images/integrations/discord-bot2-link2.png" />
   * **Step 3:** Move the bot's role to the top in the **Discord Application > Server Settings > Roles** page.
     <img src="https://mintcdn.com/leaderos/RSiB1c7CNJn9Y9yJ/images/integrations/discord-bot2-move-top.png?fit=max&auto=format&n=RSiB1c7CNJn9Y9yJ&q=85&s=f8aaecebb770688cea1dbfbfdfc1abb7" alt="Image" width="2074" height="1172" data-path="images/integrations/discord-bot2-move-top.png" />
4. Click the "**Complete**" button to finish the setup.
   <img src="https://mintcdn.com/leaderos/RSiB1c7CNJn9Y9yJ/images/integrations/discord-bot2-complete2.png?fit=max&auto=format&n=RSiB1c7CNJn9Y9yJ&q=85&s=da6e38298a53b42a2458c736912956a1" alt="Image" width="2076" height="998" data-path="images/integrations/discord-bot2-complete2.png" />
5. Edit the website roles to match with Discord from the **Dashboard > User Management > Roles** page.
   <img src="https://mintcdn.com/leaderos/RSiB1c7CNJn9Y9yJ/images/integrations/discord-bot2-roles.png?fit=max&auto=format&n=RSiB1c7CNJn9Y9yJ&q=85&s=2ea2b3e5dca00ed1584fca83aedff574" alt="Image" width="2110" height="954" data-path="images/integrations/discord-bot2-roles.png" />

### Settings

You can configure the Discord Bot settings from the **Dashboard > Settings > Discord Bot** page.

* **Server ID:** The ID (Guild ID) of the Discord server the bot is connected to. Clicking the "**Remove Bot Connection**" button will disconnect the bot. You need to unlink the bot to connect it to another server.
* **Sync Username:** Changes the Discord username of users to match their in-game username.
* **Role Links:** Map your website roles to Discord roles for synchronization.
* **Account Linking Rewards:** Commands added here will execute on your server once a user links their Discord account. You can use `%username%` as a placeholder for the linked user's in-game username.

<img src="https://mintcdn.com/leaderos/VqjuZf8WcOrsKuGA/images/integrations/discord-bot2-settings3.png?fit=max&auto=format&n=VqjuZf8WcOrsKuGA&q=85&s=1b7e5acd6abc7798eb690d999d0a685a" alt="Image" width="2108" height="1976" data-path="images/integrations/discord-bot2-settings3.png" />

### Troubleshooting

* If you encounter the error **"An error occurred while connecting to the Discord server."**, reset the API Key from the **Dashboard > Settings > API** page and try again.
