> For the complete documentation index, see [llms.txt](https://k0ssek-scripts.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://k0ssek-scripts.gitbook.io/docs/scripts/easter-event/discord-webhooks.md).

# Discord Webhooks

Which events are logged and where.

The script can post to three Discord webhooks. They are set in `config/server.lua`:

```lua
Config.Webhooks = {
    rareDrop = 'https://discord.com/api/webhooks/...',
    bossKill = 'https://discord.com/api/webhooks/...',
    adminLog = 'https://discord.com/api/webhooks/...',
}
```

An empty string turns that webhook off. All three are empty by default. You can use the same URL for more than one key.

## What is sent

| Key        | Sent when                                                 | Message contains                     |
| ---------- | --------------------------------------------------------- | ------------------------------------ |
| `rareDrop` | A player starts opening an egg and the prize is legendary | Player name, server ID, egg type     |
| `rareDrop` | A player receives an epic or legendary prize              | Player name, server ID, item, rarity |
| `bossKill` | A player lands the last hit on the boss                   | Player name, server ID               |
| `adminLog` | An admin uses an action in the admin panel                | Admin name and what they did         |

A legendary prize gives two `rareDrop` messages: one when the egg is opened and one when the prize is received.

Nothing is sent to `bossKill` when an admin removes the boss.

### Admin actions that are logged

* Spawn a rabbit or an egg at the admin's position
* Spawn objects in a zone (with the count and the zone name)
* Spawn the boss
* Kill the boss
* Give an egg to a player (with the egg type and the target ID)
* Teleport to a zone or to the boss

The **Disable Event / Enable Event** button and the chat commands (`/spawnrabbit`, `/easterspawntick`, `/easterspawns`) are not logged.

## Changing the texts

The titles and descriptions of the messages come from the language file set in `Config.Locale`. Look for the keys that start with `log_webhook_` in `locales/<language>.json`. See [Localization](/docs/scripts/easter-event/localization.md).

## Troubleshooting

If nothing arrives in Discord, set `Config.Debug = true` and restart the resource. A failed request is then printed to the server console with the HTTP status that Discord returned.
