Discord notifications
Posting build and player market events to a Discord webhook.
uxmBuilders can post a line to a Discord channel, or any service that accepts Discord's webhook format, when a build starts, finishes or is cancelled, and when the player market lists, sells, reports or removes a design. The settings and the texts are in webhooks.yml.
Setting it up
- In Discord: channel settings, Integrations, Webhooks, New Webhook, copy its URL.
- In
plugins/uxmBuilders/webhooks.yml:
enabled: true
url: 'https://discord.com/api/webhooks/...'
username: 'uxmBuilders'
events: [ START, COMPLETE, CANCEL, LISTED, SOLD, REPORTED, REMOVED ]
moderationUrl: ''
/builders admin reload.
Events
| Event | Posted when | Text |
|---|---|---|
START | A build has really started: money taken and job queued | buildStarted |
COMPLETE | The last block is placed | buildCompleted |
CANCEL | A build is cancelled, for any reason | buildCancelled |
LISTED | A design is put on sale | marketListed |
SOLD | A copy of a design is bought | marketSold |
REPORTED | A player reports a listing; to moderationUrl when one is set | marketReported |
REMOVED | A moderator takes a listing down | marketRemoved |
Builds started by staff with /builders admin build are posted too. Point moderationUrl at a
staff-only channel to keep reports, and who made them, out of the players' channel. The texts are in
your language, with colour tags stripped; Discord markdown and emoji codes work:
buildCompleted: ':white_check_mark: %player.name% finished **%package.name%** (#%job.id%)'
Every placeholder is listed on the webhooks.yml page.
Notes
- Posts go out one at a time on a background thread; a slow or unreachable webhook never touches the main thread or a build.
- A rate limit from Discord is waited out for as long as Discord asks, up to an hour, and the posts are kept meanwhile; a wait longer than a minute is warned about once. A backlog of more than 100 posts is dropped, with one warning, rather than held in memory.
- Posts still queued when the server stops get up to three seconds to go out.
- Mentions are disabled: a player who names a package
@everyonepings nobody. - An empty or invalid URL logs one warning and posts nothing.
Related: webhooks.yml, Messages and menus
Was this page helpful?