Fix: Allow locale time in templating

Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
Knut Ahlers 2022-12-06 18:45:50 +01:00
parent 4f63bf2d19
commit 5c305cd887
Signed by: luzifer
GPG key ID: D91C3E91E4CAD6F5

View file

@ -212,8 +212,11 @@ func (m modStreamSchedule) assembleEmbed(data *twitchStreamSchedule) *discordgo.
} }
func (m modStreamSchedule) executeContentTemplate(data *twitchStreamSchedule) (string, error) { func (m modStreamSchedule) executeContentTemplate(data *twitchStreamSchedule) (string, error) {
fns := sprig.FuncMap()
fns["localeStrftime"] = localeStrftime
tpl, err := template.New("streamschedule"). tpl, err := template.New("streamschedule").
Funcs(sprig.FuncMap()). Funcs(fns).
Parse(m.attrs.MustString("content", ptrStringEmpty)) Parse(m.attrs.MustString("content", ptrStringEmpty))
if err != nil { if err != nil {
return "", errors.Wrap(err, "parsing template") return "", errors.Wrap(err, "parsing template")