📃logs

Overview

SL-Chat includes a comprehensive Discord webhook logging system. All chat messages, commands, and player actions can be logged to Discord channels for moderation and record-keeping.


Configuration File

Location: shared/logs.config.lua

Logs = {}

Logs.Enabled = true
Logs.BotName = 'sl-chat Logs'
Logs.BotAvatar = nil
Logs.IncludePlayerInfo = true
Logs.HideIP = false

General Settings

Option
Type
Default
Description

Enabled

boolean

true

Enable/disable all logging

BotName

string

'sl-chat Logs'

Discord webhook bot name

BotAvatar

string/nil

nil

Bot avatar URL (optional)

IncludePlayerInfo

boolean

true

Include player identifiers in logs

HideIP

boolean

false

Hide player IP addresses


Log Types

Each log type can have its own webhook and settings.


Log Type Options

Option
Type
Description

enabled

boolean

Enable this log type

webhook

string

Discord webhook URL

color

number

Embed color (decimal)

title

string

Embed title prefix


Built-in Log Types

Type
Description
Used By

rp_commands

RP actions (ME, DO, MED, TRY)

/me, /do, /med, /try

ooc

OOC chat messages

Default chat, /globalooc

private_messages

Private whispers

/w

reports

Player reports

/report, /reportodp

admin

Admin actions

/ac

system

System messages

Internal system messages

general

General/fallback

Other logs


Discord Embed Colors

Common colors in decimal format:

Color
Decimal
Hex

Red

15158332

#E74C3C

Orange

15105570

#E67E22

Yellow

16776960

#FFFF00

Green

3066993

#2ECC71

Blue

3447003

#3498DB

Purple

10181046

#9B59B6

Pink

15277667

#E91E63

Cyan

1752220

#1ABC9C

White

16777215

#FFFFFF

Gray

9807270

#95A5A6


Creating Discord Webhooks

1

Open Discord Server Settings

Right-click your server → Server Settings → Integrations

2

Create Webhook

Click "Webhooks" → "New Webhook"

3

Configure Webhook

1

Name your webhook (e.g., "SL-Chat RP Commands")

2

Select the channel

3

Copy the webhook URL

4

Add to Config


Complete Configuration Example


Log Information

Player Information (when IncludePlayerInfo = true)

Each log includes:

Field
Description

Player Name

Character/display name

Player ID

Server ID

Discord

Discord user mention

License

Rockstar license

FiveM

FiveM account ID

IP

IP address (if HideIP = false)

Example Log Output


Linking Commands to Log Types

In commands.config.lua, each command has a logType property:


Adding Custom Log Types

1

Add to Logs.Types

2

Use in Commands

3

Or Use Export


Custom Logging via Exports

LogToDiscord

LogChatCommand


Disabling Logs

Disable All Logs

Disable Specific Type

Disable for Specific Command

Remove or comment out logType in command config:


Privacy & GDPR

For GDPR compliance:

This will replace IPs with ***HIDDEN*** in all logs.


Troubleshooting

Webhook errors and missing logs

1

Check logs not appearing:

  • Ensure Logs.Enabled = true

  • Verify webhook URL is correct

  • Check specific log type enabled = true

  • Ensure webhook URL is not 'YOUR_WEBHOOK_URL_HERE'

2

Webhook errors:

  • Discord webhooks have rate limits

  • Invalid URLs will fail silently

  • Check server console for HTTP errors

3

Missing player info:

  • Check Logs.IncludePlayerInfo = true

  • Player must have valid identifiers


Next Steps

Last updated