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

# Readable endings

> Add a dot and a word to your own variables for leaderboards, nice numbers and lists.

Your own variables can do more than show a plain value. Put a **dot and a word** at the end and DogeBot changes how it looks, or works something out for you.

```text theme={null}
You have {DBVAR_coins.formatted} coins and you are {DBVAR_coins.place}!
```

```text theme={null}
You have 12,500 coins and you are 3rd!
```

![Stored values with readable endings](https://dogebot.net/docs-img/screens/var-stored-values.png)

## Nicer numbers

Work on any number.

| Ending | What it does | Example result |
| - | - | - |
| `.formatted` | Adds commas | `{DBVAR_coins.formatted}` gives `1,234,567` |
| `.short` | Makes big numbers short | `{DBVAR_coins.short}` gives `1.2M` |

## Leaderboards (User variables)

These look at **every member's** value in this server. They only work on **User** variables, like coins or XP.

| Ending | What it gives you | Example result |
| - | - | - |
| `.leaderboard.10` | A ready-made top 10 list. Use any number up to 25. | `1. Sam, 12,500` (and so on) |
| `.top.1.member` | Who is in 1st place. Change `1` for any place. | **@Sam** |
| `.top.1.value` | How many the 1st place has | `12500` |
| `.top.1.id` | The ID of the 1st place | `136327647792726016` |
| `.bottom.1.member` | Who is in last place | **@Alex** |
| `.rank` | This member's place, as a number | `3` |
| `.place` | This member's place, as a word | `3rd` |
| `.next.member` | Who they need to pass next | **@Jo** |
| `.next.gap` | How many more they need to pass them | `250` |
| `.next.value` | How many that person has | `12750` |
| `.total` | Everyone's values added up | `98100` |
| `.average` | The average | `415` |
| `.members` | How many members have a value | `236` |
| `.value[option_user]` | Someone else's value | `800` |

Every ending that is about one member can point at someone else with `[ ]`:

```text theme={null}
{user_name[option_user]} is {DBVAR_coins.place[option_user]} with {DBVAR_coins.value[option_user]} coins.
```

See [Point a variable at someone else](/variables/point-at-someone-else).

### A leaderboard message in one line

```text theme={null}
Top 10 richest
{DBVAR_coins.leaderboard.10}

You are {DBVAR_coins.place} with {DBVAR_coins.formatted} coins.
```

> [!TIP]
>
> You don't have to write this yourself. On the Database page press **Stored values**, then use the **Leaderboard maker**: pick how many places and press **Copy message**.

## Lists (Collections)

These work on **Collection** variables, and on User variables that store a list.

| Ending | What it gives you | Example result |
| - | - | - |
| `.length` | How many things are in the list | `3` |
| `.0`, `.1`, `.2` and so on | The thing at that place. **Places start at 0.** | `{DBVAR_bag.0}` gives `sword` |
| `.first` | The first thing | `sword` |
| `.last` | The last thing | `potion` |
| `.random` | A random thing | `shield` |
| `.join[, ]` | Everything, with what's in `[ ]` between | `sword, shield, potion` |
| `.has[potion]` | `true` if it's in the list | `true` |
| `.count[potion]` | How many times it's in the list | `2` |
| `.position[potion]` | Where it is in the list (from 0) | `2` |
| `.empty` | `true` if the list is empty | `false` |
| `.sum` | All the numbers added up | `60` |
| `.highest` | The biggest number | `40` |
| `.lowest` | The smallest number | `5` |
| `.each[$number. $value\n]` | Writes every thing on its own line | `1. sword` then `2. shield` |

In `.each[...]`:

* `$value` is the thing,
* `$number` counts 1, 2, 3,
* `\n` means a new line.

## Lists of items with keys

A shop is a list where every item has keys, like `name`, `price` and `stock`. These endings read inside the items.

| Ending | What it gives you | Example result |
| - | - | - |
| `[name=Potion].price` | The price of the item called Potion | `50` |
| `[name=Potion]` | The whole Potion item | `{"name":"Potion","price":50}` |
| `.sum.price` | Every price added up | `350` |
| `.has[name=Bow]` | `true` if there's an item called Bow | `false` |
| `.count[stock=0]` | How many items have 0 stock | `1` |
| `.each[**$name**, $price coins\n]` | A line for every item. `$name` and `$price` read those keys. | `**Potion**, 50 coins` |

```text theme={null}
Shop
{DBVAR_shop.each[$number. **$name**, $price coins ($stock left)\n]}
```

```text theme={null}
Shop
1. Potion, 50 coins (10 left)
2. Sword, 200 coins (3 left)
```

## Objects

For an **Object** variable, put a dot and the key name:

```text theme={null}
{DBVAR_settings.prefix}
{DBVAR_profile.title}
```

If a key holds a list, you can keep going: `{DBVAR_inventory.weapons.length}`, `{DBVAR_inventory.weapons.join[, ]}`.

## Endings can be chained

Endings run from left to right, so you can put them one after another:

```text theme={null}
{DBVAR_shop[name=Sword].price.formatted}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.