Formatting
Mirror.bot offers comprehensive way to format messages using templates. To the programmatically inclined we use go/templates.
Text Template
To construct a textual message you can use any text combined with variables inside {{ }}, for example
This is a new article {{ .Title }} you can view it [here]({{.Link}})
Embed Template
The embed template uses the same syntax as the text template to provide the values. It has a lot more fields you can edit like:
For now it's only accessible from the Web Dashboard.
Here is a picture representation of what the fields correspond too:
RSS variables
For feed (RSS) and messages this is the all variables available:
- Title: {{ .Title }}
- Description: {{ .Description }}
- Content: {{ .Content }}
- Link: {{ .Link }}
- Updated: {{ .Updated }}
- Published: {{ .Published }}
- GUID: {{ .GUID }}
- Authors: {{ range .Authors }}{{ .Name }} ({{ .Email }}){{ end }}
- Categories: {{ range .Categories }}{{ . }}, {{ end }}
- Image URL: {{ with .Image }}{{ .URL }}{{ end }}
- Image Title: {{ with .Image }}{{ .Title }}{{ end }}
Extensions are are a bit complex to access, for example this gets the youtube thumbnail URL:
{{- with .Extensions -}}{{- with .media -}}{{- with .group -}}{{- with index . 0}}{{- with .Children -}}{{- with .thumbnail -}}{{- with index . 0}}{{- with .Attrs -}}{{- if and .url -}}{{.url}}{{end}}{{end}}{{end}}{{end}}{{end}}{{end}}{{end}}{{end}}{{end}}
Twitch variables
Twitch message variables:
- User Login {{ .UserLogin }}
- User Name {{ .UserName }}
- Game ID {{ .GameID }}
- Game Name {{ .GameName }}
- Title {{ .Title }}
- Language {{ .Language }}
- Thumbnail URL {{ .ThumbnailURL }}
- Tags {{ .Tags }}
- Mature Content {{ .IsMature }}
Twitch messages have no extensions.