Skip to content

Webhooks

Neerti edited this page May 13, 2021 · 1 revision

WEBHOOKS

If you wish to use Discord webhooks, which are a way of passing information from the server to a Discord channel, you will need to copy webhooks.json into config/ from config/example/ and add definitions pointing the desired event at the desired Discord webhook URL. Valid webhook IDs as of time of writing are as follows:

  • webhook_roundend
    • Sent out when the round has ended. Will include the mode name and summarize survivors and ghosts.
  • webhook_roundstart
    • The game server has finished initializing, and the round will begin soon.
  • webhook_custom_event
    • The Change-Custom-Event verb was used, which sends a copy of the text entered through the webhook.
  • webhook_ahelp_sent
    • Someone sends an adminhelp, or a ticket is changed in some way (being handled, closed, resolved, reopened, etc)
  • webhook_fax_sent
    • Someone sends an in-game fax to the admins, or an admin replies to a fax.

Each definition can optionally include an array of roles to mention when the webhook is called. Roles must be provided using the role ID (ex. <@&555231866735689749>), which can be obtained by writing \@somerole into the chat, in order for pinging to work correctly. Including the mentions as the value keyed to a URL will send the mentions only with that URL, while using the "mentions" field will attach the mentions to all URLs.

Webhooks additionally require a HTTP POST library called byhttp. The compiled lib, byhttp.dll on Windows or libbyhttp.so on Linux, must be placed in the lib directory by default in order for webhooks to function. The DLL location can be customized by supplying WINDOWS_HTTP_POST_DLL_LOCATION UNIX_HTTP_POST_DLL_LOCATION, or HTTP_POST_DLL_LOCATION as preprocessor macros containing the desired path.