1
0
mirror of synced 2024-11-22 04:26:01 +03:00

Merge pull request #68 from DmitryZagorulko/master

correct file caption
This commit is contained in:
Alex Lushpai 2019-01-29 15:37:30 +03:00 committed by GitHub
commit 02bfad6ad3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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)
} }