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.
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.
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.
Custom Helpers
Fyre has some custom helpers to add additional functionality to Handlebars.Random
You can use therandom 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.
Format Number
You can use theformatNumber 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”).
Format Date & Time
You can use theformatDate helper to format a timestamp into any date format.
This helper works with both Dayjs
and Dayjs Advanced formatting options.