Merge pull request #151 from stek29/fix-gif

Handle Video with no sound (fix #133)
pull/156/head
Ian Byrd 6 years ago committed by GitHub
commit 1cd1ef9fc4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -107,8 +107,17 @@ func (v *Video) Send(b *Bot, to Recipient, opt *SendOptions) (*Message, error) {
return nil, err
}
msg.Video.File.stealRef(&v.File)
*v = *msg.Video
if vid := msg.Video; vid != nil {
vid.File.stealRef(&v.File)
*v = *vid
} else if doc := msg.Document; doc != nil {
// If video has no sound, Telegram can turn it into Document (GIF)
doc.File.stealRef(&v.File)
v.Caption = doc.Caption
v.MIME = doc.MIME
v.Thumbnail = doc.Thumbnail
}
return msg, nil
}

Loading…
Cancel
Save