# How to Install a Custom Discord Bot from GitHub (/docs/discord-bots/install-custom-bot)



import { Step, Steps } from 'fumadocs-ui/components/steps';

This guide walks you through deploying any open-source Discord bot from GitHub on your XGamingServer.

> 📝 **Note:** You need a Discord bot token before proceeding. Follow our [Create a Bot Token](/docs/discord-bots/create-bot-token) guide if you have not created one yet.

Finding a Bot on GitHub [#finding-a-bot-on-github]

Popular Discord bot repositories include:

* [discord.js Guide Bot](https://github.com/discordjs/guide) — Official discord.js example bot
* [Red-DiscordBot](https://github.com/Cog-Creators/Red-DiscordBot) — Modular Python bot
* [JMusicBot](https://github.com/jagrosh/MusicBot) — Java music bot

Check the bot's README for setup instructions, required environment variables, and the language it is written in.

***

Standalone Node.js or Python Server (Git Integration) [#standalone-nodejs-or-python-server-git-integration]

If your `Startup` page has a **Git Repo Address** variable, your server can clone directly from GitHub with automatic updates.

<div className="fd-steps">
  <div className="fd-step">
    Set the Git Repository [#1-set-the-git-repository]

    Go to `Startup` and fill in:

    * **Git Repo Address** — The repository URL (e.g., `https://github.com/username/bot-repo`)
    * **Install Branch** (Node.js) or **Git Branch** (Python) — The branch to clone (leave blank for the repo default)
    * **User Uploaded Files** — Set to `0` (so the server clones from Git)
  </div>

  <div className="fd-step">
    Set the Main File [#2-set-the-main-file]

    Set the main file variable to match the bot's entry point:

    * **Node.js server**: Set **Main File** to `index.js` (or whatever the README specifies)
    * **Python server**: Set **App py File** to `bot.py` (or whatever the README specifies)
  </div>

  <div className="fd-step">
    Enable Auto Update (Optional) [#3-enable-auto-update-optional]

    Set **Auto Update** to `1` to automatically pull the latest code from GitHub on each restart.
  </div>

  <div className="fd-step">
    Start the Server [#4-start-the-server]

    Go to `Console` and click **Start**. The server will clone the repository and install dependencies automatically.
  </div>

  <div className="fd-step">
    Configure the Bot [#5-configure-the-bot]

    After the first start, go to `Files`. Create a `.env` file or edit the config file as described in the bot's README:

    ```
    TOKEN=your_bot_token_here
    ```
  </div>

  <div className="fd-step">
    Restart [#6-restart]

    Click **Restart** in the `Console` for the token to take effect.
  </div>
</div>

Updating the Bot [#updating-the-bot]

If **Auto Update** is enabled, the server pulls the latest code on each restart. To manually update, restart the server or disable and re-enable auto update.

Using a Private GitHub Repository [#using-a-private-github-repository]

On the `Startup` page, fill in the **Git Username** and **Git Access Token** fields. Create a [personal access token](https://github.com/settings/tokens) with `repo` scope and use it as the access token.

***

Discord Bot Server (Manual Upload) [#discord-bot-server-manual-upload]

If your `Startup` page only has a **Startup Command** variable, you need to download the bot files and upload them manually.

<div className="fd-steps">
  <div className="fd-step">
    Download the Bot Files [#1-download-the-bot-files]

    On the bot's GitHub page, click the green **Code** button and select **Download ZIP**. Extract the ZIP file on your computer.
  </div>

  <div className="fd-step">
    Upload to Your Server [#2-upload-to-your-server]

    Log in to the [XGamingServer panel](https://panel.xgamingserver.com) and go to `Files`. Upload all the extracted bot files.
  </div>

  <div className="fd-step">
    Install Dependencies [#3-install-dependencies]

    Go to `Startup` and set the **Startup Command** to `/bin/bash`. Start the server, then in the `Console` install dependencies based on the bot's language:

    **Node.js bots:**

    ```
    npm install
    ```

    **Python bots:**

    ```
    pip3 install -r requirements.txt
    ```

    **Java bots:** No dependency install needed — just upload the `.jar` file.
  </div>

  <div className="fd-step">
    Configure the Bot [#4-configure-the-bot]

    Most bots need a token and other settings. Check the bot's README for a `.env.example` or `config.example` file. Create the required config file in `Files`:

    * Copy the example config and rename it (e.g., `.env.example` → `.env`, `config.example.json` → `config.json`)
    * Fill in your bot token and any other required values

    See our [Manage Bot Token](/docs/discord-bots/manage-bot-token) guide for details on setting up tokens.
  </div>

  <div className="fd-step">
    Set the Startup Command [#5-set-the-startup-command]

    Go to `Startup` and change the **Startup Command** to run the bot:

    | Language  | Startup Command         |
    | --------- | ----------------------- |
    | Node.js   | `node index.js`         |
    | Python 3  | `python3 bot.py`        |
    | Java      | `java -jar BotName.jar` |
    | Go        | `./bot`                 |
    | C# / .NET | `mono Bot.exe`          |

    Replace the filename with whatever the bot's README specifies.
  </div>

  <div className="fd-step">
    Start the Server [#6-start-the-server]

    Go to `Console` and click **Start**. Watch the output to confirm the bot connects to Discord successfully.
  </div>
</div>

Updating the Bot [#updating-the-bot-1]

To update a bot deployed manually:

<div className="fd-steps">
  <div className="fd-step">
    Download the Latest Release [#1-download-the-latest-release]

    Go to the bot's GitHub page and download the latest ZIP or release.
  </div>

  <div className="fd-step">
    Back Up Your Config [#2-back-up-your-config]

    Before uploading new files, download your `.env`, `config.json`, or any other configuration files you customized.
  </div>

  <div className="fd-step">
    Upload New Files [#3-upload-new-files]

    Upload the updated bot files to `Files`, overwriting the old ones.
  </div>

  <div className="fd-step">
    Restore Your Config [#4-restore-your-config]

    Re-upload your configuration files.
  </div>

  <div className="fd-step">
    Reinstall Dependencies [#5-reinstall-dependencies]

    If dependencies changed, run the install command again via `Console` with the startup command set to `/bin/bash`.
  </div>

  <div className="fd-step">
    Restart [#6-restart-1]

    Update the **Startup Command** back to the bot's run command and restart.

    ***
  </div>
</div>

Troubleshooting [#troubleshooting]

* **Bot crashes immediately** — Check the `Console` for error messages. Most common cause is a missing or invalid bot token.
* **"Cannot find module" / "ModuleNotFoundError"** — Dependencies were not installed. On the Discord Bot server, set the startup command to `/bin/bash` and run the install command. On standalone servers, check that your `package.json` or `requirements.txt` is present.
* **Git clone fails** — Verify the repository URL is correct and public. For private repos, use an authenticated URL with a personal access token.
* **Server stuck on "Starting"** — The panel may not detect startup output. Join our [Discord](https://discord.xgamingserver.com) for help adjusting the configuration.
