From a00509d1d43b175ddb02150dc87b7ecef5f55e5d Mon Sep 17 00:00:00 2001 From: DmitryZagorulko Date: Tue, 29 Jan 2019 11:33:50 +0300 Subject: [PATCH] correct file caption --- src/routing.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/routing.go b/src/routing.go index 6e287ca..a009e75 100644 --- a/src/routing.go +++ b/src/routing.go @@ -923,6 +923,7 @@ func photoMessage(items []v1.FileItem, mgClient *v1.MgClient, cid int64) (chatta msg := tgbotapi.NewPhotoUpload(cid, nil) msg.FileID = file.Url msg.UseExisting = true + msg.Caption = v[0].Caption chattable = msg } else if len(items) > 1 { @@ -939,6 +940,7 @@ func photoMessage(items []v1.FileItem, mgClient *v1.MgClient, cid int64) (chatta } ip := tgbotapi.NewInputMediaPhoto(file.Url) + ip.Caption = v.Caption it = append(it, ip) } @@ -1007,7 +1009,7 @@ func setAttachment(attachments *tgbotapi.Message, client *v1.MgClient, snd *v1.S } snd.Message.Type = v1.MsgTypeImage - caption = getLocalizedMessage(t) + caption = attachments.Caption case "document": fileID = attachments.Document.FileID snd.Message.Type = v1.MsgTypeFile @@ -1015,7 +1017,7 @@ func setAttachment(attachments *tgbotapi.Message, client *v1.MgClient, snd *v1.S case "sticker": fileID = attachments.Sticker.FileID snd.Message.Type = v1.MsgTypeImage - caption = getLocalizedMessage(t) + caption = attachments.Caption default: snd.Message.Text = getLocalizedMessage(t) }