# Getting Started

### 🛠️ 1. Creating your Discord Application

Before you can run the bot, you need to create a bot instance on the Discord Developer Portal.

1. **Open the Dashboard**: Go to the [Discord Developer Portal](https://discord.com/developers/applications).
2. **New Application**: Click **New Application** and give it a name (e.g., "SupportBot").
3. **Create Bot**: Navigate to the **Bot** tab on the left sidebar and click **Reset Token** (or **Copy Token**) to save your bot's unique token. **Keep this token safe!**
4. **Privileged Gateway Intents**: Scroll down and enable all three intents. This is **required** for the bot to function correctly:
   * `Presence Intent`
   * `Server Members Intent`
   * `Message Content Intent`

***

### 🔗 2. Inviting the Bot

To invite the bot to your server with the correct permissions, follow these steps:

1. Navigate to the **Installation** page in the developer portal.
2. Set **Install Link** to `Discord Provided Link`.
3. Under **Default Install Settings**, set the following scopes:
   * **User Install Scopes**: `application.commands`
   * **Guild Install Scopes**: `application.commands`, `bot`
4. Set **Permissions** to `Administrator` (this ensures the bot can manage tickets and channels without issues).
5. Copy the generated **Install Link** and open it in your browser to invite the bot to your server.

***

### 📦 3. Installing Node.js

SupportBot requires **Node.js v20 or newer**. Choose the guide for your operating system below:

#### Windows 11

1. Download the latest **LTS** version from [nodejs.org](https://nodejs.org/).
2. Run the installer and follow the prompts.

#### Ubuntu (Linux)

Run the following commands in your terminal:

```bash
# Download the setup script for Node.js v20
curl -fsSL https://deb.nodesource.com/setup_20.x -o nodesource_setup.sh

# Run the setup script
sudo -E bash nodesource_setup.sh

# Install Node.js and NPM
sudo apt-get install -y nodejs npm
```

#### Verify Installation

Check that you are running a supported version:

```bash
node -v
```

*Expected Output: `v20.x.x` or higher.*

***

### 🚀 4. Starting the Bot

After setting up your Discord Application and installing Node.js, follow these steps to launch your SupportBot instance:

1. **Open Terminal**: Navigate to the bot's root directory.
2. **Run Setup**: Run the automated setup script:

```bash
npm run setup
```

1. **Manual Installation** (If setup fails):

```bash
# Install dependencies
npm install

# Start the bot
npm run start
```

> Once your bot is online, check out our Dashboard Setup Guide to manage your bot via the web interface!


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://emerald-services.gitbook.io/emeraldsrv/bots/supportbot/getting-started.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
