From e3cb2ad86ca2dc8e07ef789f1a8178debbc1c427 Mon Sep 17 00:00:00 2001 From: c9s Date: Fri, 14 May 2021 14:57:22 +0800 Subject: [PATCH] fix telegram arguments index update --- pkg/notifier/telegramnotifier/telegram.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/pkg/notifier/telegramnotifier/telegram.go b/pkg/notifier/telegramnotifier/telegram.go index 8cf47b72c..1a5dae95f 100644 --- a/pkg/notifier/telegramnotifier/telegram.go +++ b/pkg/notifier/telegramnotifier/telegram.go @@ -12,7 +12,6 @@ type Notifier struct { type NotifyOption func(notifier *Notifier) - // New // TODO: register interaction with channel, so that we can route message to the specific telegram bot func New(interaction *Interaction, options ...NotifyOption) *Notifier { @@ -38,12 +37,15 @@ func filterPlaintextMessages(args []interface{}) (texts []string, pureArgs []int case types.PlainText: texts = append(texts, a.PlainText()) - textArgsOffset = idx + if textArgsOffset == -1 { + textArgsOffset = idx + } case types.Stringer: texts = append(texts, a.String()) - textArgsOffset = idx - + if textArgsOffset == -1 { + textArgsOffset = idx + } } }