From ba0bfe70a8f07164e1341f4b094841acdad5c3a2 Mon Sep 17 00:00:00 2001 From: Wim Date: Sat, 23 May 2020 21:46:15 +0200 Subject: Add StripMarkdown option (irc). (#1145) Enable `StripMarkdown` to strip markdown for irc. --- bridge/config/config.go | 1 + bridge/irc/irc.go | 5 +++++ 2 files changed, 6 insertions(+) (limited to 'bridge') diff --git a/bridge/config/config.go b/bridge/config/config.go index 031f5a81..59d7d4be 100644 --- a/bridge/config/config.go +++ b/bridge/config/config.go @@ -136,6 +136,7 @@ type Protocol struct { SkipTLSVerify bool // IRC, mattermost SkipVersionCheck bool // mattermost StripNick bool // all protocols + StripMarkdown bool // irc SyncTopic bool // slack TengoModifyMessage string // general Team string // mattermost, keybase diff --git a/bridge/irc/irc.go b/bridge/irc/irc.go index bae9aef0..5fc315a7 100644 --- a/bridge/irc/irc.go +++ b/bridge/irc/irc.go @@ -14,6 +14,7 @@ import ( "github.com/42wim/matterbridge/bridge/config" "github.com/42wim/matterbridge/bridge/helper" "github.com/lrstanley/girc" + stripmd "github.com/writeas/go-strip-markdown" // We need to import the 'data' package as an implicit dependency. // See: https://godoc.org/github.com/paulrosania/go-charset/charset @@ -156,6 +157,10 @@ func (b *Birc) Send(msg config.Message) (string, error) { } var msgLines []string + if b.GetBool("StripMarkdown") { + msg.Text = stripmd.Strip(msg.Text) + } + if b.GetBool("MessageSplit") { msgLines = helper.GetSubLines(msg.Text, b.MessageLength) } else { -- cgit v1.2.3