K
Docs
API Reference

🧩 Pieces

Every Piece on the Canvas — documented with config fields, output ports, sparks they add, JSON examples, and a TypeScript equivalent so you understand exactly what each one does.

🧩 46 Pieces — Base Set + The Mod Squad
📬

Messages

5 Pieces
🧠

Logic

7 Pieces
🔀
Condition
base.condition

The decision maker! Checks if something is true or false, then sends the flow down one of two paths. It's how your bot becomes smart — 'if this user is an admin, do X, otherwise do Y'.

Base Set
truefalse
🔗
Merge
base.merge

A visual hub for converging flows. Wire both Condition outputs (or any parallel paths) into this piece, then connect one output to your shared downstream chain. The runner already supports multiple incoming edges — Merge makes that pattern obvious on the canvas.

Base Set
🎯
Coalesce
base.coalesce

Sets 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.

Base Set
Wait
base.wait

Pumps the brakes! Pauses the flow for a set number of milliseconds before continuing. Useful for adding a dramatic pause before a big reveal, or spacing out multiple messages so they don't all appear at once.

Base Set
📌
Save Spark
base.variable

Creates or updates a named spark that holds a typed value — text, number, yes/no, list, or object. Update existing sparks in place: numbers use Add/Subtract/Multiply/Divide, text uses append/prepend, lists use Add to list / Prepend to list (single items or rows), booleans support toggle. The spark is then available everywhere downstream.

Base Set
{{score}}
🔁
Loop
base.loop

Repeat after me! Takes a list and runs the connected flow once for each item in it. Great for sending messages to multiple users, processing a list of scores, or doing anything that needs to happen more than once.

Base Set
{{item}}
eachdone
↩️
Return
base.return

Ends the custom piece's flow and hands named values back to whoever called it. The fields shown here come from the returns you defined on this custom piece.

Base Set
🗄️

Vault

3 Pieces
🎲

Utility

16 Pieces
🎲
Random Pick
base.random

Reaches into a bag and pulls out one random item. Great for random jokes, quotes, prizes, challenge assignments, or anything where variety is the spice of life.

Base Set
{{pick}}
📋
Log
base.log

Writes a message to your bot's Activity log. Use info for breadcrumbs, warn for odd-but-okay moments, and error when something went wrong but you handled it in the flow. Great for debugging without spamming Discord.

Base Set
✒️
Format Text
base.format

Constructs a piece of text by filling in a template with live values. Combine static text with Sparks to build dynamic messages, labels, or anything that needs to be assembled from parts.

Base Set
{{formatted}}
🕐
Format Time
base.format_time

Formats a date/time spark into human-readable text, ISO, a custom pattern, or Discord's native `<t:unix:style>` timestamps (t, T, d, D, f, F, R). Leave the input empty to use the current time when the flow runs.

Base Set
🔢
Math
base.math

Runs an arithmetic expression and stores the answer as a Spark. Add scores, calculate percentages, multiply rewards — if numbers are involved, this piece does the work.

Base Set
{{total}}
🔃
Sort List
base.sort

Takes a list and sorts it ascending or descending. If the list came from a Vault read, it auto-detects the table schema and lets you pick which column to sort by — no guessing field names. The sorted result becomes a ✨ Spark you can loop over or show directly.

Base Set
{{sorted}}{{sorted.length}}{{sorted.0}}
✂️
Split Text
base.text.split

Splits text into a list using a delimiter — comma, space, newline, or any string. Great for parsing command arguments, CSV-style data, or multi-line input.

Base Set
{{parts}}{{parts.length}}{{parts.0}}
🔗
Join List
base.text.join

Joins list items into a single string with a separator between each item. Perfect for building comma-separated lists, bullet lines, or one big message from many sparks.

Base Set
{{joined}}
🔄
Replace Text
base.text.replace

Replaces every occurrence of a find string with another value. Handy for sanitizing input, swapping placeholders, or cleaning up user text.

Base Set
{{replaced}}
🔤
Transform Text
base.text.transform

Transforms text casing or whitespace. Use trim before comparing strings, uppercase for shouty replies, or title case for display names.

Base Set
{{transformed}}
📏
Text Length
base.text.length

Returns how many characters are in a piece of text. Useful for validating message length, word-count style games, or limits before sending.

Base Set
{{length}}
🔢
List Length
base.list.length

Returns how many items are in a list spark. Pair with Condition to branch on empty lists or check leaderboard size.

Base Set
{{count}}
🎯
Get List Item
base.list.get

Returns the item at a zero-based index — 0 is first, 1 is second, and so on. Great for showing the top scorer or a random pick you already stored.

Base Set
{{row}}
🍰
Slice List
base.list.slice

Returns a slice of a list from a start index up to (but not including) an end index. Use it for top-10 boards, paging, or trimming edges.

Base Set
{{slice}}{{slice.length}}{{slice.0}}
🧹
Unique List
base.list.unique

Deduplicates a list while keeping the first occurrence of each value. Handy after merges, user submissions, or tag lists.

Base Set
{{unique}}{{unique.length}}{{unique.0}}
🔍
List Contains
base.list.contains

Checks whether a list contains an item (string match). Routes to Found when present, Empty when not — like a mini condition for lists.

Base Set
foundempty
📡

Channels

1 Pieces
👤

User

4 Pieces
🛡️

Moderation

10 Pieces
👢
Kick Member
mod.kick

Removes a member from the server — they can still rejoin with an invite. A lighter touch than a ban; great for first offences or automated flows. Always pair with a Condition to confirm the boot is warranted.

The Mod Squad
outputerror
🔨
Ban Member
mod.ban

Permanently bans a user. Unlike Kick, they cannot rejoin. Optionally deletes their recent messages (1–7 days). Use with care — you can always Unban later if needed.

The Mod Squad
outputerror
🔓
Unban User
mod.unban

Removes a ban by user ID. They won't automatically rejoin — they'll need a fresh invite. Perfect for /unban commands where a mod reinstates a previously banned member.

The Mod Squad
outputerror
⏱️
Timeout Member
mod.timeout

Puts a member in Discord's native timeout. While timed out they can't send messages, add reactions, or join voice. Perfect for automated cool-downs. Requires Moderate Members permission. Max duration is 28 days.

The Mod Squad
outputerror
🔔
Remove Timeout
mod.untimeout

Clears an active timeout and restores a member's ability to chat. Handy for manual override commands — a mod can un-mute someone before their timeout would naturally expire.

The Mod Squad
outputerror
🗑️
Delete Message
mod.delete_message

Deletes one specific message from a channel. Use in message-event flows where bad content needs to go immediately. The message ID and channel ID are available as Sparks in message triggers.

The Mod Squad
outputerror
🧹
Purge Messages
mod.purge

Deletes up to 100 messages from a channel in one sweep. Discord only allows bulk-deleting messages under 14 days old. Perfect for cleaning up spam raids, accidental leaks, or bot noise.

The Mod Squad
outputerror
🐢
Set Slowmode
mod.slowmode

Sets a channel's slowmode cooldown — from 0 (off) to 21600 seconds (6 hours). Users can only send one message per cooldown. Great for calming heated chats, preventing raid spam, or managing high-traffic events.

The Mod Squad
outputerror
🔒
Lock Channel
mod.lock_channel

Removes @everyone's Send Messages permission in a channel — effectively locking it. The channel remains visible and readable; nobody can post until you Unlock it. Great for announcements-only mode or emergency lockdowns.

The Mod Squad
outputerror
🟢
Unlock Channel
mod.unlock_channel

Re-enables @everyone's Send Messages permission, reversing a Lock Channel. When the dust settles, unlock and get the conversation flowing again.

The Mod Squad
outputerror