homebrew

package
v0.0.0-...-95891f2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 25, 2026 License: AGPL-3.0 Imports: 27 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package homebrew keeps a campaign's Homebrew Workshop recipes: parts (the everyday widgets and the kinds other plugins register) wired together by When/Then rules, saved as one document per recipe.

This package owns the recipe format and the registries. It knows no kind of part itself: every kind, event and action is registered by the plugin that owns it, through adapters in internal/app, so no plugin imports another.

The browser HTTP surface for the Homebrew Workshop. Handlers bind, call the service and shape the response; the service owns every rule.

Route registration for the Homebrew Workshop.

Index

Constants

View Source
const (
	SeeParty    = "party"    // everyone in the campaign
	SeeName     = "name"     // players see that it exists, not its details
	SeeDirector = "director" // Directors only
)

Who sees a part. Set once per part in the Workshop.

View Source
const (
	TimingNow          = "now"
	TimingEncounterEnd = "encounter_end"
	TimingHeld         = "held" // waits in the Homebrew drawer for the Director
)

When a rule's actions run.

View Source
const (
	FieldWhole = "whole" // a whole number
	FieldText  = "text"  // one line of text
)

Field types the inspector can draw.

View Source
const (
	PreviewShape = "shape" // a part kind whose data is a trackers shape
	PreviewReach = "reach" // the part's number moves onto or past Arg
	PreviewAdd   = "add"   // add Arg (or 1) to the part's number
	PreviewSet   = "set"   // set the part's number to Arg
)

Preview ops. An event can only reach; an action can only add or set.

View Source
const (
	RunDone      = "done"
	RunHeld      = "held" // waits in the Homebrew drawer for the Director
	RunFailed    = "failed"
	RunDismissed = "dismissed"
	RunStopped   = "stopped" // rules kept setting each other off
	RunRunning   = "running" // claimed by a Director pressing Run
)

What happened to a run.

View Source
const (
	MaxNameChars = 80
	MaxTestChars = 200
	MaxParts     = 60
	MaxRules     = 60
	MaxThen      = 12
	MaxRecipes   = 200
	MaxDataBytes = 16 << 10
	MaxArgsBytes = 4 << 10
	MaxBodyBytes = 512 << 10
	MaxIDChars   = 64

	MaxCanvas = 20000 // how far from the origin a card may sit
)

Limits. They keep one recipe a size the Workshop canvas can show and a request can carry.

View Source
const PluginSlug = "homebrew"

PluginSlug names this plugin in the registry and the health/migration bookkeeping.

Variables

View Source
var MigrationsFS embed.FS

MigrationsFS contains the embedded SQL migration files.

View Source
var StaticAssetsFS embed.FS

StaticAssetsFS holds the Workshop widget and its styles, served at /static/plugins/homebrew/.

Functions

func RegisterRoutes

func RegisterRoutes(e *echo.Echo, h *Handler, campaignSvc campaigns.CampaignService, authSvc auth.AuthService)

RegisterRoutes mounts the routes under the campaign group. Everything here is the Director's, which the service checks (a role middleware cannot express the co-Director grant). CSRF is enforced by the global middleware.

Types

type AI

type AI struct {
	// contains filtered or unexported fields
}

AI is the Workshop's part of the AI engine (aiplug, ADR-071): the `workshop` lookup, which shows the recipes, what a recipe can be built from and the Homebrew drawer, and the `workshop-recipe` block an AI asks to add, change or remove a recipe with. Both go through the Service, so they are the Director's only, as the Workshop is, and a request changes nothing until the owner approves it on the review page.

func NewAI

func NewAI(svc Service) *AI

NewAI builds the Workshop's AI part over its service.

func (*AI) Answer

func (k *AI) Answer(ctx context.Context, campaignID string, a aiplug.Actor, _ aiplug.Record) (string, string, error)

Answer reads the recipes, the catalog and the drawer as the Director.

func (*AI) Apply

func (k *AI) Apply(ctx context.Context, campaignID string, a aiplug.Actor, r aiplug.Record) error

func (*AI) Brief

func (*AI) Brief() string

func (*AI) Doc

func (*AI) Doc() string

func (*AI) Export

func (k *AI) Export(ctx context.Context, campaignID string, a aiplug.Actor) (string, error)

Export lists the recipes in the block's own format.

func (*AI) Label

func (*AI) Label() string

func (*AI) LookupInfo

func (*AI) LookupInfo() aiplug.LookupInfo

func (*AI) Name

func (*AI) Name() string

func (*AI) Plan

func (k *AI) Plan(ctx context.Context, campaignID string, a aiplug.Actor, r aiplug.Record) aiplug.Plan

type Act

type Act struct {
	RecipeID string
	// Part is the part the action is on; nil when it takes none.
	Part *Part
	Args json.RawMessage
	// Scope is the page the event happened on; "" when it came from no page
	// (a respite), which an owner may read as "everywhere it applies".
	Scope string
	// By is the Director whose change or press set the rule off.
	By Viewer
	// Note names the rule, for the line the owner writes in its own log.
	Note string
}

Act is one action a rule is carrying out.

type ActionDef

type ActionDef struct {
	Name  string // e.g. "step"
	Label string
	// PartKinds are the kinds of part it acts on; empty means it takes no part.
	PartKinds []string
	// ClientRun actions run in the Director's browser, through a handler a
	// system package registered there, only when the Director presses Run.
	// The server records and validates them but never runs them.
	ClientRun bool
	Fields    []Field
	// Preview lets the live preview act the action out; nil makes it a
	// line saying what would happen.
	Preview *Preview
	Check   CheckFunc
	// Run carries the action out on the server and says in one line what
	// changed. Without it, and always for a ClientRun action, a rule that
	// uses the action waits in the Homebrew drawer for the Director.
	Run func(ctx context.Context, campaignID string, a Act) (string, error)
	// Waits marks an action that is the Director's call even though the
	// server can run it: a rule that uses it is held in the drawer however
	// it is timed, and Run does it when the Director presses Run. It is for
	// anything bigger than a number moving, which runs at once.
	Waits bool
}

ActionDef is something a rule can do.

type Catalog

type Catalog struct {
	Parts   []CatalogEntry `json:"parts"`
	Events  []CatalogEntry `json:"events"`
	Actions []CatalogEntry `json:"actions"`
}

Catalog is what the Workshop's palette and When/Then lists offer.

type CatalogEntry

type CatalogEntry struct {
	Name      string   `json:"name"`
	Label     string   `json:"label"`
	ForceSee  string   `json:"forceSee,omitempty"`
	Widget    string   `json:"widget,omitempty"`
	PartKinds []string `json:"partKinds,omitempty"`
	ClientRun bool     `json:"clientRun,omitempty"`
	// Waits is an action's Waits, so the editor can say a rule that ends in it
	// is held for the Director however it is timed.
	Waits  bool    `json:"waits,omitempty"`
	Fields []Field `json:"fields,omitempty"`
	// PressArg is an event's PressArg, so the Workshop can name the drawer
	// button a When stands for.
	PressArg string `json:"pressArg,omitempty"`
	// Preview is a part kind's PreviewShape, or an event's or action's op.
	Preview any `json:"preview,omitempty"`
}

CatalogEntry is one registered name, as the Workshop shows it.

type CheckFunc

type CheckFunc func(ctx context.Context, campaignID string, raw json.RawMessage) (json.RawMessage, error)

CheckFunc validates one owner's JSON and returns it normalised. Its error is shown to the Director, so it says what to fix in plain words.

type Do

type Do struct {
	Action string          `json:"action"`
	Part   string          `json:"part,omitempty"`
	Args   json.RawMessage `json:"args,omitempty"`
}

Do is one action of a rule, on one part of the same recipe.

type Doc

type Doc struct {
	Parts []Part `json:"parts"`
	Rules []Rule `json:"rules"`
	// Layout is where each card sits on the Workshop canvas, keyed by card:
	// "p:<part key>", "r<rule>" for a rule's When, "r<rule>.<step>" for one
	// of its Thens (both counted from 0). Only the Workshop reads it.
	Layout map[string]Pos `json:"layout,omitempty"`
}

Doc is a recipe's parts and the rules wiring them.

type Drawer

type Drawer struct {
	Presses []Press   `json:"presses"`
	Waiting []RunView `json:"waiting"`
	Recent  []RunView `json:"recent"`
}

Drawer is the Homebrew drawer's rule sections.

type EventDef

type EventDef struct {
	Name  string // e.g. "tracker.reached"
	Label string
	// PartKinds are the kinds of part that fire it; empty means it comes from
	// outside any part (a moon changing, a respite).
	PartKinds []string
	Fields    []Field // the args the Workshop asks for; nil when there are none
	// Preview lets the live preview act the event out; nil makes it a
	// button the Director presses to say it happened.
	Preview *Preview
	Check   CheckFunc
	// Press, when set, is the label of a drawer button the Director uses to
	// say the event happened ("Log a respite"). Only an event from no part
	// can have one.
	Press string
	// Pressed, when set, is the owner's own record of a press, run before
	// any rule (Crafting gives every project a roll for a respite). An
	// error stops the press before anything else happens.
	Pressed func(ctx context.Context, campaignID string, by Viewer) error
	// PressArg, when set, names one of the event's text Fields: each distinct
	// value of it among the saved rules is a drawer button of its own,
	// labelled with that value ("Dose"), so the Director names a button by
	// writing a rule. A press fires the event with {"<PressArg>": value}.
	// It needs a Match, or every button would start every rule; only an
	// event from no part can have it, and not with Press or Pressed.
	PressArg string
	// Match, when set, says whether a firing meets a rule's stored args,
	// given what happened (the payload the owner fired it with). Nil
	// matches every firing.
	Match func(args, payload json.RawMessage) (bool, error)
}

EventDef is something that can start a rule.

type Field

type Field struct {
	Name  string `json:"name"`  // the arg's JSON key
	Label string `json:"label"` // what the inspector calls it
	Type  string `json:"type"`  // FieldWhole or FieldText
	// Optional fields start empty on a new When or Then, where a whole
	// number otherwise starts at 1.
	Optional bool `json:"optional,omitempty"`
}

Field is one arg of an event or action, as the Workshop's inspector asks for it. The owner's Check still has the last word on its value.

type Fired

type Fired struct {
	Event string
	// RecipeID limits the firing to one recipe's rules, for an event a
	// recipe's own part fires; "" reaches every recipe (a respite).
	RecipeID string
	// Part is the part key it came from; "" for an event from no part.
	Part string
	// Scope is the page it happened on; "" for none.
	Scope string
	// Payload is what happened, for the event's Match.
	Payload json.RawMessage
	// Once is for an event a player can set off as often as they like: a rule
	// it would hold is not held again while the same rule already waits for
	// the same scope and payload. The Director answers it once.
	Once bool
}

Fired is an event an owner says happened.

type Handler

type Handler struct {
	// contains filtered or unexported fields
}

Handler serves the Workshop routes.

func NewHandler

func NewHandler(svc Service) *Handler

NewHandler builds the handler.

func (*Handler) Catalog

func (h *Handler) Catalog(c *echo.Context) error

Catalog handles GET /campaigns/:id/homebrew/catalog.

func (*Handler) Create

func (h *Handler) Create(c *echo.Context) error

Create handles POST /campaigns/:id/homebrew/recipes.

func (*Handler) Delete

func (h *Handler) Delete(c *echo.Context) error

Delete handles DELETE /campaigns/:id/homebrew/recipes/:rid.

func (*Handler) Dismiss

func (h *Handler) Dismiss(c *echo.Context) error

Dismiss handles POST /campaigns/:id/homebrew/runs/:run/dismiss.

func (*Handler) Drawer

func (h *Handler) Drawer(c *echo.Context) error

Drawer handles GET /campaigns/:id/homebrew/drawer.

func (*Handler) Get

func (h *Handler) Get(c *echo.Context) error

Get handles GET /campaigns/:id/homebrew/recipes/:rid.

func (*Handler) List

func (h *Handler) List(c *echo.Context) error

List handles GET /campaigns/:id/homebrew/recipes.

func (*Handler) Page

func (h *Handler) Page(c *echo.Context) error

Page handles GET /campaigns/:id/homebrew: the Workshop itself. The catalog call is the service's Director check, so the page and its API keep everyone else out by the same rule.

func (*Handler) Placements

func (h *Handler) Placements(c *echo.Context) error

Placements handles GET /campaigns/:id/homebrew/recipes/:rid/placements.

func (*Handler) Press

func (h *Handler) Press(c *echo.Context) error

Press handles POST /campaigns/:id/homebrew/press/:event[?button=name].

func (*Handler) RunHeld

func (h *Handler) RunHeld(c *echo.Context) error

RunHeld handles POST /campaigns/:id/homebrew/runs/:run/run.

func (*Handler) Update

func (h *Handler) Update(c *echo.Context) error

Update handles PUT /campaigns/:id/homebrew/recipes/:rid.

type Part

type Part struct {
	Key   string          `json:"key"`
	Kind  string          `json:"kind"`
	Label string          `json:"label"`
	See   string          `json:"see"`
	Data  json.RawMessage `json:"data,omitempty"`
}

Part is one widget or owned record in a recipe. Data belongs to the kind's owner, which validates it; this package only checks the envelope.

type PartKind

type PartKind struct {
	Name  string // e.g. "tracker"; what a part's kind field holds
	Label string // what the Workshop's palette calls it
	// ForceSee, when set, is the only audience the kind allows (a creature
	// recipe is always the Director's).
	ForceSee string
	// Preview, when PreviewShape, says data is a trackers shape, so the
	// Workshop's live preview can show the part as a number it can change.
	Preview string
	// Widget, when set, names a widget the owner registered in the browser
	// that draws and edits the part's data, so the Workshop shows the
	// owner's own editor without knowing what it holds. See the
	// plugin's .ai.md, "Owner-drawn parts".
	Widget string
	Check  CheckFunc
	// Sync, when set, keeps records the owner holds for this kind's parts
	// in step with the recipes that hold them.
	Sync *PartSync
}

PartKind is a kind of part, registered by the plugin that owns its data.

type PartSync

type PartSync struct {
	// Check says, without writing, whether Apply would refuse these parts.
	// Its error is shown to the Director.
	Check func(ctx context.Context, campaignID, recipeID string, parts []Part) error
	// Apply makes the owner's records match. It runs after the recipe is
	// stored.
	Apply func(ctx context.Context, campaignID, recipeID string, parts []Part) error
}

PartSync keeps an owner's own records in step with a kind's parts: a tracker part is saved as a tracker kind. Each call gets every part of the kind in one recipe, none when the recipe is deleted, so a call is a whole picture and a repeat changes nothing.

type Placement

type Placement struct {
	Where string `json:"where"`
	Name  string `json:"name"`
}

Placement is one place a recipe shows up. Where is "category" for a category whose every page shows it, placed with the Customizer.

type PlacementFinder

type PlacementFinder interface {
	Placements(ctx context.Context, campaignID, recipeID string) ([]Placement, error)
}

PlacementFinder reads where page layouts place a recipe. It is implemented in internal/app over the entities plugin, which owns the layouts.

type Pos

type Pos struct {
	X int `json:"x"`
	Y int `json:"y"`
}

Pos is a card's top-left corner on the canvas, in canvas pixels.

type Press

type Press struct {
	Event string `json:"event"`
	Label string `json:"label"`
	// Button is a named button's name, sent back with the press; Arg is the
	// event's field that holds it. Both are empty for a registered press.
	Button string `json:"button,omitempty"`
	Arg    string `json:"arg,omitempty"`
	// Rules counts the saved rules it would start.
	Rules int `json:"rules"`
}

Press is an event the Director sets off from the drawer.

type Preview

type Preview struct {
	Op string `json:"op"`
	// Arg is the whole-number field holding the amount; empty means 1 for
	// PreviewAdd. PreviewReach and PreviewSet need one.
	Arg string `json:"arg,omitempty"`
	// Every, for PreviewReach only, is an optional whole-number field that
	// repeats the value: reach 3, again every 3, fires at 3, 6, 9 and on.
	Every string `json:"every,omitempty"`
}

Preview says how the Workshop's live preview acts out an event or action on a part's number, so a recipe can be tried without the server and without the preview knowing any owner by name.

type Recipe

type Recipe struct {
	ID         string    `json:"id"`
	CampaignID string    `json:"-"`
	Name       string    `json:"name"`
	Doc        Doc       `json:"doc"`
	Version    int       `json:"version"`
	CreatedBy  string    `json:"-"`
	CreatedAt  time.Time `json:"createdAt"`
	UpdatedAt  time.Time `json:"updatedAt"`
}

Recipe is one saved recipe. Doc is the part the Workshop edits.

type RecipeInput

type RecipeInput struct {
	Name    string `json:"name"`
	Doc     Doc    `json:"doc"`
	Version int    `json:"version"`
}

RecipeInput is a create or update body. Version is required on update and a mismatch is a conflict.

type RecipePart

type RecipePart struct {
	RecipeID string
	Part     Part
}

RecipePart is one part of a saved recipe, with the recipe it belongs to.

type RecipeSummary

type RecipeSummary struct {
	ID    string `json:"id"`
	Name  string `json:"name"`
	Parts int    `json:"parts"`
	Rules int    `json:"rules"`
	// PartKinds are the kinds of part the recipe has, sorted, so a caller
	// can tell what a recipe can put on a page without loading it.
	PartKinds []string  `json:"partKinds"`
	Version   int       `json:"version"`
	UpdatedAt time.Time `json:"updatedAt"`
}

RecipeSummary is a recipe in a list: enough to show and open it.

type Registry

type Registry struct {
	// contains filtered or unexported fields
}

Registry holds what other plugins have plugged into the Workshop. It is filled once while the app starts and read for every request after.

func NewRegistry

func NewRegistry() *Registry

NewRegistry returns an empty registry.

func (*Registry) Catalog

func (r *Registry) Catalog() Catalog

Catalog lists everything registered, sorted by name so the palette is stable between restarts.

func (*Registry) RegisterAction

func (r *Registry) RegisterAction(a ActionDef) error

RegisterAction adds an action.

func (*Registry) RegisterEvent

func (r *Registry) RegisterEvent(e EventDef) error

RegisterEvent adds an event.

func (*Registry) RegisterPart

func (r *Registry) RegisterPart(k PartKind) error

RegisterPart adds a kind of part. A second registration of a name is an error: two owners for one kind would make validation ambiguous.

type Repository

type Repository interface {
	List(ctx context.Context, campaignID string) ([]Recipe, error)
	// ListContaining lists the recipes whose stored document holds text, so
	// a caller looking for a rare setting skips decoding every recipe.
	ListContaining(ctx context.Context, campaignID, text string) ([]Recipe, error)
	Get(ctx context.Context, campaignID, id string) (Recipe, bool, error)
	Count(ctx context.Context, campaignID string) (int, error)
	Create(ctx context.Context, r Recipe) error
	// Update writes r only if the stored version is still expected, and
	// reports whether it did.
	Update(ctx context.Context, r Recipe, expected int) (bool, error)
	Delete(ctx context.Context, campaignID, id string) (bool, error)
}

Repository is the persistence boundary for recipes.

func NewRepository

func NewRepository(db *sql.DB) Repository

NewRepository returns the MariaDB repository.

type Rule

type Rule struct {
	When   When   `json:"when"`
	Timing string `json:"timing"`
	Then   []Do   `json:"then"`
}

Rule is one When/Then: an event, an optional test, and the actions it runs.

type Run

type Run struct {
	ID         string
	CampaignID string
	RecipeID   string
	RecipeName string
	What       string
	// Rule is the rule as it was when its event fired.
	Rule      Rule
	Scope     string
	Payload   json.RawMessage
	Status    string
	Lines     []string
	CreatedBy string
	CreatedAt time.Time
	DoneBy    string
	DoneAt    *time.Time
}

Run is one rule set off by one firing, with what it did.

type RunStep

type RunStep struct {
	Action  string          `json:"action"`
	Label   string          `json:"label"`
	Part    string          `json:"part,omitempty"`
	Args    json.RawMessage `json:"args,omitempty"`
	Browser bool            `json:"browser,omitempty"`
	// ByHand is an action no one can run for the Director.
	ByHand bool `json:"byHand,omitempty"`
}

RunStep is one action of a held run.

type RunStore

type RunStore interface {
	CreateRun(ctx context.Context, r Run) error
	GetRun(ctx context.Context, campaignID, id string) (Run, bool, error)
	// FinishRun writes a run's new status, lines and who finished it, only
	// while its stored status is still from, and reports whether it did.
	FinishRun(ctx context.Context, r Run, from string) (bool, error)
	// ListRuns lists held runs, or finished ones, newest first.
	ListRuns(ctx context.Context, campaignID string, held bool, limit int) ([]Run, error)
	// PruneRuns deletes all but the newest keep finished runs.
	PruneRuns(ctx context.Context, campaignID string, keep int) error
}

RunStore keeps runs.

func NewRunStore

func NewRunStore(db *sql.DB) RunStore

NewRunStore returns the MariaDB store of rule runs.

type RunView

type RunView struct {
	ID     string    `json:"id"`
	Recipe string    `json:"recipe"`
	What   string    `json:"what"`
	Status string    `json:"status"`
	Lines  []string  `json:"lines"`
	At     time.Time `json:"at"`
	// Waits says why a held run is waiting.
	Waits string `json:"waits,omitempty"`
	// Steps are a held run's actions, so the drawer can say what Run will
	// do and run the browser ones itself.
	Steps []RunStep `json:"steps,omitempty"`
	// RecipeID and Scope tell a held run's browser steps which recipe they
	// belong to and the page the event happened on, so an owner's browser
	// action can read its part and act on that page.
	RecipeID string `json:"recipeId,omitempty"`
	Scope    string `json:"scope,omitempty"`
}

RunView is a run as the drawer shows it.

type Service

type Service interface {
	Catalog(v Viewer) (Catalog, error)
	List(ctx context.Context, campaignID string, v Viewer) ([]RecipeSummary, error)
	Get(ctx context.Context, campaignID, id string, v Viewer) (*Recipe, error)
	Create(ctx context.Context, campaignID string, v Viewer, in RecipeInput) (*Recipe, error)
	Update(ctx context.Context, campaignID, id string, v Viewer, in RecipeInput) (*Recipe, error)
	Delete(ctx context.Context, campaignID, id string, v Viewer) error
	// Check says, without writing, whether Create (id "") or Update (the
	// recipe's id) would take in: the same checks, and every owner's word
	// on its parts. The AI review shows its answer before the owner approves.
	Check(ctx context.Context, campaignID, id string, v Viewer, in RecipeInput) error
	// Placements lists where the Customizer has placed a recipe.
	Placements(ctx context.Context, campaignID, id string, v Viewer) ([]Placement, error)
	// PartsOfKind lists saved recipes' parts of the given kinds whose data
	// holds dataHas (any data when ""), so an owner can find the parts that
	// point at one of its records without reading every recipe.
	PartsOfKind(ctx context.Context, campaignID string, v Viewer, dataHas string, kinds ...string) ([]RecipePart, error)
	// ShareBudget gives ctx one budget of rule runs, so several firings an
	// owner makes for one change stop together after the same 50 runs.
	ShareBudget(ctx context.Context) context.Context

	// Fire starts the saved rules an event meets (run.go). Owners call it
	// once they know the change was a Director's.
	Fire(ctx context.Context, campaignID string, v Viewer, f Fired) error
	// Drawer is what the Homebrew drawer shows about rules.
	Drawer(ctx context.Context, campaignID string, v Viewer) (*Drawer, error)
	// Press fires an event the drawer offers as a button; button is a named
	// button's name, "" for a registered press.
	Press(ctx context.Context, campaignID, event, button string, v Viewer) (*Drawer, error)
	// RunHeld runs a waiting rule now; Dismiss sets it aside.
	RunHeld(ctx context.Context, campaignID, id string, v Viewer) (*RunView, error)
	Dismiss(ctx context.Context, campaignID, id string, v Viewer) (*RunView, error)
}

Service is the Workshop's recipe store. Every method is for Directors: players meet a recipe only through the widgets it places, which keep their own audience rules.

func NewService

func NewService(repo Repository, reg *Registry, places PlacementFinder, runs RunStore) Service

NewService builds the service over a repository and the registry the app filled at start. places may be nil when nothing can place a recipe; a recipe is then on no page. runs may be nil, and rules then never run.

type Viewer

type Viewer struct {
	UserID   string
	Director bool
	// VisibilityRole is passed on to owners whose actions check page
	// access as this person.
	VisibilityRole int
}

Viewer is who is asking, as the handler read it from the campaign context.

type When

type When struct {
	Event string          `json:"event"`
	Part  string          `json:"part,omitempty"`
	Args  json.RawMessage `json:"args,omitempty"`
	Test  string          `json:"test,omitempty"`
}

When names the event that starts a rule. Part, when set, is the part the event must come from.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL