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

# Levels

> Track member activity and reward engagement with Greed's leveling system

The Levels feature allows you to track member activity through text and voice channels, rewarding engagement with custom roles and messages. Members can earn XP through messages and voice activity.

<Note>You can find all the variables in the [/resources/variables](/resources/variables) page. You can use these variables on your `levels message`</Note>

## Requirements

* Server must have at least one text channel for level messages
* Bot must have permissions to:
  * Send messages
  * Embed links
  * Manage roles (for level rewards)
  * View channels
  * Connect to voice channels

## Setup

### Enable Leveling

<CodeGroup>
  ```bash Syntax theme={null}
  ,levels setup
  ```

  ```bash Example theme={null}
  ,levels setup
  ```
</CodeGroup>

### Set Level Message Channel

<CodeGroup>
  ```bash Syntax theme={null}
  ,levels channel <channel>
  ```

  ```bash Example theme={null}
  ,levels channel #level-ups
  ```
</CodeGroup>

### Customize Level Message

<CodeGroup>
  ```bash Syntax theme={null}
  ,levels message <message>
  ```

  ```bash Example theme={null}
  ,levels message {embed}{description: Congrats {user.mention} for reaching level {level}!}{color: #2b2d31}
  ```
</CodeGroup>

### Test Level Message

<CodeGroup>
  ```bash Syntax theme={null}
  ,levels message test
  ```

  ```bash Example theme={null}
  ,levels message test
  ```
</CodeGroup>

## Level Rewards

### Add Level Role

<CodeGroup>
  ```bash Syntax theme={null}
  ,levels role <level> <role>
  ```

  ```bash Example theme={null}
  ,levels role 5 @level-5
  ```
</CodeGroup>

### Remove Level Role

<CodeGroup>
  ```bash Syntax theme={null}
  ,levels role remove <level>
  ```

  ```bash Example theme={null}
  ,levels role remove 5
  ```
</CodeGroup>

### List Level Rewards

<CodeGroup>
  ```bash Syntax theme={null}
  ,levels list
  ```

  ```bash Example theme={null}
  ,levels list
  ```
</CodeGroup>

## Voice Leveling

### Enable Voice Leveling

<CodeGroup>
  ```bash Syntax theme={null}
  ,levels voice enable
  ```

  ```bash Example theme={null}
  ,levels voice enable
  ```
</CodeGroup>

### View Voice Settings

<CodeGroup>
  ```bash Syntax theme={null}
  ,levels voice settings
  ```

  ```bash Example theme={null}
  ,levels voice settings
  ```
</CodeGroup>

## Stats & Leaderboard

### View User Stats

<CodeGroup>
  ```bash Syntax theme={null}
  ,levels stats [user]
  ```

  ```bash Example theme={null}
  ,levels stats
  ,levels stats @user
  ```
</CodeGroup>

### View Leaderboard

<CodeGroup>
  ```bash Syntax theme={null}
  ,levels leaderboard [total|text|voice] [limit]
  ```

  ```bash Example theme={null}
  ,levels leaderboard total 10
  ,levels leaderboard voice 5
  ```
</CodeGroup>

## Variables

### Level Message Variables

* `{user}` - User object
* `{user.mention}` - User mention
* `{user.name}` - Username
* `{level}` - New level
* `{guild}` - Server object
* `{channel}` - Channel object

### Voice Leveling Settings

* XP per minute: 5 (default)
* Max XP per session: 100 (default)
* Minimum voice time: 1 minute (default)

<Note>
  - Level roles are automatically assigned when members reach the required level
  - Voice XP is awarded every minute while in voice channels
  - Leaderboard data is cached for 5 minutes
  - User stats are cached for 5 minutes
</Note>

<Warning>
  Make sure the bot's role is above any level reward roles to ensure proper role assignment.
</Warning>
