# Blocks

> Every action and condition a Jellyn Lab system can use.

**Actions** do something. **Conditions** have a **True** and a **False** output, and send the run down one of them. Member blocks act on whoever the run is for, or on a member option of the command.

## Actions

<Tabs>
  <Tab title="Messages">
    | Block | Does |
    | --- | --- |
    | **Send a message** | Posts a message in a channel: a card, embeds or a layout, built in the Message Builder |
    | **Reply** | Answers the person privately |
    | **Send a DM** | Messages a member directly |
    | **Open a form** | Asks up to five questions first; it must come straight after a command, a button or `/lab run` |
    | **Send buttons or a menu** | Each choice runs its own blocks when someone picks it |
    | **Send an image card** | A picture with their name and avatar, designed in Card Studio |
  </Tab>
  <Tab title="Message actions">
    | Block | Does |
    | --- | --- |
    | **React to a message** | Adds an emoji to a message, or takes Jellyn's off |
    | **Pin or unpin a message** | Pins a message to its channel, or unpins it |
    | **Delete a message** | Deletes a message a block sent, or one by its ID |
    | **Make a forum post** | Starts a post in a forum, with its tags |
    | **Change a post's tags** | Adds, takes off or sets a forum post's tags |
  </Tab>
  <Tab title="Members">
    | Block | Does |
    | --- | --- |
    | **Give a role** / **Take a role away** | Adds or removes a role, for a while if you like |
    | **Change a nickname** | Sets a member's nickname |
    | **Time out a member** | Mutes a member for a while. Needs Timeout Members |
    | **Kick a member** | Removes them; they can join again with an invite |
    | **Ban a member** | Removes them and stops them joining again, optionally deleting their recent messages |
    | **Mute**, **Deafen** or **Move in voice** | Server mute or deafen a member in voice (or lift it), or move or disconnect them |
  </Tab>
  <Tab title="Channels">
    | Block | Does |
    | --- | --- |
    | **Purge messages** | Deletes a batch of recent messages in a channel, `{purged.count}` |
    | **Create an invite** | Makes an invite link, `{invite.url}` |
    | **Create a channel** | A new text or voice channel, `{created.channel}` |
    | **Delete a channel** | Deletes a channel. It can't be undone |
    | **Create a thread** | Starts a thread in a channel, `{thread}` |
    | **Join** / **Leave a voice channel** | Jellyn sits in a voice channel, muted, or leaves it |
  </Tab>
  <Tab title="Jellyn and ER:LC">
    | Block | Does |
    | --- | --- |
    | **Log a punishment** | Adds an ER:LC punishment to your log, as the staff member who used it, with your server's rules |
    | **Run an in-game command** | Sends any `:` command in your server, like `:h`, `:pm`, `:kick` or `:weather` |
    | **Add a staff resource** | Saves a document for your staff |
  </Tab>
  <Tab title="Data and timing">
    | Block | Does |
    | --- | --- |
    | **Set a variable** | Changes a value Lab remembers |
    | **Wait** | Pauses before the next block |
    | **For each** | Repeats blocks for every player in game, player on a team, staff member on shift, or value of a collection |
    | **Send an error log** | Stops here as failed, with your own words in the run history |
  </Tab>
</Tabs>

<Warning>
  **Run an in-game command** never sends a rank change (`:admin`, `:mod`, `:helper` and their `:un` forms) or a command on everyone at once, like `:ban all`. That is checked when you save, and again once values are filled in, so a player typing `all` as a name can't make a `:kick all`.
</Warning>

## Conditions

| Block | Goes down True when |
| --- | --- |
| **If / Else** | A value compares as you set: equal to, less or greater than, contains, starts or ends with, a collection contains, and their opposites |
| **Chance** | By chance, 1 to 99% of the time, like a coin flip |
| **Has a role** | The member has a role |
| **In a channel** | It was used in one of 1 to 10 channels |
| **Staff level** | They are at least staff, management or admin in Jellyn |

## Every block

- **Error paths**: turn on an action's **Success and error paths** for an **Error** output. When the block fails, the run goes on there, with `{error}` and `{error.block}`.
- **Ignore errors**: the run goes on as if the block worked (handy for a DM to someone who doesn't take DMs).
- **Notes**: a line of helper text next to a block on the canvas.
