diff options
author | Wim <wim@42.be> | 2018-04-19 12:53:49 +0200 |
---|---|---|
committer | Wim <wim@42.be> | 2018-04-19 12:53:49 +0200 |
commit | a83831e68d47a83775ab54539ddf4fd776576fa7 (patch) | |
tree | 38249966035eb8f815884a9e4b80bc5645d5e802 /bridge/helper | |
parent | a12a8d4fe2d2f38074278396870085684f9548ca (diff) | |
download | matterbridge-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')
-rw-r--r-- | bridge/helper/helper.go | 10 |
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 +} |