From a83831e68d47a83775ab54539ddf4fd776576fa7 Mon Sep 17 00:00:00 2001 From: Wim Date: Thu, 19 Apr 2018 12:53:49 +0200 Subject: Remove empty newlines from messages (telegram) #399 --- bridge/helper/helper.go | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'bridge/helper') 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 +} -- cgit v1.2.3