> For the complete documentation index, see [llms.txt](https://jiffyjrdevelopment.gitbook.io/jiffyjrdevelopmentdocs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://jiffyjrdevelopment.gitbook.io/jiffyjrdevelopmentdocs/jiffy-jr-development-docs/jiffy-banking-v1/advanced-features/discord-webhooks.md).

# Discord Webhooks

jiffy-banking can post embed messages to Discord for key financial events. All webhooks are disabled by default.

## Setup

Open `shared/config.lua` and set `Enabled = true`, then add your webhook URLs:

```lua
Config.Discord = {
    Enabled   = true,
    Username  = 'Jiffy Banking',
    AvatarUrl = '',    -- optional bot avatar URL

    Webhooks = {
        default          = 'https://discord.com/api/webhooks/...',
        large_transfer   = 'https://discord.com/api/webhooks/...',
        admin_adjust     = 'https://discord.com/api/webhooks/...',
        account_freeze   = 'https://discord.com/api/webhooks/...',
        loan_approved    = 'https://discord.com/api/webhooks/...',
        loan_default     = 'https://discord.com/api/webhooks/...',
        society_large_wd = 'https://discord.com/api/webhooks/...',
        illegal_wash     = 'https://discord.com/api/webhooks/...',
    },
}
```

{% hint style="info" %}
You can use the same webhook URL for every event, or create separate channels per event type. Any event without its own URL falls back to `default`.
{% endhint %}

{% hint style="warning" %}
Leave `Enabled = false` and all URLs as `''` if you do not want Discord logging. This is the default.
{% endhint %}

## Event Reference

| Key                | When it fires                                                       |
| ------------------ | ------------------------------------------------------------------- |
| `large_transfer`   | A transfer meets or exceeds `Thresholds.large_transfer`             |
| `admin_adjust`     | An admin manually adjusts a player's balance                        |
| `account_freeze`   | An account is frozen or unfrozen                                    |
| `loan_approved`    | A loan application is approved                                      |
| `loan_default`     | A loan is marked as defaulted                                       |
| `society_large_wd` | A society withdrawal meets or exceeds `Thresholds.society_large_wd` |
| `illegal_wash`     | A dirty money wash meets or exceeds `Thresholds.illegal_wash`       |
| `default`          | Fallback for any event without its own webhook URL                  |

## Thresholds

Only fire a webhook when the amount reaches a certain level:

```lua
Config.Discord.Thresholds = {
    large_transfer   = 100000,   -- only log transfers ≥ $100,000
    society_large_wd = 50000,    -- only log society withdrawals ≥ $50,000
    illegal_wash     = 0,        -- 0 = log every wash regardless of amount
}
```

## Embed Colours

Colours are decimal values (not hex). Defaults:

```lua
Config.Discord.Colors = {
    default          = 3447003,   -- blue
    large_transfer   = 16776960,  -- yellow
    admin_adjust     = 15158332,  -- orange
    account_freeze   = 15548997,  -- red
    loan_approved    = 3066993,   -- green
    loan_default     = 10038562,  -- dark red
    society_large_wd = 16776960,  -- yellow
    illegal_wash     = 10181046,  -- purple
}
```

To convert a hex colour to decimal: remove the `#`, then use a hex-to-decimal converter (e.g. `#e63946` → `15087942`).
