For the complete documentation index, see llms.txt. This page is also available as Markdown.

Formatting counters

Change how a single counter prints its number, with compact notation, a locale and custom digits.

Every number a counter returns is formatted with compact notation, a locale and custom digits. Server settings sets them for the whole server; Format settings sets them for one counter.

Click a counter chip in the template editor to open its edit panel, then expand Format settings. It always edits the counter that owns the chip, even while you are drilled into one of its nested counters. A nested counter has no format settings of its own.

Format settings expanded in the counter edit panel
The three controls inside Format settings.

Use compact notation

Option
What it does

Default to server settings

Follow the server's Use compact notation for numbers switch. This is the starting value.

Yes

Always shorten the number for this counter.

No

Always print the number in full for this counter.

Compact notation shortens large numbers the way the locale does it. In en-US, 12300 becomes 12K and 1500000 becomes 1.5M. In de-DE, 1500000 becomes 1,5 Mio. Pick No on a counter whose exact value matters, such as a Nitro booster count, while the rest of the server stays compact.

Override default locale

Tick the checkbox and pick a locale for this counter only, or leave it clear to use the server's locale. The list holds the full ISO locale set, and you can also type a tag that is not listed and select what you typed. The locale decides the group separator and decimal mark of a number, the suffix compact notation uses (K, mil, 万), and the words the Clock and Date counters print, such as month and weekday names.

Override default digits

Tick the checkbox and ten inputs appear, one per digit. Whatever you put in an input replaces that digit in this counter's output.

The ten custom digit inputs
One input per digit.

The inputs work like the ones in Server settings. Custom digits are hard for screen readers to read out, for the reasons given there.

Which setting wins

Digits resolve one by one, so a counter can override three digits and take the other seven from the server. A digit that is empty in both places falls back to the plain digit for that position.

Display label

Display label opens from the tag button in the edit panel. It is a custom name shown on this counter's chip in the editor, and it does not change the channel output. Use it to tell several similar chips apart, such as three Roles counters in one template. Clear the field to go back to the counter's normal chip text. Unlike Format settings, the display label follows whichever counter you are looking at, so a label set on a nested counter names it in the breadcrumb.

The Display label dialog
A display label renames the chip in the editor only.

What is never formatted

  • Counters that return text. Clock, Date, Countdown, Concat and Replace print exactly what they return. A locale still matters to Clock and Date, because they use it to build that text in the first place.

  • Channel names. Custom digits only reach the topic of a text or announcement channel, because Discord channel names cannot show them. Compact notation still applies to a name. See Channel settings.

  • Nested counters. The bot formats the outermost result only. A Math counter that adds two Members counters formats the sum once, not the two parts.

Examples

The server is compact by default, but the booster channel should show the real number. The server keeps Use compact notation for numbers on, and the Nitro boosters counter sets Use compact notation to No. A server with 1250 boosts then shows 1.3K everywhere and 1250 in that one channel.

The server locale is en-US, but one channel should read as Japanese. The Date counter ticks Override default locale and picks ja-JP. Everything else in the server keeps English month and weekday names.

The Members counter sits in the topic of a text channel, with Override default digits ticked and each input filled with a custom server emoji. 438 prints as the emoji for 4, 3 and 8. Move the same counter to a voice channel name and it prints 438.

Technical details
  • Resolution at evaluation time, per field: locale = dataSource.format.locale ?? guild.formatSettings.locale, same for compactNotation, and digit i = the counter's digit when non-empty, else the guild digit when non-empty, else the literal digit (packages/services/src/DataSource/index.ts).

  • The root counter's prepared format settings are passed to every nested evaluator, so a nested Clock gets the locale, but only the outermost value goes through the formatter.

  • Compact notation is new Intl.NumberFormat(locale, { notation: "compact" }) with the locale as stored. An invalid tag throws a RangeError there; the job stores its raw message in LastTemplateComputeError and writes the string ERROR! into the channel. The channel page shows "An unknown error occurred." because any message that is not a DataSourceErrorNames value falls back to UNKNOWN.

  • Evaluators get the locale replaced with en-US when it is shorter than two characters; the formatter does not, which is why an empty locale breaks number counters but not Clock or Date.

  • Digit substitution runs only when isTextLikeChannel(channelType) is true, so voice and category names skip it.

  • A number counter whose result is NaN raises FAILED_TO_RETURN_A_FINAL_STRING: "Failed to generate a final string from the evaluation."

  • A digit input accepts the same marks and emojis as a channel topic, and it takes no nested counters.

  • Display label is stored as displayLabel on the counter's JSON and is never read during evaluation.

  • Nothing on this page depends on an environment variable when self-hosting.

Last updated