# configuration

## .env File

Bot configuration is stored in `.env` file in the resource root.

```env
# REQUIRED: Discord Bot Token
TOKEN=YOUR_BOT_TOKEN_HERE

# REQUIRED: Owner Role ID (bypasses all permission checks)
OWNER_ROLE_ID=123456789012345678

# OPTIONAL: Fallback Admin Role ID 
ADMIN_ROLE_ID=123456789012345678

# OPTIONAL: Log Channel ID
LOG_CHANNEL_ID=123456789012345678

# OPTIONAL: Command Prefix (default: !)
PREFIX=!
```

| Variable         | Required | Description                                             |
| ---------------- | -------- | ------------------------------------------------------- |
| TOKEN            | ✅        | Discord bot token from Developer Portal                 |
| OWNER\_ROLE\_ID  | ✅        | Role with full access to all commands                   |
| ADMIN\_ROLE\_ID  | ❌        | Fallback role for commands without specific permissions |
| LOG\_CHANNEL\_ID | ❌        | Channel for bot activity logs                           |
| PREFIX           | ❌        | Command prefix (default: `!`)                           |

***

## shared/config.lua

Main Lua configuration file.

```lua
Config = {}

-- Language: 'en' or 'pl'
Config.Locale = 'en'

-- Screenshot quality (0.1 - 1.0)
Config.Screenshot = {
    Quality = 0.85, 
}

-- Warning system settings
Config.WarnSystem = {
    MaxWarnings = 5,   -- Display limit
    ExpireDays = 30,   -- Auto-expire after X days
}

-- Framework detection
Config.Framework = {
    AutoDetect = true,      -- Detect ESX/QB-Core/QBox automatically
    Name = 'standalone',    -- Manual: 'esx', 'qb', 'qbox', 'standalone'
}
```

***

## Command Permissions

Configure which Discord roles can use each command.

```lua
Config.CommandPermissions = {
    -- Ban System
    ['ban'] = { roles = { '123456789012345678' } },
    ['unban'] = { roles = { '123456789012345678' } },
    ['bans'] = { roles = { '123456789012345678', '987654321098765432' } },
    
    -- Warning System
    ['warn'] = { roles = {} },
    ['warnings'] = { roles = {} },
    ['unwarn'] = { roles = {} },
    ['clearwarns'] = { roles = {} },
    
    -- Player Management
    ['players'] = { roles = {} },
    ['player'] = { roles = {} },
    ['kick'] = { roles = {} },
    
    -- Health & Status
    ['heal'] = { roles = {} },
    ['revive'] = { roles = {} },
    ['freeze'] = { roles = {} },
    ['unfreeze'] = { roles = {} },
    ['crashplayer'] = { roles = {} },
    
    -- Economy (requires framework)
    ['givemoney'] = { roles = {} },
    ['giveitem'] = { roles = {} },
    ['givecar'] = { roles = {} },
    
    -- Jobs (requires framework)
    ['setjob'] = { roles = {} },
    ['setgroup'] = { roles = {} },
    
    -- Teleport
    ['bring'] = { roles = {} },
    ['teleport'] = { roles = {} },
    
    -- Utilities
    ['announce'] = { roles = {} },
    ['ss'] = { roles = {} },
    ['blackout'] = { roles = {} },
    
    -- Server Management
    ['ping'] = { roles = {} },
    ['serverinfo'] = { roles = {} },
    ['restartserver'] = { roles = {} },
    ['stopserver'] = { roles = {} },
    ['kickall'] = { roles = {} },
    ['txannounce'] = { roles = {} },
    
    -- Help
    ['help'] = { roles = {} },
}
```

### Permission Logic

{% stepper %}
{% step %}

### OWNER\_ROLE\_ID

Full access to everything.
{% endstep %}

{% step %}

### Specific roles in command

Only those roles listed in the command's roles array can use the command.
{% endstep %}

{% step %}

### Empty roles fallback

* If a command's roles is an empty table `{}`, it falls back to using `ADMIN_ROLE_ID`.
* If `ADMIN_ROLE_ID` is not set, anyone can use the command.
  {% endstep %}
  {% endstepper %}

***

## Framework Settings

The bot automatically detects your framework:

| Framework  | Detection              |
| ---------- | ---------------------- |
| ESX        | `es_extended` resource |
| QB-Core    | `qb-core` resource     |
| QBox       | `qbx_core` resource    |
| Standalone | No framework detected  |

To manually set framework:

```lua
Config.Framework = {
    AutoDetect = false,
    Name = 'esx',  -- 'esx', 'qb', 'qbox', 'standalone'
}
```

***

## Screenshot Settings

Configure screenshot quality for `!ss` command:

```lua
Config.Screenshot = {
    Quality = 0.85,  -- 0.1 (low) to 1.0 (max)
}
```

{% hint style="info" %}
Requires `screenshot-basic` resource!
{% endhint %}

***

## Warning System

Configure warning behavior:

```lua
Config.WarnSystem = {
    MaxWarnings = 5,   -- Display in chat: "Warning (X/5)"
    ExpireDays = 30,   -- Warnings auto-expire after 30 days
}
```
