summaryrefslogtreecommitdiffstats
path: root/bridge
diff options
context:
space:
mode:
authorWim <wim@42.be>2017-09-19 23:58:05 +0200
committerWim <wim@42.be>2017-09-19 23:58:05 +0200
commit4bda29cb3896ac65c3aafa784c8faac73c3c111b (patch)
tree8b424ecb92efd52ae4e6b9f0704f7d07dbb148ae /bridge
parent5f14141ec95f2dc964e75a98a6cc0bb7dfdd7e79 (diff)
downloadmatterbridge-msglm-4bda29cb3896ac65c3aafa784c8faac73c3c111b.tar.gz
matterbridge-msglm-4bda29cb3896ac65c3aafa784c8faac73c3c111b.tar.bz2
matterbridge-msglm-4bda29cb3896ac65c3aafa784c8faac73c3c111b.zip
Try quoting previous messsage (telegram). #237
Diffstat (limited to 'bridge')
-rw-r--r--bridge/telegram/telegram.go21
1 files changed, 21 insertions, 0 deletions
diff --git a/bridge/telegram/telegram.go b/bridge/telegram/telegram.go
index d6acf49c..00ed6deb 100644
--- a/bridge/telegram/telegram.go
+++ b/bridge/telegram/telegram.go
@@ -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)}