diff --git a/app/callbacks/notes.py b/app/callbacks/notes.py index 3ba5a6d..6a331b5 100644 --- a/app/callbacks/notes.py +++ b/app/callbacks/notes.py @@ -70,7 +70,12 @@ async def create_note_file_id(message: Message, state: FSMContext): return - if message.photo is None and message.document is None: + if ( + message.photo is None + and message.document is None + and message.video is None + and message.voice is None + ): return if message.photo is not None: @@ -80,8 +85,6 @@ async def create_note_file_id(message: Message, state: FSMContext): file_name="photo", ) - # await message.answer_photo(message.photo[-1].file_id) - elif message.document is not None: await state.update_data( file_type="document", @@ -89,7 +92,19 @@ async def create_note_file_id(message: Message, state: FSMContext): file_name=message.document.file_name, ) - # await message.answer_document(message.document.file_id) + elif message.video is not None: + await state.update_data( + file_type="video", + file_id=message.video.file_id, + file_name="video", + ) + + elif message.voice is not None: + await state.update_data( + file_type="voice", + file_id=message.voice.file_id, + file_name="voice", + ) data = await state.get_data() @@ -211,6 +226,18 @@ async def travel_notesend_callback( reply_to_message_id=callback.message.message_id, ) + elif note.file_type == "video": + await callback.message.answer_video( + note.file_id, + reply_to_message_id=callback.message.message_id, + ) + + elif note.file_type == "voice": + await callback.message.answer_voice( + note.file_id, + reply_to_message_id=callback.message.message_id, + ) + await callback.answer() diff --git a/app/keyboards/builders.py b/app/keyboards/builders.py index bbf08a4..5c1a039 100644 --- a/app/keyboards/builders.py +++ b/app/keyboards/builders.py @@ -170,6 +170,10 @@ def notes_keyboard(notes, page: int, pages: int, travel_id: int): for note in notes[start_index:end_index]: if note.file_type == "photo": button_text = f"Photo ID: {note.id}" + elif note.file_type == "video": + button_text = f"Video ID: {note.id}" + elif note.file_type == "voice": + button_text = f"Voice ID: {note.id}" else: button_text = note.file_name diff --git a/app/messages.py b/app/messages.py index a3d33d5..8f1a93a 100644 --- a/app/messages.py +++ b/app/messages.py @@ -41,7 +41,7 @@ ENTER_LOCATION_DATE_END = "Enter location end datetime(in UTC) in this format:\n INVALID_DATE_END = "End date can't be earlier or equal to start date." LOCATION_ADDED = "✅ Location added" -ADD_NOTE = "✏️ Send me file or photo to add note.\nEnter /cancel to cancel creating." +ADD_NOTE = "✏️ Send me file, photo, video or voice nessage to add note.\nEnter /cancel to cancel creating." DELETED_TRAVEL = "✅ Travel deleted" TRAVELS = "📃 Travels:\n👑 - owner"