# Discord Integration

Log all events and admin actions to Discord via webhooks.

***

### Setup

#### Step 1: Create Webhook

1. Open Discord server settings
2. Go to the channel for logs
3. Edit Channel → Integrations → Webhooks
4. Click New Webhook
5. Copy the Webhook URL

#### Step 2: Configure

Paste the URL in config.lua:

```lua
Config.Discord = {
    enabled = true,
    webhook = 'https://discord.com/api/webhooks/YOUR_ID/YOUR_TOKEN',
    logEventStart = true,
    logEventEnd = true,
    logEventClaim = true,
    logAdminAction = true,
    botName = 'Elena Events',
    botAvatar = '',
    serverName = 'Your Server Name',
}
```

### Log Types

#### Event Started

Triggered when any event begins.

* Event type (AIRDROP, HOTZONE, CONVOY, TREASURE)
* Location name
* Event ID
* Online player count
* Color-coded embed

#### Event Ended

Triggered when any event finishes.

* Event type and location
* Result: Completed, Expired, or Stopped
* Event ID

#### Reward Claimed

Triggered when a player claims a reward.

* Player name and server ID
* Event type and location
* Money amount
* List of items received
* Green colored embed

#### Admin Action

Triggered on admin panel actions.

* Admin name and server ID
* Action type
* Action details
* Yellow colored embed

***

### Embed Colors

| Type     | Color  | Decimal  |
| -------- | ------ | -------- |
| Airdrop  | Orange | 16744243 |
| Hotzone  | Red    | 16724787 |
| Convoy   | Blue   | 4488447  |
| Treasure | Purple | 11141375 |
| Admin    | Yellow | 16776960 |
| Success  | Green  | 65280    |
| Error    | Red    | 16711680 |

***

### Customization

| Setting    | Description                              |
| ---------- | ---------------------------------------- |
| botName    | Display name shown on webhook messages   |
| botAvatar  | URL to an image for the bot's avatar     |
| serverName | Your server name, shown in embed footers |

***

### Troubleshooting

| Issue                   | Solution                                     |
| ----------------------- | -------------------------------------------- |
| No logs appearing       | Verify webhook URL is correct                |
| Rate limited by Discord | Discord allows 30 requests per minute        |
| Error in server console | Enable Config.Debug for detailed errors      |
| Logs in wrong channel   | Check webhook is attached to correct channel |


---

# 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://elena-scripts.gitbook.io/elenascripts/core-systems/el-events/discord-integration.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.
