mirror of
https://github.com/42wim/matterbridge.git
synced 2024-12-18 17:12:37 +01:00
Try quoting previous messsage (telegram). #237
This commit is contained in:
parent
5f14141ec9
commit
4bda29cb38
@ -160,6 +160,27 @@ 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)}
|
||||
|
Loading…
Reference in New Issue
Block a user