> For the complete documentation index, see [llms.txt](https://mango-5m.gitbook.io/mango5m-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://mango-5m.gitbook.io/mango5m-docs/resources/mango-prison/configuration/discord-logging.md).

# Discord Logging

Every action the prison records, sent to Discord — one webhook URL per channel, with routing you control.

**Everything the terminal's LOGS page shows is also sent to Discord**, plus the richer embeds for jailing, release, escapes, lockdowns, write-ups and visits.

That is wired at the logging call itself rather than per feature, so anything added to the resource later logs to Discord the moment it logs at all. An action with no channel mapping lands in `misc` rather than vanishing.

Everything lives in `config/webhooks.lua`.

## Channels

There are **fourteen channels**, each with its own webhook URL:

`intake` · `release` · `discipline` · `solitary` · `jobs` · `cctv` · `doors` · `searches` · `visitation` · `headcount` · `escapes` · `armoury` · `admin` · `misc`

```lua
Config.Webhooks = {
    enabled  = true,
    username = 'Mango Corrections',
    avatar   = '',                       -- optional avatar URL

    channels = {
        intake  = 'https://discord.com/api/webhooks/...',
        release = 'https://discord.com/api/webhooks/...',
        -- ...
    },
}
```

Put **the same URL in several** to merge them into one Discord channel. Leave one **blank** to silence that channel entirely — nothing is queued, nothing is retried, it simply isn't sent.

{% hint style="info" %}
An enabled config with no URLs anywhere is almost always a mistake, so the resource says so once at boot rather than silently dropping every log:

```
[mango_prison] Config.Webhooks is enabled but no channel has a URL — nothing will be sent to Discord.
```

{% endhint %}

## Colours

One embed colour per channel, as a decimal integer:

```lua
colours = {
    intake     = 15105570,   -- orange
    release    = 3066993,    -- green
    discipline = 15158332,   -- red
    solitary   = 10038562,   -- dark red
    jobs       = 3447003,    -- blue
    cctv       = 9807270,    -- grey
    -- ...
},
```

## Routing

`route` maps an **action** to a **channel**. The keys are the audit-log action names — the same ones the terminal's LOGS page shows, so anything you can see in the terminal you can route.

```lua
route = {
    jail = 'intake', mugshot = 'intake', intakeProcessed = 'intake',
    writeup = 'discipline', solitary = 'solitary',
    cctvCreate = 'cctv', cctvDestroyed = 'cctv', cctvView = 'cctv',
    armouryTake = 'armoury', armouryReturn = 'armoury',
    -- ...
},
```

Anything unrouted goes to `misc`.

## Ignoring an action

Some actions are too chatty to be worth a Discord message. `ignore` drops them from Discord while leaving them in the in-game audit log:

```lua
ignore = {
    cctvProps = true,
},
```

## What each message looks like

Two paths produce messages, and they never double-post the same event.

**Audit entries** get a title, the subject, who did it and the detail:

> **Sent to solitary** **Subject:** John Doe **By:** Officer Reyes **Detail:** 15 minutes — fighting in the yard

Action names are given human wording (`solitaryRelease` → *Released from solitary*, `armouryTake` → *Armoury: item drawn*). Anything without an explicit title is de-camel-cased automatically, so a new action reads sensibly on day one.

**Rich embeds** are hand-written for the six events worth more than a log line — jailing, release, escapes, lockdowns, write-ups and visits. Those are skipped on the audit path so they are never posted twice.

## Turning it off

```lua
Config.Webhooks = { enabled = false }
```

Nothing is sent and nothing is built. The in-game audit log is unaffected — it is the source, not the consumer.

{% hint style="warning" %}
**Treat a webhook URL as a secret.** Anyone holding it can post to that channel as your prison. If one leaks, delete it in Discord (**Channel → Integrations → Webhooks**) and paste the new URL in — the config is the only place it appears.
{% endhint %}
