Commit graph

312 commits

Author SHA1 Message Date
Alex Root Junior
11efa8e186
Added full support of Bot API 7.6 (#1533)
* Added full support of Bot API 7.6

* Fixed imports

* fix tests (#1534)

* Fixed coverage

* Override InputPaidMedia media type to `str | InputFile`

* Added shortcut

* Fixed PaidMediaType enum

* Added changelog

---------

Co-authored-by: Oleg A <t0rr@mail.ru>
2024-07-06 20:31:49 +03:00
request3301
3baa7383c1
Corrected typo (#1519)
* typo in scene.rst

* Create 1519.doc.rst
2024-06-19 21:07:58 +03:00
Alex Root Junior
1888039cee
Add serialization utilities and update documentation (#1515)
* Add serialization utilities and update documentation

Introduced utilities to deserialize Telegram objects to JSON-compliant Python objects and vice versa. These utilities manage both cases with and without files. The documentation has been updated to reflect these changes, including updates in migration recommendations and tutorials. A new unit test is added to verify the new functionality.

* Fixed Must-die implementation of the datetime serialization

* Fixed `TypeError: can't subtract offset-naive and offset-aware datetimes`
2024-06-19 00:54:36 +03:00
Alex Root Junior
1f7bbeb355
Added full support of Bot API 7.5 (#1518)
* Added full support of Bot API 7.5

* Added changelog

* Update date type in RevenueWithdrawalStateSucceeded

* Added example
2024-06-19 00:54:22 +03:00
beliboba
f568ef09e8
InputFile reuse recommendations update (#1506)
* Update upload_file.rst

who the fuck even wrote this

* Update docs/api/upload_file.rst

Co-authored-by: Yana Malenko <107151775+akchonya@users.noreply.github.com>

---------

Co-authored-by: Alex Root Junior <jroot.junior@gmail.com>
Co-authored-by: Yana Malenko <107151775+akchonya@users.noreply.github.com>
2024-06-17 00:57:28 +03:00
Oleg A
69c359d23a
Add Dependencies to migrations guide (#1504)
* Add Dependencies to migrations guide

* Added changelog
2024-06-07 18:52:02 +03:00
Alex Root Junior
b08ba78898
Added full support of Bot API 7.4 (#1498)
* Added full support of Bot API 7.4

* Added changelog
2024-05-31 20:07:11 +03:00
Alex Root Junior
b5d94f17b5
Removed deprecated arguments from Bot class (#1494)
* Remove deprecated attributes from Bot class

The deprecated attributes `parse_mode`, `disable_web_page_preview`, and `protect_content` have been removed from the Bot class. Additionally, the associated warnings and test cases have been deleted. These attributes should now be passed using the `default=DefaultBotProperties(...)` syntax instead.

* Added docs and changelog
2024-05-27 14:58:39 +03:00
Rishat-F
1ef7655fd7
Added MongoStorage for FSM (#1434)
* Mongo storage included to storages test

* Added few additional checks in storages test

* Added MongoStorage for FSM

* Added changes description

* Fixed error message syntax

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

* Resolved mypy check error

* IF/ELSE statement simplified

* Fix ruff linter error: RET505 Unnecessary `elif` after `return` statement

* Fix ruff linter error: E501 Line too long (100 > 99)

* Added mongo storage testing in CI

* Refactoring while review

* Refactoring while review

* Storing FSM state and data together in MongoDB-storage

* Fix CI - MongoDB container action is only supported on Linux

* Refactoring while review

* Enable Macos in pypy-tests section of CI

* Refactoring while review

* Makefile updated

* redis and mongo storages tests do not run in pypy-tests job of CI

* Fix docstring of DefaultKeyBuilder

---------

Co-authored-by: Alex Root Junior <jroot.junior@gmail.com>
2024-05-07 22:42:31 +03:00
DaniilKosvintsev
f45863a0b9
Added message serialisation and deserialization block in 2.x -> 3.x migration guide (#1479)
* Added message serialisation and deserialization block in 2.x -> 3.x migration guide

* fixed docs, added to_python() pydantic alternative

* fixed docs, added examples

---------

Co-authored-by: DanZ-ix <vpupkin@company.com>
2024-05-06 23:28:38 +03:00
Alex Root Junior
cf2980a9c1
Full support of Bot API 7.3 (#1480)
* Added full support of Bot API

* Added full support of Bot API

* Fixed tests

* Added changelog

* Bump version
2024-05-06 23:27:54 +03:00
sdmway
6d655330af
docs: Correct a typo error (#1473) 2024-04-30 23:35:56 +03:00
Alexey Leshchenko
849482da1f
Update command.rst (#1470)
Fix rendition of the backslash in regular expressions
2024-04-24 22:38:26 +03:00
Alex Root Junior
4729978c60
Add context manager support for bot client (#1468)
* Add context manager support for bot client

The bot client now supports the context manager protocol, providing automatic resource management. This enhancement helps to automatically close the session when leaving the context, which cleans up resources better. The documentation and tests have been updated accordingly to illustrate this new feature. Moreover, an example of usage without a dispatcher has been provided to clarify its use in simple cases.

* Added changelog
2024-04-22 23:42:47 +03:00
Alex Root Junior
057478621b
Added full support of Bot API 7.2 (#1444)
* Added base support of Bot API 7.2

* Added base support of Bot API 7.2

* Fixing tests and content types for Telegram Bot API 7.2 update (#1453)

* Fixing tests and content types for Telegram Bot API 7.2

* Adding changelog for 1453 PR

* Fixes + coverage

* Replace `BusinessConnection.date` type

* Reformat code

* Refactor UserContextMiddleware to use EventContext class

This update significantly refactors UserContextMiddleware to leverage a new class, EventContext. Instead of resolving event context as a tuple, it now produces an instance of EventContext. Additional adjustments include supporting a business connection ID for event context identification and facilitating backwards compatibility. Tests and other files were also updated accordingly for these changes.

* Cover FSM key builder (business_connection_id

* Added changelog

---------

Co-authored-by: RoLOQ <roman.fedunn@gmail.com>
2024-04-22 13:48:49 +03:00
avoidaway
acf52f468c
chore: remove repetitive words (#1438)
Signed-off-by: avoidaway <cmoman@126.com>
2024-03-17 02:20:29 +02:00
Leroy-bit
a2e75e5345
doc updated for WebApp (#1433)
Added WebAppChat class to WebApp docs, updated uk_UA localisation of WebApp docs.
2024-03-06 01:37:37 +02:00
Alex Root Junior
75323ac8c3
Added full support of Bot API 7.1 (#1417)
* Added full support of Bot API 7.1

* Added changelog
2024-02-16 23:44:35 +02:00
JRoot Junior
e5176b4434
Update docs translation files 2024-02-16 01:17:09 +02:00
Robotvasya
298e9821a4
Add notion Working with plural forms in documentation (#1409) 2024-02-09 21:30:02 +02:00
JRoot Junior
091b82e13f
Change magic filter examples 2024-02-09 21:27:21 +02:00
JRoot Junior
f7af9e7f4a
Fixed deep linking URL 2024-02-04 01:49:39 +02:00
Alex Root Junior
d3c63797b0
Add KeyboardButtonPollTypeType enum (#1398)
* Add KeyboardButtonPollTypeType enum

A new enum, KeyboardButtonPollType, has been added and documented. This enum holds types of polls that can be created and sent when the corresponding button is pressed. It is now imported and included in the aiogram enums documentation.

* Added changelog
2024-01-27 18:04:05 +02:00
JRoot Junior
1281bf551a
Describe new event observers in the docs 2023-12-31 15:21:41 +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
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
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
9bced29923
Update translation files 2023-11-16 02:34:57 +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
Alex Root Junior
228a86afdc
Refresh translation files 2023-10-29 02:32:40 +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
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
Kostiantyn Kriuchkov
b5ef05c01a
Corrected grammatical errors, improved sentence structures, translation for migration 2.x-3.x (#1302)
* Corrected grammatical errors, improved sentence structures for clarity, added translation to migration_2_to_3.rst

* add changelog

* Update method name in docs for error handling

* Update migration_2_to_3.rst

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

* Update migration_2_to_3.rst

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

* Update migration_2_to_3.rst

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

* Update docs/locale/uk_UA/LC_MESSAGES/api/methods/set_sticker_set_thumb.po

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

* rollback unnecessary change for error attribute

---------

Co-authored-by: Oleg A. <t0rr@mail.ru>
2023-10-01 15:29:18 +03:00
fulsiram
890a57cd15
Fix broken link in message.rst (#1325) 2023-09-29 11:04:42 +03:00
Oleg A
c229cf8c7b
Updated migration guide with API server (#1299)
* docs: updated migration guide with API server

* Update docs/migration_2_to_3.rst

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

---------

Co-authored-by: Alex Root Junior <jroot.junior@gmail.com>
2023-09-11 00:34:02 +03:00
Alex Root Junior
69c2e1282f
Update filtering docs page 2023-09-10 22:42:32 +03:00
Alex Root Junior
28cc2384e8
Fixed typo 2023-09-07 22:44:05 +03:00
Alex Root Junior
5cf8d7b565
Add MediaGroupBuilder for media group construction (#1293)
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
2023-09-03 00:25:31 +03:00
Alex Root Junior
e1be9dd668
Fix Message.send_copy method for stories (#1287)
* 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
2023-08-28 22:32:11 +03:00
Alex Root Junior
ca4c1b4b95
Small documentation improvements and texts update 2023-08-26 23:18:20 +03:00
Alex Root Junior
678b3cfe7d
Bot API 6.8 (#1276)
* Prepare for Bot API 6.8

* Bump after public release

* Bump version, added changelog
2023-08-18 20:18:05 +03:00
Oleg A
5a14098803
Add contributing support for zsh and win (#1272)
* fix: add support for zsh and win

* docs: add both install commands (win,lin,mac)

* fix: some typos

* docs: update win cmd examples
2023-08-18 12:06:13 +03:00