refactor(types): unify InputFile with str in media types (dev-3.x)

Refactored various InputMedia types to support Union[InputFile, str] for
media properties, enhancing flexibility and unifying input data types.

- Modified media_group.py for AUDIO, PHOTO, VIDEO, and DOCUMENT.
- Updated input_media_document.py and input_media_audio.py
  to use Union[InputFile, str].
- Adjusted bot.py to utilize DateTime for close_date.
- Refactored aiohttp session for better file handle and serialization.
- Enhanced set_chat_photo.py to accept Union[InputFile, str].
- Re-organized input_file.py with modern BaseModel features.
- Added new client/form module for splitting file extraction logic.
- Adapted test cases to validate the new structure and behavior.
This commit is contained in:
zemf4you 2024-05-20 09:33:16 +07:00
parent 6f4452f4e0
commit 1ea41076cd
27 changed files with 346 additions and 305 deletions

View file

@ -5,7 +5,7 @@ from aiogram import Bot
from aiogram.client.session.base import BaseSession
from aiogram.methods import TelegramMethod
from aiogram.methods.base import Response, TelegramType
from aiogram.types import UNSET_PARSE_MODE, ResponseParameters, User
from aiogram.types import ResponseParameters, User
class MockedSession(BaseSession):
@ -29,7 +29,7 @@ class MockedSession(BaseSession):
self,
bot: Bot,
method: TelegramMethod[TelegramType],
timeout: Optional[int] = UNSET_PARSE_MODE,
timeout: Optional[int] = None,
) -> TelegramType:
self.closed = False
self.requests.append(method)