Commit graph

312 commits

Author SHA1 Message Date
chiri
4531c3628c
[docs] fix typo (#1599) 2024-10-27 20:03:21 +02:00
Alex Root Junior
51beb48257
Enabled tests on Python 3.13, disabled on Python 3.8 (#1589)
* Try to enable tests on Python 3.13

* Remove support for Python 3.8 and PyPy 3.8

Dropped Python 3.8 and PyPy 3.8 from the CI workflow and updated the minimum required Python version to 3.9 in pyproject.toml. Also updated dependencies and tools to align with the new minimum Python version.

* Added changelog

* Reformat code

* Bump mypy python version
2024-10-19 14:55:38 +03:00
Alex Root Junior
1dbdcf0516
Improved Scene handler and action inheritance mechanism (#1585)
* #1583 Improved Scene handler and action inheritance mechanism

Enhanced the inheritance of handlers and actions in scenes. Refactored to eliminate the copying of previously connected handlers and actions from parent scenes. Now, handlers are dynamically rebuilt based on the current class, properly utilizing class inheritance and enabling handler overrides.

* Added more tests

* Added more tests for non-function handlers
2024-10-06 16:37:18 +03:00
Carl Smedstad
080878be86
Fix pytest-asyncio deprecation warning in test (#1584)
Introduced in pytest-asyncio in:
https://github.com/pytest-dev/pytest-asyncio/pull/648
2024-09-28 01:33:14 +03:00
JRoot Junior
718910f5b5
Release version 3.13.1
Add new version details to CHANGES.rst and update __meta__.py. Removed individual CHANGES/* feature and bugfix files, merging their content into the main CHANGES.rst.
2024-09-18 22:55:32 +03:00
Alex Root Junior
f9f847f603
#1579 Fixed Default object annotation resolution in pydantic models. (#1580)
* #1579 Fixed `Default` object annotation resolution in `pydantic` models. Reformat code.

* Bump mongo and Redis dependencies

* Update pydantic version constraints based on Python version

Adjusted the version constraints for the pydantic library in `pyproject.toml` to ensure compatibility with different Python versions. This helps maintain stability and compatibility across various development environments.

* Adjust version

* Fixed typo
2024-09-18 22:45:19 +03:00
monosans
a76fb42ba0
Bump aiofiles version upper bound to <24.2 (#1577)
* Bump aiofiles version upper bound to <24.2

* Add changelog
2024-09-10 23:40:07 +03:00
Andrew
7297ffa16e
Increase pydantic max version (<2.9 -> <2.10) (#1576)
* Increase `pydantic` max version (2.10)

* Add changes file
2024-09-09 20:05:01 +03:00
JRoot Junior
d9419ba690
Bump version 2024-09-08 14:06:45 +03:00
Kostiantyn Kriuchkov
386fc44a98
Feature/aliases inaccessible message (#1575)
* feature: add aliases for InaccessibleMessage type

* add changelog

* fix changelog

* remove methods that may not be accessible for the InaccessibleMessage type, add tests

* apply black isort

* update docs with InaccessibleMessage aliases
2024-09-08 14:00:07 +03:00
Alex Root Junior
e8fc890809
Bot API 7.10 (#1570)
* Bump to the latest schema

* Added full support ob Bot API 7.10

* Add support for purchased paid media events

Enhanced the router to include `purchased_paid_media` handling. Added corresponding test cases to verify the new functionality and updated middleware to return the appropriate `EventContext`.

* Added changelog
2024-09-08 04:01:18 +03:00
Alex Root Junior
627ee09928
Fixed link preview options to use global defaults in some types and methods (#1563)
* #1543 Fixed link preview options to use global defaults

Refactor various classes to use global defaults for `link_preview_options`. This change ensures consistency and enhances flexibility in handling link preview options across different components.

* Added changelog
2024-08-17 16:41:52 +03:00
JRoot Junior
6aba60155c
Bump version 2024-08-16 00:46:41 +03:00
Alex Root Junior
c3a08664d3
Added full support of Bot API 7.9 (#1560)
* Added full support of Bot API 7.9

* Added changelog

* Try to fix towncrier

* Fixed towncrier check
2024-08-16 00:44:40 +03:00
Desiders
1c323ecc97
Add getting user from chat_boost (#1474)
* Add getting user from `chat_boost`

* Update import

* Add changelog

* Add test for `resolve_event_context`

* Lint changes

* Parametrize test
2024-08-14 02:12:39 +03:00
Robotvasya
e2e1bc5573
Added message_thread_id to url of chats with topics for message.get_u… (#1469)
* Added message_thread_id to url of chats with topics for message.get_url() (#1451)

* Added tests for message.get_url()

* Added tests for message.get_url()

* Changed tests for message.get_url()
2024-08-14 02:11:58 +03:00
Oleg A.
9b0b6a68ed
Precalculate StateGroup values (#1507)
* Precalculate StateGroup values

* Changelog added

* Remove redundant overrides

* Refactor children preparing

* Refactor mcs fn visibility

* Refactor mcs fn visibility (fix)
2024-08-14 02:10:31 +03:00
JRoot Junior
60f93b3b46
Bump version 2024-08-09 20:16:28 +03:00
Alex Root Junior
cf3a6c3d59
Added full support of Bot API 7.8 (#1551)
* Added full support of Bot API 7.8

* Added changelog

* Try to fix tests on Windows

* scope=session?

* Try another way

* Just try to set custom event loop policy manually

* Revert "Just try to set custom event loop policy manually"

This reverts commit 04ee60d878.

* Just try to set custom event loop policy manually
2024-08-09 19:10:39 +03:00
Oleg A.
3ba724e2fa
Added aiohttp 3.10 support (#1548)
* added aiohttp 3.10 support

* added changelog
2024-08-01 01:37:24 +03:00
Bogdan
2516f32168
Fix web_app example (#1546)
* Fix url in button

* Fixed URL path in the "Open" button at the `demo/sendMessage` endpoint

* Fix web_app example

* Add changelog

* Restore old changelog
2024-07-27 16:21:45 +03:00
Alex Root Junior
ac96f0d233
Added 'as_reply_parameters' method & integrate with message reply methods (#1539)
* Added 'as_reply_parameters' method & integrate with message reply methods

The 'as_reply_parameters' method is added to generate reply parameters in a message. This method was used in reply methods.

* Added changelog
2024-07-13 04:03:49 +03:00
JRoot Junior
7807981252
Bump version 2024-07-07 15:55:14 +03:00
Alex Root Junior
4ddc320e21
Added full support of Bot API 7.7 (#1536)
* Added full support of Bot API 7.7

* Added changes description
2024-07-07 15:46:17 +03:00
JRoot Junior
ad28ce9689
Bump version 2024-07-06 20:54:30 +03:00
Alex Root Junior
7f47609585
#1520 Fixed event context resolving for the callback query (#1521)
* #1520 Fixed event context resolving for the callback query that is coming from the business account

* Simplify some conditions

* Added changelog

* Fixed AttributeError
2024-07-06 20:46:45 +03:00
Oleg A
46e033e6da
Add chat member tools (#1527)
* feat: add ChatMemberAdapter

* chore: apply formatter

* docs: added changelog

* docs: rm redundant import

* feat: add pre-defined groups
2024-07-06 20:34:07 +03:00
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
JRoot Junior
cad9b3ba76
Towncrier render 2024-06-19 01:10:33 +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
Alex Root Junior
dcfc9632f3
Add DNS cache ttl setting to aiohttp session. (#1514)
* Add DNS cache ttl setting to aiohttp session.
Also the limit argument is added to the session initializer.

This commit adds a setting for DNS cache ttl (time-to-live) to the aiohttp session configuration. This is implemented as a workaround for a known issue in aiogram as exhibited in aiogram/aiogram#1500.

* Added changelog
2024-06-17 02:51:35 +03:00
JRoot Junior
835813ca2e
Update chagenlog 2024-06-17 01:06:48 +03:00
Rishat-F
1df3adaba1
Fail redis and mongo tests if incorrect URI provided + some storages tests refactoring (#1510)
* Smaller timeout for MongoStorage connection

By default serverSelectionTimeoutMS=30000. This is too much

* Correct ConnectionError for RedisStorage in tests

* Remove unused import in conftest.py

* Refactor skipping redis and mongo tests

* Fail redis and mongo tests if incorrect URI

If incorrect URIs provided to "--redis" and/or "--mongo" options
tests should fail with ERRORs instead of skipping.
Otherwise the next scenario is possible:
  1) developer breaks RedisStorage and/or MongoStorage code
  2) tests are run with incorrect redis and/or mongo URIs
     provided by "--redis" and "--mongo" options.
     For example, wrong port specified.
  3) tests pass because skipping doesn't fail tests run
  4) developer or reviewer doesn't notice
     that redis and/or mongo tests were skipped
  5) broken code gets in codebase

* Remove unused fixtures passing in storages tests

* Define create_storage_key fixture in conftest.py

* Linters formatting

* Changes description

* Revert "Smaller timeout for MongoStorage connection"

This reverts commit d88b7ec612.

* Smaller timeout for MongoStorage connection in tests

The default 30s timeout is too long

* Add test for MongoStorage for 100% coverage

* Linters formatting

* Move skipping redis/mongo tests in earlier fixtures

* Replace vars with constants in conftest.py

* Linters formatting
2024-06-17 00:55:59 +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
afd1e6da74
Added MongoDB dependency to ReadTheDocs configuration (#1502)
* Add MongoDB dependency to ReadTheDocs configuration

An update has been made to the ReadTheDocs configuration file to include MongoDB as an additional dependency on installation. This change addresses issues with the MongoStorage section in the documentation.

* Rename changelog file
2024-06-01 01:56:38 +03:00
JRoot Junior
e224bb162d
Bump changelog and API version 2024-05-31 20:22:51 +03:00
sdmway
e3dc7d576b
misc: code consistency and bot instance creation (#1482)
* misc: code consistency and bot instance creation

* Changelog for aiogram#1482

* misc: consistency of comments and dispatcher instance creation

* misc: removed routers example

* Update CHANGES/1482.misc.rst

---------

Co-authored-by: Alex Root Junior <jroot.junior@gmail.com>
2024-05-31 20:11:21 +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
Alexey Berezin
f50e058725
Fixed bug with wrong MarkdownV2 custom emoji parsing (#1497)
* fixed bug with wrong markdownv2 custom emoji parsing

* added changelog of 1496 issue

* Update CHANGES/1496.bugfix.rst

---------

Co-authored-by: Alex Root Junior <jroot.junior@gmail.com>
2024-05-30 20:58:51 +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
JRoot Junior
25c76b7d74
Bump docs 2024-05-07 00:02: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
JRoot Junior
6ad287c329
Bump changelog 2024-04-24 22:14:34 +03:00
unintended
f1c9fc50f0
Fix missing error logging (#1458)
* Fix missing error logging 

No error logging when handle_in_background=True

* add CHANGES
2024-04-23 13:59:13 +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
Joren Hammudoglu
9756dac877
loosened pydantic upper bound to <2.8 (#1460)
* bump pydantic to 2.8

* add changelog entry for #1460
2024-04-22 13:49:34 +03:00