Skip to content

Discord Logging

Discord Logging

The bag can log who placed it, who opened it, and what moved in or out. Create the webhook in Discord under Server Settings → Integrations → Webhooks → New Webhook → Copy Webhook URL, then paste it in.

config.lua
Config.Webhook = {
    Enabled  = false,
    Url      = '',
    Username = 'BUPA Weapon Bag',
    Avatar   = '',

    Log = {
        Place  = true,   -- a bag was dropped in the world
        Pickup = true,   -- a bag was picked back up
        Store  = true,   -- a weapon went into a bag
        Take   = true,   -- a weapon came out of a bag
        Open   = false,  -- somebody opened a bag (very chatty)
        Raid   = true,   -- a job opened a bag that was not theirs
    },

    Colors = {
        Place  = 5990640,
        Pickup = 5990640,
        Store  = 5990640,
        Take   = 15680580,
        Open   = 5990640,
        Raid   = 15680580,
    },

    Footer = 'BUPA Weapon Bag',
}

Nothing is sent while Enabled is false or Url is empty.

The events

Event Embed title Shipped
Place Bag placed On
Pickup Bag picked up On
Store Weapon stored On
Take Weapon taken On
Open Bag opened Off — every open of every bag is a lot of traffic
Raid Bag searched by staff On

Open and Raid are deliberately separate. A player opening their own bag is routine; an inspecting job opening somebody else's is the thing you want to see, which is why searches are logged even though ordinary opens are not.

What each embed contains

Field Content
Player Name, server id and citizen id of whoever acted
Bag The bag's id and its owner's name
Weapon The weapon label, in a code block — only on store and take
Pocket Which pocket it went into or came out of — only on store and take
Contents The bag's state after the action: item count against Config.Capacity.MaxItems, and total weight

Colours are decimal numbers. Pick one at spycolor.com and use the decimal value.

Keep the webhook URL private. Anyone holding it can post in that channel.