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

# Counting

> Counting is a persistent per-server, per-channel game. Members submit the next integer; simple arithmetic expressions are validated without executing user code.

## Rules

The channel stores the current value and expected next value. By default, the same person cannot count twice in a row; a wrong answer may reset the chain depending on `reset-on-fail`. Settings also control wrong-answer deletion, reactions, and milestone notices.

> [!NOTE]
>
> Built-in replies and the initial panel copy use English. Headless preserves custom panel text without translating it.

## Setup and permissions

`.counting setup` requires `Manage Server`; `.counting create` requires `Manage Channels` to create a channel. State and statistics are stored per server and persist when the module is paused.

### `.counting setup`

```headless-command Syntax theme={null}
.counting setup [channel] [start=1]
```

```headless-command Example theme={null}
.counting setup #counting 1
```

### `.counting create`

```headless-command Syntax theme={null}
.counting create [name=counting]
```

```headless-command Example theme={null}
.counting create counting
```

### `.counting reset`

```headless-command Syntax theme={null}
.counting reset [start]
```

```headless-command Example theme={null}
.counting reset 1
```

### `.counting config`

```headless-command Syntax theme={null}
.counting config
```

```headless-command Example theme={null}
.counting config
```

### `.counting config same-user`

```headless-command Syntax theme={null}
.counting config same-user <value>
```

```headless-command Example theme={null}
.counting config same-user off
```

### `.counting config reset-on-fail`

```headless-command Syntax theme={null}
.counting config reset-on-fail <value>
```

```headless-command Example theme={null}
.counting config reset-on-fail on
```

### `.counting config delete-wrong`

```headless-command Syntax theme={null}
.counting config delete-wrong <value>
```

```headless-command Example theme={null}
.counting config delete-wrong off
```

### `.counting config reactions`

```headless-command Syntax theme={null}
.counting config reactions <value>
```

```headless-command Example theme={null}
.counting config reactions on
```

### `.counting config milestone`

```headless-command Syntax theme={null}
.counting config milestone <interval>
```

```headless-command Example theme={null}
.counting config milestone 50
```

### `.counting off`

```headless-command Syntax theme={null}
.counting off
```

```headless-command Example theme={null}
.counting off
```

### `.counting on`

```headless-command Syntax theme={null}
.counting on
```

```headless-command Example theme={null}
.counting on
```

## Statistics

`.counting top [amount]` shows up to 15 participants and `.counting stats [@member]` shows a profile. Only supported arithmetic is allowed; non-integers, negative results, division by zero, and oversized expressions are rejected.

> [!NOTE]
>
> Counting is configured with prefix commands; there are no slash equivalents. The bot validates expressions against a limited set of operations; member-submitted Python code is never executed.

### `.counting top`

```headless-command Syntax theme={null}
.counting top [limit=10]
```

```headless-command Example theme={null}
.counting top 10
```

### `.counting stats`

```headless-command Syntax theme={null}
.counting stats [member]
```

```headless-command Example theme={null}
.counting stats @member
```

> [!WARNING]
>
> `reset` clears chain progress and is an administrative action. Expressions use a limited arithmetic grammar, not Python or a general interpreter.

## Commands

> **Complete command reference**
>
> * **`.counting`** — **Description:** Shows the current game status. · **Access:** Server members
> * **`.counting setup [#channel] [start=1]`** — **Description:** Enables the game in an existing channel and sets its first expected value. · **Access:** Manage Server
> * **`.counting create [name=counting]`** — **Description:** Creates and configures a dedicated channel. · **Access:** Manage Channels; the bot also needs Manage Channels
> * **`.counting on`** — **Description:** Re-enables the module when a channel is configured. · **Access:** Manage Server
> * **`.counting off`** — **Description:** Pauses the game and keeps its progress. · **Access:** Manage Server
> * **`.counting reset [start]`** — **Description:** Resets the sequence, optionally from a different value. · **Access:** Manage Server
> * **`.counting channel <#channel>`** — **Description:** Changes the game channel and enables it. · **Access:** Manage Server
> * **`.counting config`** — **Description:** Shows the current status and rules. · **Access:** Manage Server
> * **`.counting config delete-wrong <on|off>`** — **Description:** Chooses whether incorrect answers are deleted. · **Access:** Manage Server
> * **`.counting config reset-on-fail <on|off>`** — **Description:** Chooses whether a mistake resets the sequence. · **Access:** Manage Server
> * **`.counting config same-user <on|off>`** — **Description:** Allows or prevents consecutive turns by the same person. · **Access:** Manage Server
> * **`.counting config reactions <on|off>`** — **Description:** Enables or disables automatic reactions. · **Access:** Manage Server
> * **`.counting config milestone <interval>`** — **Description:** Posts milestones every N numbers; `0` disables them. The cap is 1,000,000. · **Access:** Manage Server
> * **`.counting top [limit=10]`** — **Description:** Shows the leaderboard; the result is clamped to 1–15 entries. · **Access:** Server members
> * **`.counting stats [@member]`** — **Description:** Shows your own or another member's statistics. · **Access:** Server members

## Rules and storage

> **Defaults and mistakes**
>
> The default first number is `1`. Consecutive turns by one user are disabled by default; a wrong answer resets the sequence by default but is not deleted by default. Each behavior can be changed with `.counting config`. Progress and statistics are stored separately per server and remain when the module is paused.

> **Accepted expressions**
>
> Integers and expressions up to 160 characters are accepted, using addition, subtraction, multiplication, exact division, floor division, modulo, integer powers with exponents from -8 to 8, unary signs, and parentheses. The result must be a non-negative integer. Division by zero, unsupported syntax, and excessively large results are rejected.

> **History and leaderboard**
>
> Statistics are stored per member and server. The recent history retains up to 30 entries; `.counting top` never displays more than 15 positions.

## Usage tips

> **How to play**
>
> Each member continues the number. Simple arithmetic expressions are also accepted; the bot validates the result before advancing.

> **Staff**
>
> Staff can reset a broken chain and review the leaderboard. Keep the game in a dedicated channel to avoid mixing it with general conversation.

> **Configuration**
>
> Publish clear rules, tune milestones, and limit who can edit or delete counts so progress remains trustworthy.

## Steps

**1. Choose or create a channel**

Run setup with a channel and start value, or create a dedicated channel if the bot has permission.

**2. Configure rules**

Review `same-user`, `reset-on-fail`, `delete-wrong`, `reactions`, and `milestone` before opening the game.

**3. Test and monitor**

Submit the expected number, try a simple expression such as `1+0`, and review the leaderboard.

## Related pages

* [Logs](/docs/en/server/logging.md)
* [Community utilities](/docs/en/community/utilities.md)


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