🎯
Coalesce
base.coalesceBase SetLogicSets a spark from a primary template, or falls back when the primary is empty. Perfect for /profile user_p: use the mentioned user's ID when provided, otherwise the invoker's ID — without duplicating Save Sparks on each branch.
When to use this
- →Pair with Merge when both branches should run identical downstream pieces
- →Use input.options.user_p.id for USER spell inputs — not the bare object unless you need it
- →Empty means missing, blank text, or a USER pick with no id
On the canvas
This is what Coalesce looks like when you place it on your flow. Each field below is something you configure in the inspector panel.
🎯Logic
Coalesce
base.coalescenamerequired
profile_user_id
primaryrequired
{{input.options.user_p.id}}
fallbackrequired
{{input.user.id}}
Config fields
| Field | Type | Req | What it does |
|---|---|---|---|
nameprofile_user_id | text | yes | Spark name 🏷️ |
primary{{input.options.user_p.id}} | text | yes | Try this first ✨ |
fallback{{input.user.id}} | text | yes | Otherwise use 🛟 |
Output ports
outputSpark is set — continue the flow
📐
In TypeScript, this would be…
Not something you need to write — just a look at what Kitcord does for you.
TypeScript
const profileUserId =
input.options.user?.id ?? interaction.user.id;
// {{profile_user_id}} — primary spark or fallbackRelated pieces
More Logic pieces