Skip to content

Commit

Permalink
bot: fill animation from the document if it's nil
Browse files Browse the repository at this point in the history
  • Loading branch information
demget committed Sep 26, 2020
1 parent c2cb2be commit d7b825f
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions sendable.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,17 @@ func (a *Animation) Send(b *Bot, to Recipient, opt *SendOptions) (*Message, erro
return nil, err
}

msg.Animation.File.stealRef(&a.File)
*a = *msg.Animation
if msg.Animation != nil {
msg.Animation.File.stealRef(&a.File)
*a = *msg.Animation
} else {
*a = Animation{
File: msg.Document.File,
Thumbnail: msg.Document.Thumbnail,
MIME: msg.Document.MIME,
FileName: msg.Document.FileName,
}
}
a.Caption = msg.Caption

return msg, nil
Expand Down

0 comments on commit d7b825f

Please sign in to comment.