Webhooks

koja-lib includes a built-in Discord webhook logger.

Configuration

Add webhook URLs to the KOJA.Server.Webhooks table in server/webhook.lua:

KOJA.Server.Webhooks = {
    ['cardealer'] = 'https://discord.com/api/webhooks/...',
    ['main']      = 'https://discord.com/api/webhooks/...',
    ['police']    = 'https://discord.com/api/webhooks/...',
}

Each key is a channel name you choose. You can add as many as you need.

LogMessage

Send a message to a Discord webhook channel.

KOJA.Server.LogMessage(data, channel)
Parameter
Type
Description

data

table

Message data

data.message

string

Embed description (supports Discord markdown)

data.title

string?

Embed title

data.footertext

string?

Embed footer

channel

string

Webhook key from KOJA.Server.Webhooks

Example

Example Output

The webhook sends a Discord embed that looks like:

Adding Channels

Open server/webhook.lua and add entries to the table:

Then use the key when calling LogMessage:

Last updated