Overlord's Gatekeeper Theme
Template syntax and data

Help › Custom commands › Syntax and data

Template syntax and data

The basics

WriteMeaning
{{.User.Username}}Print a value.
{{$name := "Jess"}}Store a value in a variable.
{{if eq .Channel.Name "general"}} ... {{else}} ... {{end}}Do something only when a condition is true.
{{range .CmdArgs}} {{.}} {{end}}Repeat for each item in a list.
{{/* note */}}A comment. It isn't shown.

Add a dash inside the braces, like {{- ... -}}, to trim the spaces and line breaks around a tag.

Available data

User

.User is the person who triggered the command. Common fields: .User.ID, .User.Username, .User.Mention, .User.Bot, and .User.AvatarURL "256".

Member

.Member is the same person as a member of this server: .Member.Nick, .Member.Roles (a list of role IDs), and .Member.JoinedAt.

Guild (server)

.Guild is the current server: .Guild.ID, .Guild.Name, .Guild.MemberCount, and .Guild.OwnerID.

Channel

.Channel is where the command ran: .Channel.ID, .Channel.Name, and .Channel.Mention.

Message and arguments

  • .Message: the triggering message, for example .Message.Content and .Message.ID.
  • .Cmd: the trigger word that was used.
  • .CmdArgs: the words after the trigger, as a list.
  • .Args: the whole message split into words, including the trigger.
  • .StrippedMsg: the message with the trigger removed.
  • .ServerPrefix: this server's command prefix.

← TemplatesFunctions →