Skip to main content
Fyre’s templating is based on Handlebars. Visit their website to learn more advanced logic and syntax.

Basic Syntax

Handlebars has a simple to use syntax for inserting variables into text. Templating is built with Fyre’s Variables in mind to give you the best experience. You can use all Discord Markdown in your templates, Handlebars just adds additional syntax for variables. To insert a variable, surround it in triple braces/curly brackets. We use triple braces because they don’t do HTML Escaping. If your variable won’t return any special characters (& \ " ' = <>) you can use double braces instead of triple braces.
Welcome {{{user.mention}}} to {{{guild.name}}}!

Basic Logic

Handlebars offers a few helpers to work with optional variables or do simple logic checks.

If / If Else

To check if an optional variable exists, or if a boolean variable is true, use #if. You don’t need to have an {{else}} statement if you don’t need one, but it’s provided in this example anyway.
{{#if track.nowPlaying}}
Track is Now Playing
{{else}}
Track isn't Playing
{{/if}}

Track Name: {{{track.name}}}

Unless

Unless is the opposite of if. Use it to check if a variable doesn’t exist, or if a boolean value is false, use #unless.
{{#unless track.loved}}
Track isn't Loved!\n
{{/unless}}
Track Name: The Outfield

Custom Helpers

Fyre has some custom helpers to add additional functionality to Handlebars.

Random

You can use the random helper to randomly select one of the provided strings or numbers. This helper should technically support infinite arguments, but it’s only been tested up to 10.
{{random "Example" "Of" "Random" "Strings"}}

Format Number

You can use the formatNumber helper to format long numbers with commas or periods. This helper supports using an IETF Language Tag for regional formatting (eg. “en-US” or “en-DK”).
Track Name: {{{track.name}}}
Total Plays: {{formatNumber track.totalPlayCount}}
Total Plays (en-DK): {{formatNumber track.totalPlayCount "en-DK"}}

Format Date & Time

You can use the formatDate helper to format a timestamp into any date format. This helper works with both Dayjs and Dayjs Advanced formatting options.
{{formatDate 946713600 "DD/MM/YYYY HH:mm"}}