Merge branch 'dev-3.x'

This commit is contained in:
JRoot Junior 2026-01-02 02:55:22 +02:00
commit b01b2ed8fc
No known key found for this signature in database
GPG key ID: 738964250D5FF6E2
409 changed files with 12336 additions and 6862 deletions

View file

@ -2,7 +2,7 @@
editMessageCaption
##################
Returns: :obj:`Union[Message, bool]`
Returns: :obj:`Message | bool`
.. automodule:: aiogram.methods.edit_message_caption
:members:
@ -19,7 +19,7 @@ As bot method
.. code-block::
result: Union[Message, bool] = await bot.edit_message_caption(...)
result: Message | bool = await bot.edit_message_caption(...)
Method as object
@ -35,7 +35,7 @@ With specific bot
.. code-block:: python
result: Union[Message, bool] = await bot(EditMessageCaption(...))
result: Message | bool = await bot(EditMessageCaption(...))
As reply into Webhook in handler
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

View file

@ -2,7 +2,7 @@
editMessageLiveLocation
#######################
Returns: :obj:`Union[Message, bool]`
Returns: :obj:`Message | bool`
.. automodule:: aiogram.methods.edit_message_live_location
:members:
@ -19,7 +19,7 @@ As bot method
.. code-block::
result: Union[Message, bool] = await bot.edit_message_live_location(...)
result: Message | bool = await bot.edit_message_live_location(...)
Method as object
@ -35,7 +35,7 @@ With specific bot
.. code-block:: python
result: Union[Message, bool] = await bot(EditMessageLiveLocation(...))
result: Message | bool = await bot(EditMessageLiveLocation(...))
As reply into Webhook in handler
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

View file

@ -2,7 +2,7 @@
editMessageMedia
################
Returns: :obj:`Union[Message, bool]`
Returns: :obj:`Message | bool`
.. automodule:: aiogram.methods.edit_message_media
:members:
@ -19,7 +19,7 @@ As bot method
.. code-block::
result: Union[Message, bool] = await bot.edit_message_media(...)
result: Message | bool = await bot.edit_message_media(...)
Method as object
@ -35,7 +35,7 @@ With specific bot
.. code-block:: python
result: Union[Message, bool] = await bot(EditMessageMedia(...))
result: Message | bool = await bot(EditMessageMedia(...))
As reply into Webhook in handler
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

View file

@ -2,7 +2,7 @@
editMessageReplyMarkup
######################
Returns: :obj:`Union[Message, bool]`
Returns: :obj:`Message | bool`
.. automodule:: aiogram.methods.edit_message_reply_markup
:members:
@ -19,7 +19,7 @@ As bot method
.. code-block::
result: Union[Message, bool] = await bot.edit_message_reply_markup(...)
result: Message | bool = await bot.edit_message_reply_markup(...)
Method as object
@ -35,7 +35,7 @@ With specific bot
.. code-block:: python
result: Union[Message, bool] = await bot(EditMessageReplyMarkup(...))
result: Message | bool = await bot(EditMessageReplyMarkup(...))
As reply into Webhook in handler
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

View file

@ -2,7 +2,7 @@
editMessageText
###############
Returns: :obj:`Union[Message, bool]`
Returns: :obj:`Message | bool`
.. automodule:: aiogram.methods.edit_message_text
:members:
@ -19,7 +19,7 @@ As bot method
.. code-block::
result: Union[Message, bool] = await bot.edit_message_text(...)
result: Message | bool = await bot.edit_message_text(...)
Method as object
@ -35,7 +35,7 @@ With specific bot
.. code-block:: python
result: Union[Message, bool] = await bot(EditMessageText(...))
result: Message | bool = await bot(EditMessageText(...))
As reply into Webhook in handler
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

View file

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

View file

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

View file

@ -68,6 +68,7 @@ Available methods
get_business_connection
get_chat
get_chat_administrators
get_chat_gifts
get_chat_member
get_chat_member_count
get_chat_menu_button
@ -80,6 +81,7 @@ Available methods
get_my_name
get_my_short_description
get_user_chat_boosts
get_user_gifts
get_user_profile_photos
gift_premium_subscription
hide_general_forum_topic
@ -94,6 +96,7 @@ Available methods
remove_user_verification
reopen_forum_topic
reopen_general_forum_topic
repost_story
restrict_chat_member
revoke_chat_invite_link
send_animation
@ -107,6 +110,7 @@ Available methods
send_location
send_media_group
send_message
send_message_draft
send_paid_media
send_photo
send_poll

View file

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

View file

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

View file

@ -2,7 +2,7 @@
setGameScore
############
Returns: :obj:`Union[Message, bool]`
Returns: :obj:`Message | bool`
.. automodule:: aiogram.methods.set_game_score
:members:
@ -19,7 +19,7 @@ As bot method
.. code-block::
result: Union[Message, bool] = await bot.set_game_score(...)
result: Message | bool = await bot.set_game_score(...)
Method as object
@ -35,7 +35,7 @@ With specific bot
.. code-block:: python
result: Union[Message, bool] = await bot(SetGameScore(...))
result: Message | bool = await bot(SetGameScore(...))
As reply into Webhook in handler
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

View file

@ -2,7 +2,7 @@
stopMessageLiveLocation
#######################
Returns: :obj:`Union[Message, bool]`
Returns: :obj:`Message | bool`
.. automodule:: aiogram.methods.stop_message_live_location
:members:
@ -19,7 +19,7 @@ As bot method
.. code-block::
result: Union[Message, bool] = await bot.stop_message_live_location(...)
result: Message | bool = await bot.stop_message_live_location(...)
Method as object
@ -35,7 +35,7 @@ With specific bot
.. code-block:: python
result: Union[Message, bool] = await bot(StopMessageLiveLocation(...))
result: Message | bool = await bot(StopMessageLiveLocation(...))
As reply into Webhook in handler
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

View file

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

View file

@ -91,6 +91,7 @@ Available types
general_forum_topic_hidden
general_forum_topic_unhidden
gift
gift_background
gift_info
gifts
giveaway
@ -192,12 +193,14 @@ Available types
unique_gift
unique_gift_backdrop
unique_gift_backdrop_colors
unique_gift_colors
unique_gift_info
unique_gift_model
unique_gift_symbol
user
user_chat_boosts
user_profile_photos
user_rating
user_shared
users_shared
venue

View file

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

View file

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

View file

@ -88,6 +88,88 @@ Windows:
It will install :code:`aiogram` in editable mode into your virtual environment and all dependencies.
Alternative: Using uv (Modern Approach)
----------------------------------------
As an alternative to the traditional :code:`pip` and :code:`venv` workflow, you can use `uv <https://github.com/astral-sh/uv>`_ -
a modern, fast Python package manager that handles virtual environments, dependency resolution, and package installation.
**Benefits of using uv:**
- 10-100x faster dependency resolution than pip
- Automatic virtual environment management
- Reproducible builds with lockfile
- Single tool for all package management needs
**Installing uv:**
Linux / macOS:
.. code-block:: bash
curl -LsSf https://astral.sh/uv/install.sh | sh
Windows:
.. code-block:: powershell
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
Or using pip:
.. code-block:: bash
pip install uv
**Setup project with uv:**
Instead of manually creating and activating a virtual environment, :code:`uv` handles this automatically:
.. code-block:: bash
# Clone the repository
git clone https://github.com/aiogram/aiogram.git
cd aiogram
# Install all dependencies (creates .venv automatically)
uv sync --all-extras --group dev --group test
# Install pre-commit hooks
uv run pre-commit install
That's it! The :code:`uv sync` command creates a virtual environment in :code:`.venv/`,
installs all dependencies including optional extras and development tools, and generates
a :code:`uv.lock` file for reproducible builds.
**Running commands with uv:**
When using :code:`uv`, prefix commands with :code:`uv run` to execute them in the managed environment:
.. code-block:: bash
# Format code
uv run black aiogram tests examples
uv run isort aiogram tests examples
# Run tests
uv run pytest tests
# Run linting
uv run ruff check aiogram examples
uv run mypy aiogram
# Start documentation server
uv run sphinx-autobuild --watch aiogram/ docs/ docs/_build/
Or use the Makefile commands which now support :code:`uv`:
.. code-block:: bash
make install # Uses uv sync
make lint # Uses uv run
make reformat # Uses uv run
make test # Uses uv run
Making changes in code
----------------------
@ -101,38 +183,89 @@ 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:
Using traditional approach:
.. code-block:: bash
black aiogram tests examples
isort aiogram tests examples
Or with uv:
.. code-block:: bash
uv run black aiogram tests examples
uv run isort aiogram tests examples
Or simply use Makefile:
.. code-block:: bash
make reformat
Run tests
---------
All changes should be tested:
Using traditional approach:
.. code-block:: bash
pytest tests
Or with uv:
.. code-block:: bash
uv run pytest tests
Or use Makefile:
.. code-block:: bash
make test
Also if you are doing something with Redis-storage or/and MongoDB-storage,
you will need to test everything works with Redis or/and MongoDB:
Using traditional approach:
.. code-block:: bash
pytest --redis redis://<host>:<port>/<db> --mongo mongodb://<user>:<password>@<host>:<port> tests
Or with uv:
.. code-block:: bash
uv run pytest --redis redis://<host>:<port>/<db> --mongo mongodb://<user>:<password>@<host>:<port> tests
Docs
----
We are using `Sphinx` to render docs in different languages, all sources located in `docs` directory,
you can change the sources and to test it you can start live-preview server and look what you are doing:
Using traditional approach:
.. code-block:: bash
sphinx-autobuild --watch aiogram/ docs/ docs/_build/
Or with uv:
.. code-block:: bash
uv run --extra docs sphinx-autobuild --watch aiogram/ docs/ docs/_build/
Or use Makefile:
.. code-block:: bash
make docs-serve
Docs translations
-----------------
@ -143,12 +276,27 @@ into different languages.
Before start, let's up to date all texts:
Using traditional approach:
.. code-block:: bash
cd docs
make gettext
sphinx-intl update -p _build/gettext -l <language_code>
Or with uv:
.. code-block:: bash
uv run --extra docs bash -c 'cd docs && make gettext'
uv run --extra docs bash -c 'cd docs && sphinx-intl update -p _build/gettext -l <language_code>'
Or use Makefile:
.. code-block:: bash
make docs-gettext
Change the :code:`<language_code>` in example below to the target language code, after that
you can modify texts inside :code:`docs/locale/<language_code>/LC_MESSAGES` as :code:`*.po` files
by using any text-editor or specialized utilites for GNU Gettext,
@ -156,10 +304,18 @@ for example via `poedit <https://poedit.net/>`_.
To view results:
Using traditional approach:
.. code-block:: bash
sphinx-autobuild --watch aiogram/ docs/ docs/_build/ -D language=<language_code>
Or with uv:
.. code-block:: bash
uv run --extra docs sphinx-autobuild --watch aiogram/ docs/ docs/_build/ -D language=<language_code>
Describe changes
----------------

View file

@ -32,4 +32,3 @@ msgid ""
msgstr ""
"Джерело: "
"https://github.com/telegramdesktop/tdesktop/blob/991fe491c5ae62705d77aa8fdd44a79caf639c45/Telegram/SourceFiles/data/data_forum_topic.cpp#L51-L56"

View file

@ -103,4 +103,3 @@ msgstr ""
#: ../../api/methods/set_chat_permissions.rst:50
msgid ":meth:`aiogram.types.chat.Chat.set_permissions`"
msgstr ""

View file

@ -195,4 +195,3 @@ msgstr ""
"Альтернативним способом є об’єднання за допомогою спеціальних функцій "
"(:func:`and_f`, :func:`or_f`, :func:`invert_f` з модуля "
":code:`aiogram.filters`):"

View file

@ -106,4 +106,3 @@ msgid ""
msgstr ""
"Передача події обробнику подій(handler) та зупинка при першому ж збігу. "
"Обробник(handler) буде викликало, коли всі його фільтри пройдено."

View file

@ -202,4 +202,3 @@ msgstr ""
#: aiogram.utils.callback_answer.CallbackAnswer.cache_time:1 of
msgid "Response cache time"
msgstr ""

View file

@ -288,4 +288,3 @@ msgstr ""
#: aiogram.utils.media_group.MediaGroupBuilder.build:5 of
msgid "List of media objects."
msgstr ""