0

The Message object has a photo field, which contains an array of PhotoSize objects. And everything is in order if one photo was sent to the bot, because you can take just the last item. But if several photos are sent, then getting the largest photo is no longer possible. How to download the largest copy of each photo?

  • Hi and welcome to SO. Please take the time to read the [How to Ask](https://stackoverflow.com/help/how-to-ask) section in order to understand how to post a good question so that the community can assist you. Please edit your post and add a [minimal, reproducible example](https://stackoverflow.com/help/minimal-reproducible-example) and any errors or logs you might get. – Daniel Ocando Dec 23 '19 at 14:05

1 Answers1

0

I see no logic here:

if several photos are sent, then getting the largest photo is no longer possible

If album (or just some photos) were sent to a bot, it will get as many updates with separate Message object as many photos were sent.

It means, that you need to take the last element of PhotoSize array every time and you will have the largest photo in this case.

ihoru
  • 1,905
  • 1
  • 16
  • 15