I have this code, but I need to use another code. Can we give me a example or a some method to learn album? I want to get all files ids.
@dp.message_handler(
IsAdmin,
state=PostCreation.TextWaiting,
content_types=ContentType.all
)
async def create_album(message: types.Message, state: FSMContext):
data = await state.get_data()
photos = data.get("photos", {})
file_type = message.content_type
file_id = None
if file_type == types.ContentType.ANIMATION:
file_id = message.animation.file_id
elif file_type == types.ContentType.PHOTO:
file_id = message.photo[-1].file_id
elif file_type == types.ContentType.VIDEO:
file_id = message.video.file_id
elif file_type == types.ContentType.DOCUMENT:
file_id = message.document.file_id
has_caption = any(photo.get("caption") for photo in photos.values())
if not has_caption:
photo_info = {"file_id": file_id, "file_type": file_type, "caption": message.caption }
else:
photo_info = {"file_id": file_id, "file_type": file_type}
photos[len(photos) + 1] = photo_info
await state.update_data(photos=photos)
`