> ## Documentation Index
> Fetch the complete documentation index at: https://docs.razebot.tech/llms.txt
> Use this file to discover all available pages before exploring further.

# Recipes

> Working custom command examples you can copy, run, and adapt.

# Recipes

> Working custom command examples you can copy, run, and adapt.

Every recipe below is a single `;cc set` line. Paste it, then run `;cc preview (name)` before letting the server loose on it.

***

## 1. Greeting with a fallback

<Steps>
  <Step title="Create it">
    ```bash theme={null} theme={null}
    ;cc set greet (member) [message...] -- Hello {member}! {message|Welcome to the server.}
    ```
  </Step>

  <Step title="With a message">
    ```bash theme={null} theme={null}
    ;greet @wanderer how is it going?
    ```

    > Hello @wanderer! how is it going?
  </Step>

  <Step title="Without one">
    ```bash theme={null} theme={null}
    ;greet @wanderer
    ```

    > Hello @wanderer! Welcome to the server.
  </Step>
</Steps>

***

## 2. Coin flip

```bash theme={null} theme={null}
;cc set coinflip -- {choose:heads|tails}
```

```bash theme={null} theme={null}
;coinflip
```

> tails

***

## 3. Reusing a random result

Save the roll under a name so the conditional sees the same value the text shows.

```bash theme={null} theme={null}
;cc set flip -- You flipped **{choice:result:heads|tails}**! That's {if:{result}==heads}lucky{else}unlucky{endif}.
```

```bash theme={null} theme={null}
;flip
```

> You flipped **heads**! That's lucky.

***

## 4. Dice with fixed sizes

`{range}` needs literal numbers, so branch on the argument instead of interpolating it.

```bash theme={null} theme={null}
;cc set roll (sides) -- {if:{sides}==6}You rolled a {range:1-6}.{elseif:{sides}==20}You rolled a {range:1-20}.{else}Only d6 and d20 are supported.{endif}
```

```bash theme={null} theme={null}
;roll 20
```

> You rolled a 14.

***

## 5. Balance check

```bash theme={null} theme={null}
;cc set bal -- {user.mention} — wallet {econ.wallet}, bank {econ.bank}, net worth {econ.networth}.
```

```bash theme={null} theme={null}
;bal
```

> @you — wallet 1,200 coins, bank 300 coins, net worth 1,500 coins.

Add a threshold with the raw number:

```bash theme={null} theme={null}
;cc set rich -- {if:{econ.raw_bal}>=10000}You're loaded.{else}Keep grinding.{endif}
```

***

## 6. Staff warn with the case number

Requires **Manage Messages** to create and to run.

```bash theme={null} theme={null}
;cc set staffwarn (target) [reason...] -- {mod:warn {target} && {reason|No reason given}}Warned {punishment.user.mention} — case #{punishment.case_id}.
```

```bash theme={null} theme={null}
;staffwarn @wanderer being spammy
```

> Warned @wanderer — case #104.

<Tip>
  Lock it to your mod role so the free-form reason can only be abused by people you trust:

  ```bash theme={null} theme={null}
  ;cc allow staffwarn @Moderator
  ```
</Tip>

***

## 7. Notes that read back what you saved

Inline `{db.*}` tags run in order, so the read sees the write from the same response.

<Steps>
  <Step title="Save a note">
    ```bash theme={null} theme={null}
    ;cc set note (text...) -- {db.set:notes:{user.id}:{text}}Saved. Your note is now: {db.get:notes:{user.id}}
    ```

    ```bash theme={null} theme={null}
    ;note buy some milk
    ```

    > Saved. Your note is now: buy some milk
  </Step>

  <Step title="Read it later">
    ```bash theme={null} theme={null}
    ;cc set mynote -- Your note: {db.get:notes:{user.id}}
    ```

    A key that was never set prints nothing, so keep the surrounding wording forgiving. Database tags resolve after conditionals, so they cannot be tested inside an `{if:...}`.
  </Step>

  <Step title="Clear it">
    ```bash theme={null} theme={null}
    ;cc set clearnote -- {db.delete:notes:{user.id}}Note cleared.
    ```
  </Step>
</Steps>

***

## 8. A counter

```bash theme={null} theme={null}
;cc set strike (member) -- {target.mention} now has {db.inc:strikes:{target.id}} strike(s).
```

```bash theme={null} theme={null}
;strike @wanderer
```

> @wanderer now has 3 strike(s).

***

## 9. Role-gated text in one command

```bash theme={null} theme={null}
;cc set secret -- {if:user has role @Staff}Door code is 4821.{else}Nothing to see here.{endif}
```

***

## 10. Embed panel with link buttons

```bash theme={null} theme={null}
;cc set links -- {title: Useful links}{description: Everything in one place.}{color: #7B68EE}{button: Website && link && https://example.com}{button: Support && link && https://example.com/support}
```

***

## 11. Self-serve role buttons

```bash theme={null} theme={null}
;cc set roles -- {title: Pick your roles}{description: Click to toggle.}{button: Gamer && primary && action=role{id: 123456789012345678}}{button: Artist && primary && action=role{id: 234567890123456789}}
```

Replace the IDs with your own role IDs.

***

## 12. Anonymous confession

Deletes the trigger, says nothing in the current channel, and posts the text somewhere else.

```bash theme={null} theme={null}
;cc set confess (text...) -- {delete}{silent}{respond: #confessions}Anonymous: {text}
```

```bash theme={null} theme={null}
;confess I actually like pineapple pizza
```

The invoking message disappears; #confessions gets `Anonymous: I actually like pineapple pizza`.

***

## 13. Rate-limited daily tip

```bash theme={null} theme={null}
;cc set tip -- {cooldown: 24h}Today's tip: {choose:read #rules|say hi in #general|check #events}
```

Running it twice replies with the seconds remaining instead.

***

## 14. Quick poll

```bash theme={null} theme={null}
;cc set poll (question...) -- **{question}**{react: 👍}{react: 👎}
```

raze posts the question and reacts to its own message with both options.

***

## 15. Self-serve role, no buttons needed

```bash theme={null} theme={null}
;cc set pings -- {add_role: 123456789012345678}You'll now get event pings.
```

<Warning>
  Anyone who can run this gets the role. Restrict it if that isn't intended.
</Warning>

***

## 16. Private reply

```bash theme={null} theme={null}
;cc set code -- {delete}{dm}The current door code is 4821.
```

The request vanishes from the channel and the answer arrives in DMs.

***

## 17. A multi-page guide

```bash theme={null} theme={null}
;cc set guide -- {title: 1. Read the rules}{description: Start in #rules.}{page}{title: 2. Get roles}{description: Head to #roles.}{page}{title: 3. Say hi}{description: Introduce yourself in #general.}
```

Navigation buttons appear automatically and stay live for 48 hours.
