1
0
mirror of synced 2024-11-28 14:36:02 +03:00

correct file caption

This commit is contained in:
DmitryZagorulko 2019-01-29 11:33:50 +03:00
parent b416922844
commit a00509d1d4

View File

@ -923,6 +923,7 @@ func photoMessage(items []v1.FileItem, mgClient *v1.MgClient, cid int64) (chatta
msg := tgbotapi.NewPhotoUpload(cid, nil) msg := tgbotapi.NewPhotoUpload(cid, nil)
msg.FileID = file.Url msg.FileID = file.Url
msg.UseExisting = true msg.UseExisting = true
msg.Caption = v[0].Caption
chattable = msg chattable = msg
} else if len(items) > 1 { } 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 := tgbotapi.NewInputMediaPhoto(file.Url)
ip.Caption = v.Caption
it = append(it, ip) it = append(it, ip)
} }
@ -1007,7 +1009,7 @@ func setAttachment(attachments *tgbotapi.Message, client *v1.MgClient, snd *v1.S
} }
snd.Message.Type = v1.MsgTypeImage snd.Message.Type = v1.MsgTypeImage
caption = getLocalizedMessage(t) caption = attachments.Caption
case "document": case "document":
fileID = attachments.Document.FileID fileID = attachments.Document.FileID
snd.Message.Type = v1.MsgTypeFile snd.Message.Type = v1.MsgTypeFile
@ -1015,7 +1017,7 @@ func setAttachment(attachments *tgbotapi.Message, client *v1.MgClient, snd *v1.S
case "sticker": case "sticker":
fileID = attachments.Sticker.FileID fileID = attachments.Sticker.FileID
snd.Message.Type = v1.MsgTypeImage snd.Message.Type = v1.MsgTypeImage
caption = getLocalizedMessage(t) caption = attachments.Caption
default: default:
snd.Message.Text = getLocalizedMessage(t) snd.Message.Text = getLocalizedMessage(t)
} }