Webhook URL เป็น Secret และไม่ถูกเก็บใน Lua ของ Package ระบบอ่านจาก Non-replicated Server ConVar แล้วส่งผ่าน Queue / Retry ฝั่ง Server
ตั้ง Webhook ใน server.cfg#
server.cfg
set nX_police_webhook_default "https://discord.com/api/webhooks/..."
set nX_police_webhook_cases "https://discord.com/api/webhooks/..."
set nX_police_webhook_reports "https://discord.com/api/webhooks/..."
set nX_police_webhook_statistics "https://discord.com/api/webhooks/..."อย่าใส่ Webhook ใน Shared Config
config/customer, config/data และ config/locales ถูก Client โหลดได้ จึงห้ามมี Webhook URL, Token หรือ Secret
Event routing#
เปิด/ปิด Event และเลือกหมวด Webhook ที่ config/server/discord_logs.lua โดย URL จริงยังอยู่ใน server.cfg
bank_transferwelfare_transferpersonnel_rankduty_startedcase_createdinmate_releasedmailbox_claimreport_chat_createdagency_shop_purchasestatistics_daily_summarystatistics_resetrollback_failure
Server API#
lua
exports['nX_police']:DiscordLog({
event = 'case_created',
source = source,
title = 'Custom server log',
description = 'รายละเอียด'
})
local stats = exports['nX_police']:DiscordLogStats()Queue / Retry#
- Discord 429 เคารพ Retry-After
- 5xx / Network failure ใช้ Retry
- มี per-webhook pacing
- Security/queue limits เป็น Internal Server Policy ลูกค้าไม่ต้องตั้งเอง