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.
This commit is contained in:
JRoot Junior 2024-04-22 23:37:34 +03:00
parent 9756dac877
commit b2b2fcff70
No known key found for this signature in database
GPG key ID: 738964250D5FF6E2
4 changed files with 71 additions and 0 deletions

View file

@ -5,6 +5,15 @@ Simple usage
.. literalinclude:: ../examples/echo_bot.py
Usage without dispatcher
------------------------
Just only interact with Bot API, without handling events
.. literalinclude:: ../examples/without_dispatcher.py
Contents
========