Implemented a MediaGroupBuilder class in 'aiogram/utils/media_group.py' to help construct media groups. The class supports addition of different media types (audio, photo, video, document) to the media group with a maximum limit of 10 files. The functionality is demonstrated and usage is documented in 'docs/utils/media_group.rst'. Added related test cases in 'tests/test_utils/test_media_group.py'. This is to streamline and simplify the process of media group creation
* Ensure base type validation can handle non-dictionary values
The update introduces a condition to verify whether the values being validated are a dictionary before attempting to handle UNSET_TYPE in the aiogram base type. This adjustment helps to prevent potential errors or incorrect validation when non-dictionary values are faced.
* Added a test case for non-dictionary input in remove_unset method
* Added changelog
* Fixed tests
* Fix `Message.send_copy` method for stories
Fixed an issue with the `Message.send_copy` method, which was not functioning properly with story-type messages. The `ForwardMessage` logic has been added to the method to enable copying of stories, in addition to other types. Tests and documentation have also been updated to reflect these changes.
* Typo fix
* #1277 Replace datetime.datetime with DateTime across codebase
Replaced all instances of standard library 'datetime.datetime' with a new 'DateTime' type from `.custom` module. This change is necessary to make all date-time values compatible with the Telegram Bot API (it uses Unix time). This will simplify the conversion process and eliminate potential errors related to date-time format mismatches. Changed codebase, butcher files, and modified 'pyproject.toml' to shift the typing-extensions dependency. The 'aiogram/custom_types.py' file was renamed to 'aiogram/types/custom.py' to better reflect its nature as a location for custom types used in the aiogram library.
Modified the ".as_" method in the magic filter class to correctly handle values that are interpreted as `False` such as `0`. Previously, the method incorrectly dismissed these valid values. The issue was identified and fixed to ensure correct handling of all valid data inputs.
* Update a warning message in dispatcher
Enhanced the warning message in aiogram/dispatcher/dispatcher.py to include a JSON dump of the update. This change helps to give clearer and more detailed information on why an update type is unknown by including the specifics of what the update contains.
* Added changelog
* Move global filters check placement into router to add chance to pass context from global filters into handlers in the same way as it possible in other places
* Added changelog
* Add multi-file bot example
This commit adds a multi-file bot example to the repository. .
* Refactor: Clean up code formatting for consistency
* add Changelog
* Refactor bot code, fix changelog version
* Refactor and improve bot messages
Refactored bot code to use aiogram enumerations and enhanced chat messages with markdown beautifications for a more user-friendly display.
CommandStart() is now used instead of Command('start') for readability.
Furthermore, the bot's 'stop' command was improved, ensuring it executes appropriately during KeyboardInterrupt or SystemExit.
Additionally, the bot's logging was adjusted to output to sys.stdout for better logs' readability.
* Added Changelog
* Add guidance comments on obtaining bot tokens from environment variables
* Remove hardcoded tokens, opt for environment variable
* Remove unnecessary spaces and reorganize imports
* Fix error, switch default storage from Redis to Memory, and add logging to multibot example
* fix changelog version
---------
Co-authored-by: Alex Root Junior <jroot.junior@gmail.com>
* Refactor and improve bot messages
Refactored bot code to use aiogram enumerations and enhanced chat messages with markdown beautifications for a more user-friendly display.
CommandStart() is now used instead of Command('start') for readability.
Furthermore, the bot's 'stop' command was improved, ensuring it executes appropriately during KeyboardInterrupt or SystemExit.
Additionally, the bot's logging was adjusted to output to sys.stdout for better logs' readability.
* Added Changelog
* Add guidance comments on obtaining bot tokens from environment variables
* Remove hardcoded tokens, opt for environment variable
* Remove unnecessary spaces and reorganize imports
* Fix error, switch default storage from Redis to Memory, and add logging to multibot example
* Add support for message_thread_id in ChatActionSender
The given changes add support for including the 'message_thread_id' in ChatActionSender function calls, allowing actions to be sent in specific threads rather than the main chat.
* Added changelog
Modified the Dispatcher to remove the "bot" key from workflow_data if found, prior to emitting startup in order to allow manual addition of "bot" to workflow data. This change was necessary as a bot instance is required to start polling, and therefore must be passed correctly. This logic is now tested in the 'test_start_polling' function. The change also includes an update to the changelog.
* Enhance keyboard utility, improved documentation for this utility.
Updated the 'aiogram/utils/keyboard.py' file with new methods for integrating buttons and keyboard creation more seamlessly. Added functionality to create buttons from existing markup and attach another builder. This improvement aims to make the keyboard building process more user-friendly and flexible.
* Added changelog
* Cover by tests
* Add additional API message methods to ChatJoinRequest class
ChatJoinRequest now includes additional message methods including SendAnimation, SendAudio, SendContact, and many more. The changes are useful for sending various types of messages during chat join requests.
* Added changelog
* Add model validation to remove UNSET before field validation
Updated aiogram/types/base.py to include a model validator which removes any 'UNSET' before field validation. This change was necessary to correctly handle `parse_mode` where 'UNSET' is used as a sentinel value. Without the removal of 'UNSET', it would create issues when passed to model initialization from `Bot.method_name`. 'UNSET' was also added to typing. Tiny documentation fix was made.
* Added changelog
* Removed the use of the context instance (Bot.get_current) from all placements that were used previously.
* Fixed tests
* Added changelog
* Change category
* PoC: Mount objects to the Bot instance, bind shortcuts to configured instance
* Fixe docstring of the bind method
* Pass Bot instance explicitly to the URLInputFile
* Added tests
* Added changelog
* Refactor aiogram client and update tests
Refactored base.py to improve code readability by separating response_type operation from model_validate(). Also, adjusted the parameters in URLInputFile() within test_input_file.py for better test coverage. Updated input_file.py to streamline read method and avoid unnecessary instantiation of Bot class. Lastly, adjusted typing in methods/base.py to enhance code clarity.
* Update changelog