E
E
enabl32021-09-25 15:52:42
Python
enabl3, 2021-09-25 15:52:42

Why do several photos in one message appear as different messages? And how to receive and send several photos in one message?

Hello!
Please tell me, I want to get the IDs of all the photos and write them to the database, which are sent in one message, for subsequent sending via sendMediaGroup, but for some reason, photos from one message come as several different messages in which there is one photo.
I do it like this:

if message.content_type == "photo":
        photo_id = message.photo[0].file_id
        photos = []
        for i in photo_id:
            photos.append(InputMediaPhoto(photo_id))
            break
        await bot.send_media_group(message.chat.id, photos)

and when I send n photos to the bot in one message, then I receive n messages with each photo in response.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
O
Old_TyT, 2021-09-25
@Old_TyT

For each photo sent in an album, the key "media_group_id" is returned in the message dictionary, in one album, all documents have the same key

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question