mirror of
https://github.com/Luzifer/twitch-bot.git
synced 2024-11-09 16:50:01 +00:00
[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:
parent
847e119e5d
commit
9e2628c6e3
1 changed files with 2 additions and 1 deletions
|
@ -3,6 +3,7 @@ package main
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"regexp"
|
"regexp"
|
||||||
|
"strings"
|
||||||
"text/template"
|
"text/template"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
@ -57,7 +58,7 @@ func formatMessage(tplString string, m *irc.Message, r *plugins.Rule, fields *pl
|
||||||
buf := new(bytes.Buffer)
|
buf := new(bytes.Buffer)
|
||||||
err = tpl.Execute(buf, compiledFields.Data())
|
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) {
|
func formatMessageFieldChannel(compiledFields *plugins.FieldCollection, m *irc.Message, fields *plugins.FieldCollection) {
|
||||||
|
|
Loading…
Reference in a new issue