# Permission

## <mark style="color:blue;">Introduction</mark>

The Permission configuration file (`permission.json`) controls access to bot commands using a role-based hierarchy system or Discord's built-in permission system.

***

## <mark style="color:blue;">Enabled</mark>

**Type:** Boolean

Whether to use the custom permission system.

```json
enabled: true
```

**When `true`:** Uses the custom role-based permission levels defined in this config\
**When `false`:** Uses Discord's native command permission system

{% hint style="danger" %}
**Warning:** If disabled, everyone can use every command unless you manually configure permissions in Discord Server Settings > Integrations > Athena Bot.
{% endhint %}

Learn more about Discord's built-in command permissions: [Discord Support Article](https://support.discord.com/hc/en-us/articles/4644915651095-Command-Permissions)

***

## <mark style="color:blue;">Permission Levels</mark>

**Type:** Object

Define role-based permission levels with Discord role IDs.

```json
permission_levels: {
    management: "804354019455139900",
    admin: "804354024048427009",
    staff: "804354029076348959",
    support: "884573835205148692",
    member: "804354037662220289",
    everyone: "804352424777220186",
}
```

**How it works:**

* Each permission level is assigned to a Discord role ID
* Permission level names can be customized (they don't have to match role names)
* When a command requires a specific permission level, users with that role **or any role higher in the Discord role hierarchy** can use it
* The `everyone` level should be set to your server ID (same as @everyone role)

**Example:** If a command requires `support` level, users with the support role, staff role, admin role, or management role can all use it.

***

## <mark style="color:blue;">Admins</mark>

**Type:** Array of Strings

User IDs that bypass all permission checks.

```json
admins: ["707336356786864211", "123456789012345678"]
```

These users can execute any command regardless of their roles or the command's required permission level.

***

## <mark style="color:blue;">Command Permissions</mark>

Commands are organized by plugin category, with each command assigned a permission level.

**Format:**

```json
plugin_name: {
    command_name: "permission_level",
}
```

**Examples:**

```json
core: {
    botinfo: "member",
    setup: "management",
    restart: "management",
}

moderation: {
    warn: "staff",
    ban: "admin",
    report: "member",
}

tickets: {
    tclose: "support",
    tpanel: "management",
}
```

The permission level must match one of the levels defined in `permission_levels`.

***

## <mark style="color:blue;">Complete Configuration Example</mark>

Here's a production-ready permission configuration:

```json
{
    config: {
        enabled: true,

        permission_levels: {
            management: "804354019455139900",
            admin: "804354024048427009",
            staff: "804354029076348959",
            support: "884573835205148692",
            member: "804354037662220289",
            everyone: "804352424777220186", // Your server ID
        },

        admins: ["707336356786864211"],

        core: {
            botinfo: "member",
            setup: "management",
            restart: "management",
        },

        moderation: {
            warn: "staff",
            ban: "admin",
            kick: "admin",
            mute: "staff",
        },

        tickets: {
            tclose: "support",
            tpanel: "management",
            topen: "support",
        },

        // Add all other plugin commands following the same format
    },
}
```

{% hint style="info" %}
**Tip:** The default configuration file includes all available commands. Simply adjust the permission levels to match your server's role structure.
{% endhint %}


---

# Agent Instructions: 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:

```
GET https://docs.iynxdev.com/configuration-files/permission.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
