Merge branch 'dev-3.x'

This commit is contained in:
JRoot Junior 2026-02-10 23:47:33 +02:00
commit 860dd5cab8
No known key found for this signature in database
GPG key ID: 738964250D5FF6E2
281 changed files with 2741 additions and 1029 deletions

View file

@ -0,0 +1,9 @@
###########
ButtonStyle
###########
.. automodule:: aiogram.enums.button_style
:members:
:member-order: bysource
:undoc-members: True

View file

@ -11,6 +11,7 @@ Here is list of all available enums:
:maxdepth: 1
bot_command_scope_type
button_style
chat_action
chat_boost_source_type
chat_member_status

View file

@ -0,0 +1,38 @@
####################
getUserProfileAudios
####################
Returns: :obj:`UserProfileAudios`
.. automodule:: aiogram.methods.get_user_profile_audios
:members:
:member-order: bysource
:undoc-members: True
:exclude-members: model_config,model_fields
Usage
=====
As bot method
-------------
.. code-block::
result: UserProfileAudios = await bot.get_user_profile_audios(...)
Method as object
----------------
Imports:
- :code:`from aiogram.methods.get_user_profile_audios import GetUserProfileAudios`
- alias: :code:`from aiogram.methods import GetUserProfileAudios`
With specific bot
~~~~~~~~~~~~~~~~~
.. code-block:: python
result: UserProfileAudios = await bot(GetUserProfileAudios(...))

View file

@ -82,6 +82,7 @@ Available methods
get_my_short_description
get_user_chat_boosts
get_user_gifts
get_user_profile_audios
get_user_profile_photos
gift_premium_subscription
hide_general_forum_topic
@ -93,6 +94,7 @@ Available methods
read_business_message
remove_business_account_profile_photo
remove_chat_verification
remove_my_profile_photo
remove_user_verification
reopen_forum_topic
reopen_general_forum_topic
@ -135,6 +137,7 @@ Available methods
set_my_default_administrator_rights
set_my_description
set_my_name
set_my_profile_photo
set_my_short_description
set_user_emoji_status
transfer_business_account_stars

View file

@ -0,0 +1,45 @@
####################
removeMyProfilePhoto
####################
Returns: :obj:`bool`
.. automodule:: aiogram.methods.remove_my_profile_photo
:members:
:member-order: bysource
:undoc-members: True
:exclude-members: model_config,model_fields
Usage
=====
As bot method
-------------
.. code-block::
result: bool = await bot.remove_my_profile_photo(...)
Method as object
----------------
Imports:
- :code:`from aiogram.methods.remove_my_profile_photo import RemoveMyProfilePhoto`
- alias: :code:`from aiogram.methods import RemoveMyProfilePhoto`
With specific bot
~~~~~~~~~~~~~~~~~
.. code-block:: python
result: bool = await bot(RemoveMyProfilePhoto(...))
As reply into Webhook in handler
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. code-block:: python
return RemoveMyProfilePhoto(...)

View file

@ -0,0 +1,45 @@
#################
setMyProfilePhoto
#################
Returns: :obj:`bool`
.. automodule:: aiogram.methods.set_my_profile_photo
:members:
:member-order: bysource
:undoc-members: True
:exclude-members: model_config,model_fields
Usage
=====
As bot method
-------------
.. code-block::
result: bool = await bot.set_my_profile_photo(...)
Method as object
----------------
Imports:
- :code:`from aiogram.methods.set_my_profile_photo import SetMyProfilePhoto`
- alias: :code:`from aiogram.methods import SetMyProfilePhoto`
With specific bot
~~~~~~~~~~~~~~~~~
.. code-block:: python
result: bool = await bot(SetMyProfilePhoto(...))
As reply into Webhook in handler
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. code-block:: python
return SetMyProfilePhoto(...)

View file

@ -0,0 +1,10 @@
################
ChatOwnerChanged
################
.. automodule:: aiogram.types.chat_owner_changed
:members:
:member-order: bysource
:undoc-members: True
:exclude-members: model_config,model_fields

View file

@ -0,0 +1,10 @@
#############
ChatOwnerLeft
#############
.. automodule:: aiogram.types.chat_owner_left
:members:
:member-order: bysource
:undoc-members: True
:exclude-members: model_config,model_fields

View file

@ -67,6 +67,8 @@ Available types
chat_member_owner
chat_member_restricted
chat_member_updated
chat_owner_changed
chat_owner_left
chat_permissions
chat_photo
chat_shared
@ -199,6 +201,7 @@ Available types
unique_gift_symbol
user
user_chat_boosts
user_profile_audios
user_profile_photos
user_rating
user_shared
@ -210,6 +213,7 @@ Available types
video_chat_scheduled
video_chat_started
video_note
video_quality
voice
web_app_data
web_app_info

View file

@ -0,0 +1,10 @@
#################
UserProfileAudios
#################
.. automodule:: aiogram.types.user_profile_audios
:members:
:member-order: bysource
:undoc-members: True
:exclude-members: model_config,model_fields

View file

@ -0,0 +1,10 @@
############
VideoQuality
############
.. automodule:: aiogram.types.video_quality
:members:
:member-order: bysource
:undoc-members: True
:exclude-members: model_config,model_fields

View file

@ -148,8 +148,8 @@ When using :code:`uv`, prefix commands with :code:`uv run` to execute them in th
.. code-block:: bash
# Format code
uv run black aiogram tests examples
uv run isort aiogram tests examples
uv run ruff format aiogram tests scripts examples
uv run ruff check --fix aiogram tests scripts examples
# Run tests
uv run pytest tests
@ -180,22 +180,22 @@ implementing new features or experimenting.
Format the code (code-style)
----------------------------
Note that this project is Black-formatted, so you should follow that code-style,
too be sure You're correctly doing this let's reformat the code automatically:
Note that this project uses Ruff for formatting and linting, so you should follow that code-style.
To be sure you're correctly doing this, let's reformat the code automatically:
Using traditional approach:
.. code-block:: bash
black aiogram tests examples
isort aiogram tests examples
ruff format aiogram tests scripts examples
ruff check --fix aiogram tests scripts examples
Or with uv:
.. code-block:: bash
uv run black aiogram tests examples
uv run isort aiogram tests examples
uv run ruff format aiogram tests scripts examples
uv run ruff check --fix aiogram tests scripts examples
Or simply use Makefile:

View file

@ -94,9 +94,61 @@ Bot API
However, all errors are classified by HTTP status codes, and for each method,
only one type of error can be associated with a given code.
Therefore, in most cases, you should check only the error type (by status code)
without inspecting the error message.
without inspecting the error message. More details can be found in the
:ref:`exceptions section » <exceptions>`.
Exceptions
==========
Mapping (v2 -> v3)
-------------------
- RetryAfter -> :class:`TelegramRetryAfter` (:mod:`aiogram.exceptions`)
- Important attribute in v3: ``retry_after`` (int).
- ChatMigrated / MigrateToChat -> :class:`TelegramMigrateToChat`
- Important attribute in v3: ``migrate_to_chat_id`` (int).
- ClientDecodeError -> :class:`ClientDecodeError`
- Important attributes in v3: ``original`` (Exception) and ``data`` (response body).
- BadRequest -> :class:`TelegramBadRequest`
- Unauthorized -> :class:`TelegramUnauthorizedError`
- Forbidden -> :class:`TelegramForbiddenError`
- NotFound -> :class:`TelegramNotFound`
- Conflict -> :class:`TelegramConflictError`
- ServerError -> :class:`TelegramServerError`
- NetworkError -> :class:`TelegramNetworkError`
- EntityTooLarge -> :class:`TelegramEntityTooLarge`
Exceptions removed in v3 (from v2)
----------------------------------
The list below contains common exception names that appeared in aiogram v2 but
are not defined as separate classes in the v3 codebase. For each v2 name, a
recommended v3 replacement (or handling) is provided — keep your migration
logic simple and rely on the v3 exception classes and their attributes.
- MessageNotModified -> :class:`TelegramBadRequest`
- MessageToEditNotFound -> :class:`TelegramNotFound`
- MessageToDeleteNotFound -> :class:`TelegramNotFound`
- MessageCantBeDeleted -> :class:`TelegramForbiddenError` / :class:`TelegramBadRequest`
- CantParseEntities -> :class:`TelegramBadRequest`
- MessageIsTooLong -> :class:`TelegramEntityTooLarge`
- MessageIdentifierNotFound -> :class:`TelegramNotFound`
- UserDeactivated -> :class:`TelegramForbiddenError`
- CantInitiateConversation -> :class:`TelegramBadRequest`
- StickerSetNameInvalid -> :class:`TelegramBadRequest`
- ChatAdminRequired -> :class:`TelegramForbiddenError`
Use these replacements when migrating exception handling from v2 to v3. If
you relied on catching very specific v2 exception classes, replace those
handlers with the corresponding v3 class above (or catch a broader v3 class
such as :class:`TelegramBadRequest` / :class:`TelegramAPIError`) and inspect
available attributes (see "Mapping (v2 -> v3)") for any required details.
Middlewares
===========