Zum Hauptinhalt springen

Webhook Fact Event

Publish a Discord webhook when a Typewriter fact changes

Publishes a Discord webhook whenever a Typewriter fact changes. The watcher uses Typewriter's player-facing fact tracker. This means a grouped fact is read through the same group implementation as the rest of the engine instead of reading storage directly, and the entry remains compatible with custom fact implementations.

Felder

FeldTypStandardBeschreibung
enabledBooleantrueKeep this event disabled without removing the manifest entry
factRef<ReadableFactEntry>—Readable Typewriter fact to observe
destinationRef<WebhookDefinitionEntry>—Reusable Discord destination receiving the event
scopeFactWebhookScopePLAYERHow often the event is published: once per player, group or fact globallyWerte:PLAYERGROUPGLOBAL
audienceRef<out AudienceEntry>—Optional Typewriter audience. Empty means every player observing the fact
previousValueList<FactValueCondition>emptyPrevious value must satisfy all configured conditions
FactValueCondition (2)
FeldTypStandardBeschreibung
operatorFactValueOperatorANYComparison applied to the value before or after the fact updateWerte:ANYEQUALSNOT_EQUALSGREATER_THANGREATER_THAN_OR_EQUALSLESS_THANLESS_THAN_OR_EQUALS
valueInt0Value used by the comparison
newValueList<FactValueCondition>emptyNew value must satisfy all configured conditions
FactValueCondition (2)
FeldTypStandardBeschreibung
operatorFactValueOperatorANYComparison applied to the value before or after the fact updateWerte:ANYEQUALSNOT_EQUALSGREATER_THANGREATER_THAN_OR_EQUALSLESS_THANLESS_THAN_OR_EQUALS
valueInt0Value used by the comparison
contentTemplateString{player} updated {fact}: {previous_value} → {new_value}Message content. Placeholders: {player}, {player_uuid}, {fact}, {fact_name}, {previous_value}, {new_value}, {change}, {scope}, {group}, {players}, {timestamp}PlatzhalterMehrzeilig
threadNameTemplateString—Optional Discord forum thread name
embedFactWebhookEmbed—Optional embed configuration
FactWebhookEmbed (5)
FeldTypStandardBeschreibung
enabledBooleantrueSend an embed in addition to the message content
titleTemplateString{fact}Embed title templatePlatzhalterMehrzeilig
descriptionTemplateString{player} changed the fact from {previous_value} to {new_value}.Embed description templatePlatzhalterMehrzeilig
colorString#5865F2Hex color, for example #5865F2
fieldsList<FactWebhookField>—Fields added to the embed
FactWebhookField (2)
FeldTypStandardBeschreibung
valueString{fact}: {new_value}Field value. Supports the fact event placeholdersPlatzhalterMehrzeilig
inlineBooleantrueDisplay this field inline when possible
pingRoleIdsList<String>emptyAdditional Discord role IDs to mention
triggerCooldownSecondsInt1Loop guard for `triggers`: minimum seconds between two firings for the same player. A chained action that rewrites the watched fact would otherwise re-fire this event forever. 0 disables the guard
Gemeinsame TypeWriter-Felder (triggers)
FeldTypStandardBeschreibung
triggersList<Ref<TriggerableEntry>>empty—

How to use it​

Pick the fact to watch and the destination. A message is posted each time the fact changes for a player.

  • scope: PLAYER posts for every player, GROUP once per TypeWriter group, GLOBAL once for the fact.
  • audience limits the event to players in a TypeWriter audience. Empty means every player.
  • previousValue and newValue are conditions (EQUALS, GREATER_THAN, and so on) that must all be true to post, for example a new value of at least 10.
  • Templates accept {player}, {player_uuid}, {fact}, {fact_name}, {previous_value}, {new_value}, {change}, {scope}, {group}, {players} and {timestamp}.
  • threadNameTemplate is for forum channels only. pingRoleIds adds role mentions.
  • triggers run for the player whose fact change was published, each time a webhook is published. With a GROUP or GLOBAL scope the event is published once, so they run once, for the first player who observed the change. They run only when a message was actually handed to Discord: a template set that renders nothing publishes nothing and triggers nothing. They do not wait for Discord to accept the message, so a rejected webhook still runs them.
  • triggerCooldownSeconds (default 1) is a loop guard for triggers: the minimum number of seconds between two firings for the same player and the same event. Without it, a chained action that rewrites the watched fact would fire this event again forever. 0 disables the guard. The webhook itself is still published at every change; only the firing of triggers is spaced, so a change inside the cooldown posts its message but runs no triggers.