X
X
XaMMlo2021-10-27 13:55:56
Bots
XaMMlo, 2021-10-27 13:55:56

Why does the telegram bot give an error Media group must include 2-10 items?

When trying to send a message to the bot with a photo or video, it gives the following error in the console "Media group must include 2-10 items".
And does not send them for moderation in the admin chat.
What could be the reason?

PS Here is the code:
@dp.message_handler(content_types=[ContentType.PHOTO], state=UserStates.all()[2])
async def advert_photo_input(message: types.Message):
print(message)
if 'photo' in adverts[ message.from_user.id] and len(
adverts[message.from_user.id]['video'] + adverts[message.from_user.id]['photo']) < 10:
adverts[message.from_user.id][' photo'].append(message.photo[-1].file_id)
else:
adverts[message.from_user.id]['photo'
print(adverts)

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question