---
title: "Discord Bot Configuration"
icon : "settings"
description: "Wire the bot into your account and community with three commands."
---

# Discord Bot Configuration

Three commands configure the bot: `/login` links it to your EnvyAuth account, `/set_panel` posts a customer-facing panel, and `/set_modlogs` routes the audit log to a webhook.

All three require the **Administrator** permission on the Discord server. If you haven't added the bot yet, see [Discord bot](/docs/discord-bot) first.

## Log the server into your account

`/login` binds a Discord server to one EnvyAuth account. Every command run in this server then acts against that account.

<Steps>

  <Step
    title   ="Run the /login command"
    image   ="/assets/docs/_usermanual/setupbot/1.png"
    imageAlt="The /login slash command in the Discord composer with the api_key field filled in"
  >
    Type `/login` in any channel the bot can see, paste your EnvyAuth API key into the `api_key` field, and submit.

    Refer to [Copy your login key](/docs/discord-bot#copy-your-login-key) for the tutorial on how to get your API key.
  </Step>

  <Step
    title   ="Confirm the login response"
    image   ="/assets/docs/_usermanual/setupbot/2.png"
    imageAlt="The Logged in confirmation showing the linked account's username, plan, join date, and API key expiry"
  >
    The bot replies privately with a "Logged in!" confirmation showing the linked account's username, plan, join date, and API key expiry. If you see "Login Failed", make sure you copied the key from **Profile**, not from **API Tokens**. The pages look similar but the keys are different.
  </Step>

</Steps>

Running `/login` again on the same server replaces the linked account.

## Set up the customer panel

`/set_panel` posts a customer-facing panel in a channel. The panel has five buttons: redeem a key, get the loader, claim the buyer role, reset HWID, and check stats. One panel is bound to one project.

<Steps>

  <Step
    title   ="Run /set_panel with all four options"
    image   ="/assets/docs/_usermanual/setupbot/3.png"
    imageAlt="The /set_panel slash command in the Discord composer with channel, manager_role, buyer_role, and loader_file filled in"
  >
    Submit `/set_panel` with all four options:

    - **channel** — the text or announcement channel where the panel will be posted.
    - **manager_role** — the role allowed to run `/whitelist`, `/view_session`, and `/shutdown_session` for this project.
    - **buyer_role** — the role the "Get Role" button assigns after a key is redeemed.
    - **loader_file** — your Lua loader source as an attachment, max 64 KB, UTF-8.
  </Step>

  <Step
    title   ="Customize the panel title and description"
    image   ="/assets/docs/_usermanual/setupbot/3.5.png"
    imageAlt="Customize Panel modal with pre-filled Panel title and Panel description fields"
  >
    The bot validates the loader file and opens a **Customize Panel** modal pre-filled with a default title (`<Project Name> Control Panel`) and description. Edit or leave the defaults, then submit.
  </Step>

  <Step
    title   ="Pick the project this panel manages"
    image   ="/assets/docs/_usermanual/setupbot/4.png"
    imageAlt="Setup Project dropdown listing the projects on the linked account"
  >
    Pick a project from the **Setup Project** dropdown. Each entry shows the project name and a short prefix of its ID.
  </Step>

  <Step
    title   ="Confirm the panel was posted"
    image   ="/assets/docs/_usermanual/setupbot/5.png"
    imageAlt="Panel Created confirmation followed by the posted panel with Redeem Key, Get Script, Get Role, Reset HWID, and Get Stats buttons"
  >
    The bot posts the panel and replies with a **Panel Created!** confirmation showing the panel ID, the bound project, and both roles.
  </Step>

</Steps>

The panel's five buttons:

- **Redeem Key** — opens a modal where the customer pastes a redemption key and is whitelisted on success.
- **Get Script** — sends the customer the loader file you uploaded.
- **Get Role** — assigns `buyer_role` to a whitelisted customer.
- **Reset HWID** — clears the customer's HWID so the next execution rebinds to a new device. See [HWID reset](/docs/user-manual/hwid-reset) for cooldown rules.
- **Get Stats** — shows the customer their whitelist status, key expiry, and HWID reset cooldown.

To replace an existing panel, run `/set_panel` again with the same channel. The previous entry is overwritten.

## Configure moderation logs

`/set_modlogs` routes the bot's audit trail to a webhook. Whitelist, blacklist, HWID reset, panel, and login events all forward there.

Pass a channel or an existing webhook URL, at least one is required:

```text
/set_modlogs channel:#mod-logs
```

```text
/set_modlogs webhook:https://discord.com/api/webhooks/...
```

When you pass a channel, the bot creates a webhook named **EnvyAuth Logs** there and needs **Manage Webhooks** on that channel. When you pass a URL, the bot validates the prefix and stores it as-is.

The bot sends a test message after saving. If it lands, setup is complete.

## Replacing the configuration

All three commands overwrite. Re-running `/login` swaps the linked account, `/set_panel` replaces the panel for that channel, and `/set_modlogs` replaces the stored webhook URL. There is no separate "unset" command. Configuration persists across bot restarts until you overwrite it.
