From 9e2628c6e387c425abf197953559399e0ab53767 Mon Sep 17 00:00:00 2001 From: Knut Ahlers Date: Sat, 16 Jul 2022 21:45:14 +0200 Subject: [PATCH] [msgformatter] Fix: Trim leading / trailing spaces in order to support templating resulting in `/me` message Signed-off-by: Knut Ahlers --- msgformatter.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/msgformatter.go b/msgformatter.go index a4277bf..5a0eec9 100644 --- a/msgformatter.go +++ b/msgformatter.go @@ -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) {