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

# Arguments and variables

> Inject user input, command metadata, moderation and economy data, and reshape text.

# Arguments and variables

> Inject user input, command metadata, moderation and economy data, and reshape text.

## Argument placeholders

Reference what the invoker typed:

| Placeholder                     | Resolves to                                            |
| :------------------------------ | :----------------------------------------------------- |
| `{arg}` / `{args}`              | The whole input string after the command name.         |
| `{arg.raw}` / `{args.raw}`      | The same string, untrimmed.                            |
| `{arg.count}` / `{args.count}`  | How many whitespace-separated words were supplied.     |
| `{name}` / `{arg.name}`         | The value of a declared `(name)` or `[name]` argument. |
| `{1}`, `{2}`, …                 | The Nth word of the input (1-indexed).                 |
| `{arg.1}`, `{arg1}`, `{args.1}` | Aliases for the Nth word.                              |
| `{arg.N+}` / `{args.rest.N}`    | Word N and everything after it.                        |

```bash theme={null} theme={null}
;cc set echo -- word 1 is "{1}", the rest is "{arg.2+}" ({arg.count} words total)
```

```bash theme={null} theme={null}
;echo alpha beta gamma
```

> word 1 is "alpha", the rest is "beta gamma" (3 words total)

### Fallback syntax

```text theme={null} theme={null}
{key|fallback}
```

If `key` resolves to empty or missing, the fallback text renders instead.

```bash theme={null} theme={null}
;cc set greet [name] -- Hello {name|stranger}!
```

<Info>
  Fallbacks only work for values in the command's **local context**: declared arguments, `arg.*` / `args.*`, `command.*`, `moderator.*`, `economy.*` / `econ.*`, and `target.economy.*` / `target.econ.*`. Global placeholders like `{user.name}` and `{guild.name}` ignore the `|fallback` part.
</Info>

***

## Command metadata

| Placeholder              | Resolves to                             |
| :----------------------- | :-------------------------------------- |
| `{command.name}`         | The custom command's name.              |
| `{command.user}`         | The invoker's full username.            |
| `{command.user_id}`      | The invoker's Discord ID.               |
| `{command.user_mention}` | A mention of the invoker.               |
| `{command.channel}`      | A mention of the channel it was run in. |
| `{command.channel_id}`   | That channel's ID.                      |
| `{command.arg_count}`    | Same as `{arg.count}`.                  |

***

## Auto-detected target

If the input contains a user mention, the **first** one is resolved as the target and unlocks the `{target.*}` family — `{target.name}`, `{target.mention}`, `{target.id}`, `{target.avatar}`, and so on.

```bash theme={null} theme={null}
;cc set whois -- {target.name} joined {target.joined_at}
```

<Note>
  Only a real `<@id>` mention sets the target. A raw user ID or a username in the arguments does not.
</Note>

***

## Moderator and punishment data

`{moderator.*}` describes the person running the command: `{moderator.mention}`, `{moderator.id}`, `{moderator.name}`, `{moderator.display_name}`, `{moderator.tag}`, `{moderator.avatar}`, `{moderator.bot}`, `{moderator.created_at}`.

`{punishment.*}` describes the **most recent** moderation action the script performed, and is only available after a `{mod:...}` action in the same script:

| Placeholder                                       | Resolves to                                     |
| :------------------------------------------------ | :---------------------------------------------- |
| `{punishment.case_id}`                            | The generated case number.                      |
| `{punishment.type}`                               | `ban`, `kick`, `warn`, `timeout`, `role_add`, … |
| `{punishment.reason}`                             | The reason passed to the action.                |
| `{punishment.duration}`                           | Timeout length, when applicable.                |
| `{punishment.user}` / `{punishment.user.mention}` | The punished member.                            |
| `{punishment.user.id}` / `.name` / `.avatar`      | Details of the punished member.                 |

See [Actions](/server-config/custom-commands/actions) for the tags that produce these.

***

## Economy data

Balances are fetched only when the script mentions them. `economy.` and `econ.` are interchangeable prefixes, and `target.economy.` / `target.econ.` read the auto-detected target's balances instead.

| Placeholder                                 | Resolves to                               |
| :------------------------------------------ | :---------------------------------------- |
| `{economy.balance}` / `{econ.bal}`          | Wallet + bank, formatted (`1,500 coins`). |
| `{economy.wallet}` / `{econ.cash}`          | Wallet only, formatted.                   |
| `{economy.bank}`                            | Bank only, formatted.                     |
| `{economy.networth}`                        | Wallet + bank, formatted.                 |
| `{economy.raw_balance}` / `{econ.raw_bal}`  | Wallet + bank as a bare number.           |
| `{economy.raw_cash}` / `{economy.raw_bank}` | Wallet / bank as bare numbers.            |

<Note>
  These are **read-only**. The `{econ:add}` / `{econ:set}` / `{econ:transfer}` actions were removed because the economy is global — see [Actions](/server-config/custom-commands/actions#economy-actions-removed).
</Note>

<Tip>
  Use the `raw_` variants inside conditionals — `{if:{econ.raw_bal}>=1000}` compares numbers, while `{econ.bal}` is a formatted string with a comma and the word "coins".
</Tip>

***

## Global placeholders

Custom commands support raze's entire global variable set — user, server, channel, role, date, and time. The full list lives on the [Variables](/resources/variables) page.

Quick reminders:

* **User:** `{user.name}`, `{user.mention}`, `{user.id}`, `{user.avatar}`, `{user.joined_at}`, `{user.top_role}`
* **Server:** `{guild.name}`, `{guild.id}`, `{guild.count}`, `{guild.icon}`, `{guild.owner.mention}`
* **Channel:** `{channel.name}`, `{channel.mention}`, `{channel.topic}`
* **Date & time:** `{date.now}` and `{time.now}` in IST, `{date.utc_now}` and `{time.utc_now}` in UTC

***

## Text transforms

Wrap a **variable name** in a transform function to reshape its output:

| Function                       | Does                               | Example       |
| :----------------------------- | :--------------------------------- | :------------ |
| `{lower(user.name)}`           | Lowercases.                        | `wanderer`    |
| `{upper(user.name)}`           | Uppercases.                        | `WANDERER`    |
| `{title(message)}`             | Capitalises each word.             | `Hello World` |
| `{capitalize(message)}`        | Capitalises the first letter only. | `Hello world` |
| `{len(message)}`               | Character count.                   | `11`          |
| `{strip(message)}`             | Trims surrounding whitespace.      | `hello`       |
| `{replace(message, old, new)}` | Swaps every `old` for `new`.       | `hallo`       |

<Warning>
  Write the name **without** braces: `{upper(user.name)}`, not `{upper({user.name})}`. Names that can't be resolved are treated as literal text, so `{upper(hello)}` renders `HELLO`.
</Warning>

Resolvable inside a transform: any declared argument, any `arg.*` / `command.*` / `moderator.*` / `economy.*` value, plus `user.name`, `user.display_name`, `user.id`, `target.name`, `target.display_name`, `target.id`, `guild.name`, `server.name`, and `channel.name`.

```bash theme={null} theme={null}
;cc set shout (text...) -- {upper(text)} ({len(text)} characters)
```

```bash theme={null} theme={null}
;shout keep it down
```

> KEEP IT DOWN (12 characters)

<Tip>
  Need branching or randomness on top of these values? See [Logic and randomness](/server-config/custom-commands/logic-random).
</Tip>
