Commit graph

2132 commits

Author SHA1 Message Date
JRoot Junior
1281bf551a
Describe new event observers in the docs 2023-12-31 15:21:41 +02:00
JRoot Junior
d394af83bd
Update docs 2023-12-31 11:51:00 +02:00
JRoot Junior
233d3c469d
Towncrier 2023-12-31 03:06:18 +02:00
Alex Root Junior
6795b3de05
Added support for Bot API 7.0 (#1387)
* Added support for Bot API 7.0

* Fixed available tests

* Fixed text decorations

* Bot API 7.0 tests for ForwardMessages

* Bot API 7.0 tests for CopyMessages

* Bot API 7.0 tests for DeleteMessages

* Bot API 7.0 tests for GetUserChatBoosts

* Bot API 7.0 tests for SetMessageReaction

* Fixed custom_emoji attribute name

* Fixed tests

* Test parsing CallbackQuery message (inaccessible and accessible)

* Added changes description

* Bot API 7.0 tests for dispatcher handle update message_reaction

* Bot API 7.0 tests for dispatcher handle update message_reaction_count

* Bot API 7.0 tests for dispatcher handle update chat_boost

* Bot API 7.0 tests for dispatcher handle update removed_chat_boost

* fix tests: update ReactionTypeCustomEmoji custom_emoji -> custom_emoji_id

* micro fix Markdown V2 blockquote

* add tests for Markdown tools

* fix markdown test apply single entity

* add tests coverage for Message.react

* check that all messages and content types are covered for Message.content_type

* sort imports in tests (run `make reformat lint`)

* update Giveaway objects Unix time field to DateTime type

* Update Message.content_type property

* upgrade tests for message content_types and sent_copy

* Update Giveaway type generation config

* Update GiveawayWinners and PassportFile types generation configs

---------

Co-authored-by: Suren Khorenyan <surenkhorenyan@gmail.com>
2023-12-31 01:40:44 +02:00
SM CheeseNick
756cfeba0a
Update dispatcher.py (#1384)
On line 576 corrected typo in world more (was mre)
2023-12-23 01:47:38 +02:00
JRoot Junior
a2e5f9a8b8
Update changelog 2023-11-24 23:29:21 +02:00
JRoot Junior
69a07e3b0c
Update docs 2023-11-24 21:55:58 +02:00
JRoot Junior
fc9e2b82c6
Added page for deep linking util 2023-11-24 21:27:03 +02:00
JRoot Junior
94939660c7
Update texts 2023-11-24 21:26:33 +02:00
Alex Root Junior
c8dff11d1e
Update thumbnail type to InputFile only (#1374)
* Update thumbnail type to InputFile only

The thumbnail's type restriction has been changed in several methods and types. Previously, it accepted Union[InputFile, str], allowing both InputFile instances and strings. Now it's changed to accept only InputFile instances. This change enhances meaning of the thumbnail fields in due to Bot API accepts only InputFile instances.

* Added changelog

* Fixed typehints
2023-11-24 21:10:02 +02:00
JRoot Junior
09af2a1c8b
Fixed lines range 2023-11-23 02:27:03 +02:00
JRoot Junior
ead79a1927
Fixed typo 2023-11-23 01:56:26 +02:00
JRoot Junior
423796a445
Added translation for Scenes 2023-11-23 01:28:11 +02:00
Alex Root Junior
3d63bf3b99
PoC Scenes (#1280)
* Base implementation

* Small refactoring + added possibility to specify post-action on handlers

* Move scene properties to config object

* Revise aiogram/scenes with wizard-based design pattern

Modified files in aiogram/scenes to incorporate the Wizard design pattern. Files affected are _marker.py, _registry.py, _wizard.py and __init__.py. The changes introduced a SceneWizard Class and ScenesManager, both of which aid in controlling navigation between different scenes or states. This helps clarifying the codebase, streamline scene transitions and offer more control over the app flow.

* Added example

* Small optimizations

* Replace ValueError with SceneException in scenes. Added error safety in scene resolver.

* str

* Added possibility to reset context on scene entered and to handle callback query in any state

* Remove inline markup in example

* Small changes

* Docs + example

* Small refactoring

* Remove scene inclusion methods from router

The methods for including scenes as sub-routers have been removed from the router.py file. Instead, the SceneRegistry class is now set to register scenes by default upon initializing. This streamlines the scene management process by removing redundant routers and making registration automatic.

* Init tests

* Small fix in tests

* Add support for State instance in the scene

The aiogram FSM scene now allows the use of State instance as an argument, enabling more customization. Modified the 'as_handler' method to receive **kwargs arguments, allowing passing of attributes to the handler. An additional type check has been also added to ensure the 'scene' is either a subclass of Scene or a string.

* Fixed test

* Expand test coverage for test_fsm module

The commit enhances tests for the test_fsm module to improve code reliability. It includes additional unit tests for the ObserverDecorator and ActionContainer classes and introduces new tests for the SceneHandlerWrapper class. This ensures the correct functionality of the decorator methods, the action container execution, and the handler wrapper.

* Reformat code

* Fixed long line in the example

* Skip some tests on PyPy

* Change mock return_value

* Compatibility...

* Compatibility...

* Compatibility...

* Added base changes description

* Scenes Tests (#1369)

* ADD tests for `SceneRegistry`

* ADD tests for `ScenesManager`

* ADD Changelog

* Revert "ADD Changelog"

This reverts commit 6dd9301252.

* Remove `@pytest.mark.asyncio`, Reformat code

* Scenes Tests. Part 2 (#1371)

* ADD tests for `SceneWizard`

* ADD tests for `Scene`

* Refactor ObserverDecorator to use on.message syntax in test_scene.py
Cover `Scene::__init_subclass__::if isinstance(value, ObserverDecorator):`

* Refactor `HistoryManager` in `aiogram/fsm/scene.py`
Removed condition that checked if 'history' is empty before calling 'update_data' in 'Scene'.

* ADD tests for `HistoryManager`

* Small changes in the documentation

* Small changes in the documentation

* Small changes in the documentation

---------

Co-authored-by: Andrew <11490628+andrew000@users.noreply.github.com>
2023-11-23 00:41:21 +02:00
JRoot Junior
ce4e1a706d
#1370 added possibility to check X | None on Python >= 3.10 2023-11-20 22:49:55 +02:00
Oleg A
e17e3bc71c
Fix CallbackData without default Optional (#1370)
* fix: CallbackData set optional as None

* docs: add fix changelog

* Add support for nullable fields in callback data

This update extends the callback data handling by adding support for nullable fields. The code now uses the Python typing structures `Optional` and `Union` to parse such fields correctly. A helper function `_check_field_is_nullable` has been added to assist in efficiently checking if a given field is nullable.

* Add support for nullable fields in callback data

This update extends the callback data handling by adding support for nullable fields. The code now uses the Python typing structures `Optional` and `Union` to parse such fields correctly. A helper function `_check_field_is_nullable` has been added to assist in efficiently checking if a given field is nullable.

---------

Co-authored-by: JRoot Junior <jroot.junior@gmail.com>
2023-11-20 22:39:09 +02:00
JRoot Junior
ebade3d51f
Merge test+pypy tests but with separated jobs 2023-11-18 21:45:22 +02:00
JRoot Junior
7b0a6d2050
Separate PyPy tests and disable Windows PyPy tests 2023-11-18 21:43:16 +02:00
JRoot Junior
82f9365180
Try to disable PyPy tests on Windows 2023-11-18 21:35:30 +02:00
JRoot Junior
dd1e8085bf
Fixed Py3.12 tests 2023-11-18 21:28:34 +02:00
Nachtalb
c1bafea3e8
Upgrade to py12 (#1354)
* Upgrade to py12 compatible aiohttp beta version

* Fix uvloop deprecation warning causing pytest not to run

* Fix test due to asyncio task scheduling race condition

* Fix test_state_in_unknown_class for Python 3.12+ due to PEP 678 changes

* Add Python 3.12 support in GitHub Actions and project configurations

* Add changelog entry

---------

Co-authored-by: Alex Root Junior <jroot.junior@gmail.com>
2023-11-18 21:24:19 +02:00
JRoot Junior
c208bcf748
Reformat code 2023-11-17 00:28:47 +02:00
JRoot Junior
0fc718deeb
Small changes in the pending changelog 2023-11-17 00:27:30 +02:00
JRoot Junior
5b59ca679a
Ignore PytestUnraisableExceptionWarning again 2023-11-16 12:40:52 +02:00
JRoot Junior
7e45f482d4
Enable filterwarnings 2023-11-16 12:37:15 +02:00
JRoot Junior
9bced29923
Update translation files 2023-11-16 02:34:57 +02:00
Alex Root Junior
3ad5ed6bc2
Fixed ResourceWarnings in tests (#1366)
* #1320 Update pytest configuration and tests cleanup

This commit modifies the pytest's configuration file, `pyproject.toml`, to remove filterwarnings settings. It also makes changes in various test files; the Redis isolation test is now using the provided `redis_storage` fixture instead of setting up its own connection, pytest.mark.filterwarnings is no longer used in `test_isolation.py` and `test_aiohttp_session.py` properly closes off sessions.

* Added changelog

* Fixed coverage for the RedisEventIsolation
2023-11-16 02:08:36 +02:00
Oleg A
9a2a72fe97
Add pydantic 2.5 support (#1361)
* chore: add pydantic 2.5 support

* docs: add changelog
2023-11-14 12:35:37 +02:00
JRoot Junior
29d766fef2
#1006 Update parameter description in chat_action.py
The comment describing the 'initial_sleep' parameter in the chat_action.py script has been revised for clarity. It now accurately specifies this parameter's purpose as the waiting period prior to the first sending of the action, rather than just the first iteration.
2023-11-14 02:57:23 +02:00
JRoot Junior
2f1ae0a686
Merge remote-tracking branch 'origin/dev-3.x' into dev-3.x 2023-11-14 02:54:34 +02:00
JRoot Junior
6153b4f805
#1314 Mention that event can be skipped 2023-11-14 02:53:13 +02:00
Egor
7b30caed53
chore(docs): update middleware.rst (#1353)
* Update middleware.rst

* changes
2023-11-14 02:44:04 +02:00
RootShinobi
e76f4c38ad
new improved CallableMixin (#1357)
* optimized CallableMixin

* changes and Sets

* reformatted

* Update CHANGES/1357.misc.rst

Co-authored-by: Oleg A. <t0rr@mail.ru>

---------

Co-authored-by: Oleg A. <t0rr@mail.ru>
2023-11-13 21:04:58 +02:00
Kostiantyn Kriuchkov
9b5e462068
Add current handler to filters, so that flags can be retrieved from it. (#1360)
* Add current handler to filters, so that flags can be retrieved from it.

* run black isort

* add changelog

* Update CHANGES/1360.bugfix.rst

Co-authored-by: Alex Root Junior <jroot.junior@gmail.com>

---------

Co-authored-by: Alex Root Junior <jroot.junior@gmail.com>
2023-11-13 21:03:21 +02:00
Alex Root Junior
228a86afdc
Refresh translation files 2023-10-29 02:32:40 +03:00
Alex Root Junior
a355daba49
Re-generate Bot API 2023-10-29 02:15:50 +03:00
Alex Root Junior
180a7297ff
Update typing-extensions version range in dependencies (#1352)
This commit changes the version requirements for typing-extensions in the dependencies section of pyproject.toml file. This change now requires versions that are greater than or equal to 4.7.0 and less than or equal to 5.0. The previous version, 4.8.0, has been found to cause compatibility issues with some other libraries.
2023-10-28 23:09:30 +03:00
Alex Root Junior
475b1861e5
Update citation 2023-10-27 00:50:21 +03:00
Alex Root Junior
e3def608f1
Add CITATION.cff for automatic academic citation (#1351)
* Add CITATION.cff for automatic academic citation

A `CITATION.cff` file has been added to the project to facilitate the generation of accurate academic citations directly from the GitHub page. This allows users to easily copy the citation and paste it into their academic papers. The file includes the project's information like title, authors, repository code, url, keywords, and license.

* Fixed category name
2023-10-27 00:48:47 +03:00
ZeroN
d8e7801963
Add new FSM strategy CHAT_TOPIC strategy.py (#1344)
* Create 1343.feature.rst

* Add new FSM strategy CHAT_TOPIC strategy.py

* ADD CHAT_TOPIC tests test_strategy.py

* Update 1343.feature.rst

* Update strategy.py

* add typing  user_id: Optional[int] = None, middleware.py

* add typing  user_id: Optional[int] = None  base.py

* Update strategy.py

* Update strategy.py

* Update middleware.py

* Update base.py

* Update test_strategy.py

* Update base.py

* Update strategy.py
2023-10-22 00:41:13 +03:00
Alex Root Junior
3b21262d34
Skip unused ignore 2023-10-21 22:09:46 +03:00
Alex Root Junior
eef277ae65
Ignore uvloop attr-defined 2023-10-21 22:04:10 +03:00
Alex Root Junior
1cf6ce251b
Fixed ruff command 2023-10-21 21:48:22 +03:00
Alex Root Junior
0a9bee4bd2
Bump dependencies 2023-10-21 21:44:52 +03:00
Alex Root Junior
c6c838f689
Update ReadTheDocs configuration (#1345) 2023-10-21 19:31:48 +03:00
VasBrd
98771fdf31
Update base.rst (#1340)
* Update base.rst

Typo correction

* Create 1340.doc.rst
2023-10-18 22:00:25 +03:00
Alex Root Junior
cf3044687a
Update changelog instructions in PR workflow
Updated the instructions for adding changelog entries in the pull_request_changelog.yml workflow file. The changes provide more specific instructions on how to name and write the changelog entry file. This was done to provide clearer instructions to contributors updating the changelog.
2023-10-08 19:22:58 +03:00
Alex Root Junior
a2ed142557
Remove stale texts 2023-10-08 19:15:53 +03:00
Alex Root Junior
d180fd7a46
Update texts, remove dummy translation files 2023-10-08 19:14:12 +03:00
Suren Khorenyan
564292dd79
Fix send_copy helper parse mode (#1332)
* Fix send_copy helper parse mode

* Add changelog for bugfix 1332
2023-10-08 18:56:30 +03:00