Skip to content
Contractsv1.19.1

Events

⭐ Premium

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
}
}
}
FieldTypeDefaultDescription
Discord Webhook URLstring | nullnullDiscord 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:

FieldTypeDefaultDescription
Commandsstring[][]Server console commands to run each time the event happens. They can use the event's log placeholders, like {player_id}.
Discord Webhook URLstring | nullnullPosts this event to its own Discord webhook instead of the one at the top. null uses the one at the top.
Discord Messagestring | nullnullText posted to Discord. It can use the event's log placeholders. null posts no text.
Discord Embedobject | nullnullEmbed 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. null leaves it out.
  • Description: the main text. null leaves it out.
  • Color: the bar on the left, as a hex color like "#5865F2". null uses Discord’s default.
"Discord Embed": {
"Title": "Contract completed",
"Description": "{player_name} completed {contract_name} in {duration}s",
"Color": "#57F287"
}

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.

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.

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.

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.

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.

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 never runs event commands or posts to Discord. The Events section stays in your config and starts working when you upgrade.