From e57f3a7e6c9435cba74109fffd402216fcb80fe6 Mon Sep 17 00:00:00 2001 From: Wim Date: Tue, 17 Apr 2018 23:26:41 +0200 Subject: Add QuoteDisable option (telegram). Closes #399 --- bridge/config/config.go | 1 + bridge/telegram/telegram.go | 11 ++++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) (limited to 'bridge') diff --git a/bridge/config/config.go b/bridge/config/config.go index 831ea575..0a8bbc1b 100644 --- a/bridge/config/config.go +++ b/bridge/config/config.go @@ -92,6 +92,7 @@ type Protocol struct { Password string // IRC,mattermost,XMPP,matrix PrefixMessagesWithNick bool // mattemost, slack Protocol string // all protocols + QuoteDisable bool // telegram RejoinDelay int // IRC ReplaceMessages [][]string // all protocols ReplaceNicks [][]string // all protocols diff --git a/bridge/telegram/telegram.go b/bridge/telegram/telegram.go index 7298c2d6..d2f229f8 100644 --- a/bridge/telegram/telegram.go +++ b/bridge/telegram/telegram.go @@ -221,7 +221,16 @@ func (b *Btelegram) handleRecv(updates <-chan tgbotapi.Update) { if usernameReply == "" { usernameReply = "unknown" } - rmsg.Text = rmsg.Text + " (re @" + usernameReply + ":" + message.ReplyToMessage.Text + ")" + if !b.GetBool("QuoteDisable") { + rmsg.Text = rmsg.Text + " (re @" + usernameReply + ":" + // remove empty lines + for _, m := range strings.Split(message.ReplyToMessage.Text, "\n") { + if m != "" { + rmsg.Text = rmsg.Text + m + } + } + rmsg.Text = rmsg.Text + ")" + } } if rmsg.Text != "" || len(rmsg.Extra) > 0 { -- cgit v1.2.3