Custom Message Templates Premium
Custom message templates allow you to specify how your Discord event messages are formatted and which data fields are included.
Creating Templates
Section titled “Creating Templates”When building a custom Reminder Template you can insert a variety of special data fields, which the bot uses to determine where to insert the desired event data. A data field must be enclosed in a double set of curly braces. For example, if you wanted to insert the event’s title, you would type:
{{.Title}}A set of template functions that work with the parameters you specify is also available. For example, if you would like to use an event’s description but only the first 40 characters, you can truncate the description using the following:
{{truncate .Description 40}}Reminder Templates
Section titled “Reminder Templates”Reminder message templates customize your event creation, update, cancellation, and reminder messages. When building a reminder template, you can layout the message once and then assign a notifier to use that template for all future messages.
Summary Templates
Section titled “Summary Templates”Summary templates customize the output from a daily, weekly, or rolling Event Summary. When creating a summary template, the message layout you specify is repeated for each event in the target time frame.
The Summary Style selected at the top of the template editor determines the organization of the summary. The Group By Day style organizes sets of events by their start time day, adds a day title, and then repeats your layout under that title. The Single Events style organizes the events chronologically and then lets you define a title and content section applied to each event.
Due to the complexity of summary templates, we’ve included a preview section at the bottom of the template editor, which shows approximately how your message will appear in Discord.
Standard Event Data Fields
Section titled “Standard Event Data Fields”The following list the standard event data fields retrieved from your connected external calendar. Some of these fields may be blank if your external calendar doesn’t support them.
Generated Data Fields
Section titled “Generated Data Fields”Generated data fields are not retrieved from your external calendars, but are instead derived data. These are a combination of notifier settings and bot status fields generated while processing your events.
Front Matter Data Fields
Section titled “Front Matter Data Fields”Front matter data fields are a one-to-one mapping of the Event Front Matter keys which can be set inside of an event’s description.
Template Functions
Section titled “Template Functions”Template functions are helpers who can take the data field(s) you provide, process them, and produce an output. Functions need to be surrounded by double curly braces, like data fields, followed by their parameters. For example, a template function exampleFunction, which takes two parameters, would be written as:
{{exampleFunction param1 param2}}The table below explains each of these functions and their parameters and provides an example of usage.
The discordDateTime function takes a datetime field and converts it into one of the responsive time formats Discord supports.
Check https://hammertime.cyou for examples of the available formats.
{{discordDateTime .StartTime "F"}}The fixedWidthText function takes a text string and returns a new string which is exactly the length specified. If the input text
is too short spaces are appended. If the text is too long it is truncated. This works well with Discord’s inline code block
markup.
`{{fixedWidthText .Title 40}}`The locationFormatted function is a helper which return the event’s location as a Discord formatted string. This is especially
useful if you are linking to Voice Channels and want clickable VC links for your server members.
{{locationFormatted}}The minutesUntil function takes a datetime field and converts it into an integer equal to the number of minutes until that
datetime.
{{$m := minutesUntil .StartTime}}{{if le $m 60}} Within an hour {{else}} More than an hour out {{end}}The spacer function is a helper which outputs a clear emoji card. This is useful when trying to indent and line up multiple
lines of text.
{{spacer}}The truncate function takes a text string and returns a new string is truncated to the length specified. If the text is too long a
trailing ellipses is added to indicate the additional length.
{{truncate .Description 120}}The timeRange function returns the event’s start and end time range using Discord’s dynamic time code. For most events this will
be in the format Start - End but all day events will return the text All Day translated to your desired language.
{{timeRange}}