Counters & Variables
Counters and variables are the data layer that powers dynamic commands and automations in Nexmod. They let you store, read, and manipulate values that persist across command executions and action runs.
Counters
Counters are numeric values that can be incremented, decremented, or set to a specific value. They’re ideal for tracking things like deaths, wins, hugs, or any other countable stat.
Properties
| Property | Description |
|---|---|
| Name | Unique identifier for the counter |
| Value | Current numeric value (default: 0) |
| Category | Optional grouping label |
| User ID | Optional per-user scoping |
Types of Counters
Nexmod has two counter systems:
Team Counters
Standalone counters managed from the dashboard. These exist independently and can be used across any command or action.
- Created and managed from the Counters page in the dashboard
- Referenced in flow nodes and message templates
- Support categories for organization
- Can be per-user or global
Command Counters
Counters tied to a specific command. Each command can have its own set of counters that track usage or custom values.
- Created automatically when referenced in a command’s flow
- Accessed via
{count}(default) or{counter:name}syntax - Scoped to the parent command
Counter Operations
| Operation | Description |
|---|---|
| Increment | Add a value (default: +1) |
| Decrement | Subtract a value (default: -1) |
| Set | Set to an exact value |
| Reset | Set back to 0 |
Leaderboard
Counters support a leaderboard view that ranks values. This is useful for per-user counters where you want to see who has the highest score.
Global Variables
Global variables store string values that are shared across all commands and actions. They’re the way different parts of your automation can communicate.
Properties
| Property | Description |
|---|---|
| Key | Unique identifier for the variable |
| Value | Current string value (default: "") |
| Persisted | Whether the value survives bot restarts (default: true) |
| User ID | Optional per-user scoping |
Use Cases
- Last follower: Store the most recent follower’s name for display in commands
- Current song: Updated by an external integration, read by a
!songcommand - Stream status: Track custom state like “taking requests” or “sub games only”
- API responses: Store results from HTTP Request sub-actions for use in subsequent steps
Accessing Variables
In message templates and flow nodes, use {variable:name} syntax:
The last follower was {variable:lastFollower}!In the flow builder, use the Get Variable and Set Variable nodes.
Dashboard Permissions
| Action | Required Permission |
|---|---|
| View counters and variables | automations:read — Viewer and above |
| Create, edit, delete | automations:manage — Editor and above |
Plan Limits
| Plan | Max Counters |
|---|---|
| Free | 3 |
| Plus | Unlimited |
| Pro | Unlimited |
| VIP | Unlimited |