mirror of
https://github.com/aiogram/aiogram.git
synced 2026-04-08 16:37:47 +00:00
* 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
13 lines
224 B
ReStructuredText
13 lines
224 B
ReStructuredText
Added context manager interface to Bot instance, from now you can use:
|
|
|
|
.. code-block:: python
|
|
|
|
async with Bot(...) as bot:
|
|
...
|
|
|
|
instead of
|
|
|
|
.. code-block:: python
|
|
|
|
async with Bot(...).context():
|
|
...
|