Fix: Do not copy reference but map content

Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
Knut Ahlers 2021-03-21 14:43:26 +01:00
parent c18f96f889
commit df9a23fec8
Signed by: luzifer
GPG key ID: 0066F03ED215AD7D

View file

@ -14,7 +14,10 @@ import (
func formatMessage(tplString string, m *irc.Message, r *rule, fields map[string]interface{}) (string, error) { func formatMessage(tplString string, m *irc.Message, r *rule, fields map[string]interface{}) (string, error) {
// Create anonymous functions in current context in order to access function variables // Create anonymous functions in current context in order to access function variables
messageFunctions := korvike.GetFunctionMap() messageFunctions := make(template.FuncMap)
for n, f := range korvike.GetFunctionMap() {
messageFunctions[n] = f
}
// Generic functions // Generic functions
messageFunctions["toLower"] = strings.ToLower messageFunctions["toLower"] = strings.ToLower