[msgformatter] Fix: Trim leading / trailing spaces

in order to support templating resulting in `/me` message

Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
Knut Ahlers 2022-07-16 21:45:14 +02:00
parent 847e119e5d
commit 9e2628c6e3
Signed by: luzifer
GPG Key ID: 0066F03ED215AD7D

View File

@ -3,6 +3,7 @@ package main
import (
"bytes"
"regexp"
"strings"
"text/template"
"time"
@ -57,7 +58,7 @@ func formatMessage(tplString string, m *irc.Message, r *plugins.Rule, fields *pl
buf := new(bytes.Buffer)
err = tpl.Execute(buf, compiledFields.Data())
return buf.String(), errors.Wrap(err, "execute template")
return strings.TrimSpace(buf.String()), errors.Wrap(err, "execute template")
}
func formatMessageFieldChannel(compiledFields *plugins.FieldCollection, m *irc.Message, fields *plugins.FieldCollection) {