4
0
mirror of https://github.com/cwinfo/matterbridge.git synced 2025-06-26 16:39:24 +00:00

Remove empty newlines from messages (telegram) #399

This commit is contained in:
Wim
2018-04-19 12:53:49 +02:00
parent a12a8d4fe2
commit a83831e68d
2 changed files with 12 additions and 8 deletions

View File

@ -222,18 +222,12 @@ func (b *Btelegram) handleRecv(updates <-chan tgbotapi.Update) {
usernameReply = "unknown"
}
if !b.GetBool("QuoteDisable") {
rmsg.Text = rmsg.Text + " (re @" + usernameReply + ":"
// remove empty lines
for _, m := range strings.Split(message.ReplyToMessage.Text, "\n") {
if m != "" {
rmsg.Text = rmsg.Text + m
}
}
rmsg.Text = rmsg.Text + ")"
rmsg.Text = rmsg.Text + " (re @" + usernameReply + ":" + message.ReplyToMessage.Text + ")"
}
}
if rmsg.Text != "" || len(rmsg.Extra) > 0 {
rmsg.Text = helper.RemoveEmptyNewLines(rmsg.Text)
rmsg.Avatar = helper.GetAvatar(b.avatarMap, strconv.Itoa(message.From.ID), b.General)
b.Log.Debugf("<= Sending message from %s on %s to gateway", rmsg.Username, b.Account)