Events
Run console commands, post to a Discord channel, or both, each time something happens in Contracts. These are the same events as Logging, and they work even when logging is off. Every event is off by default.
{ "Events": { "Discord Webhook URL": "https://discord.com/api/webhooks/...", "Contract Completed": { "Commands": ["inventory.giveto {player_id} scrap 50"], "Discord Webhook URL": null, "Discord Message": "{player_name} completed {contract_name} in {duration}s", "Discord Embed": null } }}Fields
Section titled “Fields”| Field | Type | Default | Description |
|---|---|---|---|
Discord Webhook URL | string | null | null | Discord webhook that events post to. An event can set its own URL instead. null turns Discord off for events that have no URL of their own. |
Each event has these fields:
| Field | Type | Default | Description |
|---|---|---|---|
Commands | string[] | [] | Server console commands to run each time the event happens. They can use the event's log placeholders, like {player_id}. |
Discord Webhook URL | string | null | null | Posts this event to its own Discord webhook instead of the one at the top. null uses the one at the top. |
Discord Message | string | null | null | Text posted to Discord. It can use the event's log placeholders. null posts no text. |
Discord Embed | object | null | null | Embed posted to Discord, with a Title, a Description and a Color. Title and Description can use the event's log placeholders. null posts no embed. |
Discord Embed is null or an object with three fields:
Title: the bold line at the top.nullleaves it out.Description: the main text.nullleaves it out.Color: the bar on the left, as a hex color like"#5865F2".nulluses Discord’s default.
"Discord Embed": { "Title": "Contract completed", "Description": "{player_name} completed {contract_name} in {duration}s", "Color": "#57F287"}Placeholders
Section titled “Placeholders”Commands, Discord messages and embed text use the same placeholders as the event’s log line. Each event on the Logging page lists its placeholders, and every event also has the different time placeholders.
Commands
Section titled “Commands”Each command runs in the server console in the order you list them. Event commands run for every contract. Not to be confused with a Command reward, which runs for one specific contract.
Discord
Section titled “Discord”Getting a webhook URL
Section titled “Getting a webhook URL”In Discord, open the channel’s settings, go to Integrations, then Webhooks, create a webhook
and copy its URL. Put it in the top Discord Webhook URL to use it for every event. To send one event
to another channel, set that event’s own Discord Webhook URL.
Keep the URL private. Anyone who has it can post in that channel.
What gets posted
Section titled “What gets posted”Set Discord Message, Discord Embed, or both. An event with both set to null posts nothing.
Embeds show the time of the event at the bottom.
Busy servers
Section titled “Busy servers”The plugin sends one post at a time per webhook URL. Events that happen close together go out in one post: messages are joined line by line, up to 2,000 characters, and embeds are stacked, up to 10 per post.
If Discord asks the plugin to slow down, it waits as long as Discord says and tries again. Any other error is logged as a warning and that post is dropped. If 100 posts are already waiting for one URL, new ones are dropped until it catches up.
Testing from the editor
Section titled “Testing from the editor”On the web editor’s Events page, each event with a Discord message or embed has a Test send button. It posts from your browser to the event’s URL, or the top one, with sample values like “Test Player” in the placeholders. If Discord refuses the post, the editor shows Discord’s error.
Lite Edition
Section titled “Lite Edition”Lite never runs event commands or posts to Discord. The Events section stays in your config and
starts working when you upgrade.
