summaryrefslogtreecommitdiffstats
path: root/bridge/helper/helper.go
diff options
context:
space:
mode:
authorWim <wim@42.be>2018-04-19 12:53:49 +0200
committerWim <wim@42.be>2018-04-19 12:53:49 +0200
commita83831e68d47a83775ab54539ddf4fd776576fa7 (patch)
tree38249966035eb8f815884a9e4b80bc5645d5e802 /bridge/helper/helper.go
parenta12a8d4fe2d2f38074278396870085684f9548ca (diff)
downloadmatterbridge-msglm-a83831e68d47a83775ab54539ddf4fd776576fa7.tar.gz
matterbridge-msglm-a83831e68d47a83775ab54539ddf4fd776576fa7.tar.bz2
matterbridge-msglm-a83831e68d47a83775ab54539ddf4fd776576fa7.zip
Remove empty newlines from messages (telegram) #399
Diffstat (limited to 'bridge/helper/helper.go')
-rw-r--r--bridge/helper/helper.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/bridge/helper/helper.go b/bridge/helper/helper.go
index 81789741..7edffb80 100644
--- a/bridge/helper/helper.go
+++ b/bridge/helper/helper.go
@@ -88,3 +88,13 @@ func HandleDownloadData(flog *log.Entry, msg *config.Message, name, comment, url
}
msg.Extra["file"] = append(msg.Extra["file"], config.FileInfo{Name: name, Data: data, URL: url, Comment: comment, Avatar: avatar})
}
+
+func RemoveEmptyNewLines(msg string) string {
+ lines := ""
+ for _, line := range strings.Split(msg, "\n") {
+ if line != "" {
+ lines += line + "\n"
+ }
+ }
+ return lines
+}