JM-NPCRoadRage can post formatted embeds to a Discord channel every time a road rage incident, police dispatch, player injury, or admin action occurs.
Creating a Webhook#
- Open Discord and navigate to the channel where you want logs to appear.
- Open Channel Settings → Integrations → Webhooks.
- Click New Webhook, give it a name (e.g.
Road Rage Bot), and click Copy Webhook URL.
Configuring the Webhook#
Paste the URL into config.lua:
Config.Discord = { enabled = true, webhook = "https://discord.com/api/webhooks/YOUR_ID/YOUR_TOKEN", botName = "Road Rage Bot", serverName = "My Server", -- appears in embed footers}Keep your webhook URL private. Anyone with the URL can post messages to your channel.
Logged Event Types#
| Event | Embed colour | When it fires |
|---|---|---|
| Road rage incident | Orange | An NPC attacks a player. |
| Police notification | Blue | Police are dispatched to an incident. |
| Player injury | Red | A player receives an injury from an NPC. |
| Admin action | Purple | An admin uses a command such as /npcrage-stats. |
| System statistics | Green | Hourly summary (disabled by default). |
Turn individual event types on or off:
Config.Discord.logEvents = { roadRageIncidents = true, policeNotifications = true, playerInjuries = true, adminActions = true, systemStats = false, -- high volume; leave off unless needed}Spam Prevention#
The resource includes built-in rate limiting to avoid flooding your channel.
| Option | Default | Description |
|---|---|---|
spamPrevention.enabled | true | Enables all spam prevention. |
spamPrevention.cooldownTime | 60000 | Milliseconds between similar log types (60 s). |
spamPrevention.maxLogsPerMinute | 5 | Maximum logs per type per minute. |
spamPrevention.combineIncidents | true | Batches excess road rage incidents into a single combined embed. |
Quiet Hours#
You can reduce logging during low-activity hours to keep your channel clean:
Config.Discord.spamPrevention.quietHours = { enabled = true, startHour = 2, -- 2 AM server time endHour = 8, -- 8 AM server time reducedTypes = { "roadRageIncidents", "policeNotifications" },}Role Mentions#
To ping a Discord role when specific events fire, add role IDs:
Config.Discord.mentionRoles = { adminRole = "YOUR_ADMIN_ROLE_ID", -- pinged on admin actions policeRole = "YOUR_POLICE_ROLE_ID", -- pinged on police notifications}Leave a value as "" to disable pinging for that event type.
To find a role ID in Discord, enable Developer Mode under User Settings → Advanced, then right-click the role and select Copy ID.