# Required permissions

To ensure that the bot functions correctly in your server, it needs specific permissions. Below is a list of required permissions, along with their purposes.

***

### 🔹 **Essential Permissions**

These permissions are **mandatory** for the bot to function properly.

| Permission Name                                             | Purpose                                                                                       |
| ----------------------------------------------------------- | --------------------------------------------------------------------------------------------- |
| `sendMessages`                                              | Allows the bot to send messages in text channels. For old message commands or invite logs     |
| `embedLinks`                                                | Enables the bot to send rich embeds                                                           |
| `viewAuditLog`                                              | Required to fetch audit logs for invite tracking                                              |
| <mark style="background-color:yellow;">`manageGuild`</mark> | <mark style="background-color:yellow;">Allows the bot to access the invite code list</mark>   |
| `createInstantInvite`                                       | Needed if the bot generates invite links for the createInvite command or the smartleaderboard |

***

### 🔹 **Channel Permissions**

The bot needs to verify its permissions **per channel** to ensure it can track invites and send messages in logging channels.

| Permission Name                                                | Purpose                                                                                                               |
| -------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------- |
| <mark style="background-color:yellow;">`manageChannels`</mark> | <mark style="background-color:yellow;">Required to check ans receive the newly created invites in that channel</mark> |

***

### 🔹 **Logging Channel Permissions**

If your bot logs events such as joins, leaves, or moderation actions, it requires specific permissions in those channels.

| Permission Name | Purpose                                                            |
| --------------- | ------------------------------------------------------------------ |
| `sendMessages`  | Needed for sending log messages in join/leave/action log channels. |
| `embedLinks`    | Required to format log messages properly in embeds.                |

The bot checks these permissions in **join logs**, **leave logs**, and **action log channels** (if configured).

***

### ✅ **How to Grant Permissions**

1. **Server-wide Permissions:**
   * Go to **Server Settings** → **Roles**.
   * Select the **Bot’s Role**.
   * Ensure the bot has all required permissions in the **"Permissions"** section.
2. **Per-Channel Permissions:**
   * Right-click the channel → **Edit Channel** → **Permissions**.
   * Find the bot’s role and ensure it has the required permissions.

***

### ❌ **What Happens if Permissions Are Missing?**

| Missing Permission | Consequence                                                             |
| ------------------ | ----------------------------------------------------------------------- |
| `sendMessages`     | Your invite logs aren't working                                         |
| `embedLinks`       | The bot's messages may not format correctly.                            |
| `viewAuditLog`     | The bot can't track invites correctly                                   |
| `manageGuild`      | The bot can't track invite at all                                       |
| `manageChannels`   | The bot cannot track accurately and will often fail to give the inviter |

If any of these permissions are missing, the bot may not function properly.

\
To check missing permissions, use the `/diagnose` command.
