> For the complete documentation index, see [llms.txt](https://docs.luasec.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.luasec.org/discord-bot/setup.md).

# Set up the bot on your server

The Luasec Discord bot lets your buyers manage themselves, claim a role, reset their HWID, link their keys, and get their script while you whitelist people with a click.

{% hint style="warning" %}
The API key + Discord bot are a **Pro/Max** feature. On the Free plan you can't generate an API key. See [Subscriptions](broken://pages/qQqhrwYoWMdbe8o9oZCm).
{% endhint %}

## Step 1: Generate your API key

The API key links a Discord server to your Luasec account.

1. In the dashboard, open the **API key** panel.
2. Generate the key and copy it. Keep it secret.

<figure><img src="/files/P2lmYrCRYUdWfQAVIBiy" alt=""><figcaption></figcaption></figure>

## Step 2: Invite the bot

Invite the Luasec bot to your Discord server.

## Step 3: Link the server

In your server, run:

```
/login apikey: <your-api-key>
```

This ties the server to your Luasec account. You only do it once (rerun it to relink or rotate).

<figure><img src="/files/52Sy0dvn2l8q63hzG5nU" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/4HYvbFXKlIJiDeGuhbPj" alt=""><figcaption></figcaption></figure>

## Step 4: Configure the bot

Point the bot at the right project/script and set your roles:

```
/config project      project: Fluffy Hub
/config script       script:  Autoparry
/config managerrole  role:    @Staff
/config buyerrole    role:    @Buyer
/config resethwid    enabled: true
```

* **project:** which Luasec project this server manages.
* **script:** which script the `/script` command delivers to buyers.
* **managerrole:** role allowed to run manager commands (in addition to Administrators).
* **buyerrole:** role auto-granted to whitelisted users.
* **resethwid:** whether buyers may reset their own HWID with `/resethwid`.

## Step 5: Post the buyer panel

Drop a self-service panel in a channel so buyers can help themselves:

```
/panel
```

Add `message:` to override the panel's description text.

<figure><img src="/files/I6z0zF0L8XaMCc79tMC2" alt=""><figcaption></figcaption></figure>

## Step 6: Whitelist a buyer

When someone buys, they can either use the Link Key feature, or you can whitelist them yourself.

```
/whitelist user: @Buyer
```

They get a key (managed for them) and the buyer role. To import an existing role in bulk:

```
/mass-whitelist-role role: @ExistingBuyers
```

Full list on the [command reference](/discord-bot/commands.md).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.luasec.org/discord-bot/setup.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
