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

# Affiliate

> Reward members for bringing partnerships — track invite posts, award XP, and level up affiliates.

# Affiliate

> Reward members for bringing partnerships — track invite posts, award XP, and level up affiliates.

## Overview

The affiliate system tracks members who post partnership invites in a dedicated channel. Each valid partnership post earns the member XP, counts toward their partnership total, and levels them up on a 0–10 progression. A customizable thank-you message is sent for every successful partnership.

A post counts as a valid partnership when:

* It's sent in the configured affiliate channel.
* It contains a Discord invite link (`discord.gg/...` or `discord.com/invite/...`).
* The invite points to **another** server, not your own.
* The member matches your tracked roles (if any are set).

<Info>
  Each message is counted once. Re-posting the same message won't award XP twice.
</Info>

***

## Setup

<Steps>
  <Step title="Set the affiliate channel">
    ```bash theme={null} theme={null}
    ;affiliate channel (#channel)
    ```

    ```bash theme={null} theme={null}
    ;affiliate channel #partnerships
    ```
  </Step>

  <Step title="Enable tracking">
    ```bash theme={null} theme={null}
    ;affiliate enable
    ```

    A channel must be set before you can enable tracking.
  </Step>

  <Step title="Adjust XP per partnership (optional)">
    ```bash theme={null} theme={null}
    ;affiliate xprate (amount)
    ```

    ```bash theme={null} theme={null}
    ;affiliate xprate 25
    ```

    Defaults to `10`. Accepts `1`–`1000`.
  </Step>
</Steps>

***

## Configuration

<AccordionGroup>
  <Accordion title="Restrict to specific roles">
    Limit XP tracking to up to 3 roles. Leave empty to track every member.

    ```bash theme={null} theme={null}
    ;affiliate roles [@role1] [@role2] [@role3]
    ```

    ```bash theme={null} theme={null}
    ;affiliate roles @Partner @Staff
    ```

    Run it with no roles to reset back to tracking everyone.
  </Accordion>

  <Accordion title="Custom thank-you message">
    Set the message sent when a partnership is registered. Supports plain text or a full embed. Use `default` to reset.

    ```bash theme={null} theme={null}
    ;affiliate message (embed code)
    ```

    ```bash theme={null} theme={null}
    ;affiliate message {affiliate.mention} partnered **{affiliated.server.name}** and earned {xp_gain} XP!
    ```

    ```bash theme={null} theme={null}
    ;affiliate message default
    ```
  </Accordion>

  <Accordion title="Preview the message">
    Send a preview of the current affiliate message using your own stats.

    ```bash theme={null} theme={null}
    ;affiliate test
    ```
  </Accordion>
</AccordionGroup>

### Message variables

| Variable                          | Value                           |
| --------------------------------- | ------------------------------- |
| `{affiliate}`                     | Affiliate display name          |
| `{affiliate.mention}`             | Affiliate mention               |
| `{affiliate.name}`                | Affiliate username              |
| `{affiliate.id}`                  | Affiliate user ID               |
| `{affiliate.xp}`                  | Affiliate total XP              |
| `{affiliate.level}`               | Affiliate level                 |
| `{affiliate.partnerships}`        | Affiliate partnership count     |
| `{affiliate.rank}`                | Affiliate rank in the server    |
| `{affiliated.server.name}`        | Invited server name             |
| `{affiliated.server.boost}`       | Invited server boost count      |
| `{affiliated.server.membercount}` | Invited server member count     |
| `{xp_gain}`                       | XP earned from the current post |

View this list in Discord any time:

```bash theme={null} theme={null}
;affiliate variables
```

***

## Stats & leaderboard

<Tabs>
  <Tab title="View stats">
    ```bash theme={null} theme={null}
    ;affiliate stats [@member]
    ```

    Shows partnerships, XP, level, server rank, and progress to the next level. Omit the member to view your own.

    ```bash theme={null} theme={null}
    ;affiliate stats @wanderer
    ```
  </Tab>

  <Tab title="Leaderboard">
    ```bash theme={null} theme={null}
    ;affiliate leaderboard
    ```

    Ranks members by partnerships and XP.
  </Tab>

  <Tab title="Settings">
    ```bash theme={null} theme={null}
    ;affiliate
    ```

    Displays the current affiliate configuration — status, channel, XP rate, tracked roles, and message.
  </Tab>
</Tabs>

***

## Levels

Affiliates level up as they earn XP:

| Level | XP required |
| ----- | ----------- |
| 1     | 50          |
| 2     | 150         |
| 3     | 300         |
| 4     | 500         |
| 5     | 750         |
| 6     | 1,100       |
| 7     | 1,500       |
| 8     | 2,000       |
| 9     | 2,600       |
| 10    | 3,300       |

***

## Commands

Configuration commands require **Manage Server**. Stats and leaderboard are open to everyone.

| Command                                       | Description                                    |
| --------------------------------------------- | ---------------------------------------------- |
| `;affiliate`                                  | View the current affiliate settings            |
| `;affiliate enable`                           | Enable affiliate tracking                      |
| `;affiliate disable`                          | Disable affiliate tracking                     |
| `;affiliate channel (#channel)`               | Set the affiliate channel                      |
| `;affiliate xprate (amount)`                  | XP per valid post (`1`–`1000`)                 |
| `;affiliate roles [@role1] [@role2] [@role3]` | Restrict tracking to up to 3 roles             |
| `;affiliate message (embed code)`             | Set or reset (`default`) the thank-you message |
| `;affiliate test`                             | Preview the affiliate message                  |
| `;affiliate stats [@member]`                  | View affiliate stats                           |
| `;affiliate leaderboard`                      | View the affiliate leaderboard                 |
| `;affiliate variables`                        | List supported message variables               |
