From 556a7f47da0c2949ee2c1fa2f8171c7f60da97ee Mon Sep 17 00:00:00 2001 From: jx11r Date: Wed, 28 Sep 2022 19:47:57 -0500 Subject: [PATCH] Add StripQuote option (telegram) --- bridge/config/config.go | 1 + bridge/telegram/handlers.go | 2 ++ matterbridge.toml.sample | 4 ++++ 3 files changed, 7 insertions(+) diff --git a/bridge/config/config.go b/bridge/config/config.go index 18c60920..481a072c 100644 --- a/bridge/config/config.go +++ b/bridge/config/config.go @@ -156,6 +156,7 @@ type Protocol struct { SkipVersionCheck bool // mattermost StripNick bool // all protocols StripMarkdown bool // irc + StripQuote bool // telegram SyncTopic bool // slack TengoModifyMessage string // general Team string // mattermost, keybase diff --git a/bridge/telegram/handlers.go b/bridge/telegram/handlers.go index ad41354e..b8c340f8 100644 --- a/bridge/telegram/handlers.go +++ b/bridge/telegram/handlers.go @@ -114,6 +114,8 @@ func (b *Btelegram) handleQuoting(rmsg *config.Message, message *tgbotapi.Messag quote := message.ReplyToMessage.Text if quote == "" { quote = message.ReplyToMessage.Caption + } else if b.GetBool("StripQuote") { + quote = strings.ReplaceAll(quote, "\n", " ") } rmsg.Text = b.handleQuote(rmsg.Text, usernameReply, quote) } diff --git a/matterbridge.toml.sample b/matterbridge.toml.sample index 97b27d73..633814ec 100644 --- a/matterbridge.toml.sample +++ b/matterbridge.toml.sample @@ -1146,6 +1146,10 @@ ShowJoinPart=false #OPTIONAL (default false) StripNick=false +#Replace line breaks with spaces in quoted messages to avoid flooding +#OPTIONAL (default false) +StripQuote=false + #Enable to show topic changes from other bridges #Only works hiding/show topic changes from slack bridge for now #OPTIONAL (default false)