Thumbnail

rani/matterbridge.git

Clone URL: https://git.buni.party/rani/matterbridge.git

commit dd69e080b1300ebcfe39a271f3f75b4c5e44ff36 Author: Wim <wim@42.be> Date: Tue Sep 19 23:58:05 2017 +0000 Try quoting previous messsage (telegram). #237 diff --git a/bridge/telegram/telegram.go b/bridge/telegram/telegram.go index d6acf49..00ed6de 100644 --- a/bridge/telegram/telegram.go +++ b/bridge/telegram/telegram.go @@ -1606 +16027 @@ func (b *Btelegram) handleRecv(updates <-chan tgbotapi.Update) {   if message.Document != nil && b.Config.UseInsecureURL {   text = text + " " + message.Document.FileName + " : " + b.getFileDirectURL(message.Document.FileID)   } + + // quote the previous message + if message.ReplyToMessage != nil { + usernameReply := "" + if message.ReplyToMessage.From != nil { + if b.Config.UseFirstName { + usernameReply = message.ReplyToMessage.From.FirstName + } + if usernameReply == "" { + usernameReply = message.ReplyToMessage.From.UserName + if usernameReply == "" { + usernameReply = message.ReplyToMessage.From.FirstName + } + } + } + if usernameReply == "" { + usernameReply = "unknown" + } + text = text + " (re @" + usernameReply + ":" + message.ReplyToMessage.Text + ")" + } +   if text != "" {   flog.Debugf("Sending message from %s on %s to gateway", username, b.Account)   msg := config.Message{Username: username, Text: text, Channel: channel, Account: b.Account, UserID: strconv.Itoa(message.From.ID), ID: strconv.Itoa(message.MessageID)}