mirror of
https://github.com/python-telegram-bot/python-telegram-bot.git
synced 2026-06-19 15:45:13 +00:00
Compare commits
211 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 0e044804d2 | |||
| 5b9afd5329 | |||
| a983a89964 | |||
| 741a50ab97 | |||
| cf6c298b82 | |||
| 90c0fe948b | |||
| 2c84122654 | |||
| 143db5fc9d | |||
| c28ad86214 | |||
| 15f153474a | |||
| 55d66a9ea3 | |||
| 14c86daf23 | |||
| 460aaf8bb6 | |||
| 1e703a0be5 | |||
| 142e3c0177 | |||
| d4b7a2b3e9 | |||
| dac6d03666 | |||
| 3bfd58dfd9 | |||
| 2d6459b290 | |||
| 1f0f6a8d3d | |||
| 2ecb8d5413 | |||
| f1d03393de | |||
| df07148e2d | |||
| 2d2cede442 | |||
| 08e223ba90 | |||
| 01d643913e | |||
| 755945172d | |||
| 24b4de9f10 | |||
| 76bfe8ceff | |||
| b498786d7c | |||
| bfe30048e8 | |||
| e25c523b69 | |||
| 67e7468366 | |||
| 11007c1715 | |||
| d6e95f1974 | |||
| de28f177bd | |||
| 63104ac0b3 | |||
| 22419c0464 | |||
| 42276338b1 | |||
| 5f547f3725 | |||
| 8e7220e5db | |||
| 977d56ab43 | |||
| 306cc64170 | |||
| 42955ecddf | |||
| 67869693a7 | |||
| 6ded9cc25c | |||
| 5e0bcfbcc6 | |||
| a17a4c6c8f | |||
| dc13b69dac | |||
| 349baa0202 | |||
| 5e24765bbc | |||
| e10d933fde | |||
| 2175af6abc | |||
| ca4e4c6280 | |||
| d2cabcaa74 | |||
| 076955d04d | |||
| c1041655f6 | |||
| 298c5fab3b | |||
| 3013870c1f | |||
| 5e924014de | |||
| f792102212 | |||
| 72e357a780 | |||
| 72c3eb857b | |||
| 1f7efe4519 | |||
| e47d18c9ec | |||
| 65bbea780a | |||
| 23ed0880d2 | |||
| a299867b1b | |||
| be8f4f7aad | |||
| ea8089ad3e | |||
| d917404de1 | |||
| 95d6272d20 | |||
| a10bf3241e | |||
| 950d9a0751 | |||
| 62cbd11f14 | |||
| 335772568f | |||
| e10f9164fe | |||
| a491eead5a | |||
| 823d030c2c | |||
| d4e1a19ab1 | |||
| 36888a7c47 | |||
| 97281da351 | |||
| 3c8953cc5a | |||
| 7c113f5c75 | |||
| 42eaa67fd5 | |||
| a743726b08 | |||
| 7b37f9a6fa | |||
| 835434c12f | |||
| 778eadbe7c | |||
| 9c9b133ed2 | |||
| 8560af9c4f | |||
| 0ccd7d40ac | |||
| e442782d8f | |||
| f4147fb583 | |||
| 9354db7c19 | |||
| 0a6cc7f722 | |||
| 6382361161 | |||
| 5891db2f6b | |||
| 9a8c76fc2b | |||
| ced58b790e | |||
| 89d5310504 | |||
| de85eec674 | |||
| 9b56be44b4 | |||
| 28c8c155ce | |||
| 55e8c38e50 | |||
| 145d04230b | |||
| b852a6866d | |||
| 44f1ce3784 | |||
| 42df3f471d | |||
| 6f9e733f58 | |||
| 0e60d56f53 | |||
| 7e51901d51 | |||
| 59014bee64 | |||
| 0cb8d50aea | |||
| 5275c45199 | |||
| 7afce46d9f | |||
| edb30cf342 | |||
| 99581abe05 | |||
| 1edfa1504c | |||
| 267d4e8191 | |||
| 90b82eed99 | |||
| 51488bb4be | |||
| f0efb14e6d | |||
| c486c396da | |||
| ce94651490 | |||
| c440c255a7 | |||
| f6497093ce | |||
| 7528503794 | |||
| afcff83ebc | |||
| 8f0031e9c8 | |||
| 5c500fb6fd | |||
| 641f931f19 | |||
| 4d493aff16 | |||
| b4ea5557ac | |||
| be441d56f9 | |||
| 633b7e7762 | |||
| babcc2a448 | |||
| 8a7aeaf86f | |||
| 97a585f240 | |||
| 4a329aa4da | |||
| 92cb6f3ae8 | |||
| a35ecf4065 | |||
| ade1529986 | |||
| e6d9f3d057 | |||
| 98bf378c6e | |||
| c4b413ef9e | |||
| a9dd2b1746 | |||
| cb95868c4a | |||
| 2f6c4075c8 | |||
| c53dc7dae4 | |||
| 8b3ea5ce56 | |||
| 51a4a6664c | |||
| e4dc80f41d | |||
| bc7c422a11 | |||
| c3e3bb77e5 | |||
| a25c76e6a3 | |||
| 0c5085022c | |||
| 1fdaaac809 | |||
| bcec6f03cb | |||
| ed147813ab | |||
| 4315225642 | |||
| a75dffd4a8 | |||
| fce2993d21 | |||
| 9aec8deec6 | |||
| ec3026673b | |||
| 105f1ccdb5 | |||
| 52ce03929b | |||
| ac4768155f | |||
| d08172b4b0 | |||
| e982a5a567 | |||
| cf4d3cae01 | |||
| 8531a7a40c | |||
| fce7cc903c | |||
| 5da1dd7ce9 | |||
| 46cdeb495a | |||
| 653691fafb | |||
| 92ff6a8e2b | |||
| cc43aef64b | |||
| e2c6d60721 | |||
| 8bf88c3231 | |||
| 1572c61063 | |||
| 5ff3b76e18 | |||
| cd69f69b28 | |||
| 8b0d2e5f75 | |||
| 7d0fb85c8c | |||
| 08ba7c7793 | |||
| 9737b1d3c7 | |||
| 94a9b7f983 | |||
| bae57c7f8f | |||
| b20265819b | |||
| 3938a57542 | |||
| 4645d0e32a | |||
| 7e554584b1 | |||
| b6a6d7f872 | |||
| 3b92901892 | |||
| b63877b1f2 | |||
| 9d93417d9a | |||
| 9949b44560 | |||
| 7abacb000b | |||
| 43f5aeaff3 | |||
| 9e08fa30b6 | |||
| ccedd3a87d | |||
| 0bb4be55ac | |||
| 21ded420e2 | |||
| 7d893fd04b | |||
| 7015f8dedc | |||
| ac02bce109 | |||
| 3a9a0ab96d | |||
| aba17cb997 | |||
| 038a3b4452 | |||
| b03ebc5a65 |
@@ -0,0 +1,19 @@
|
||||
version = 1
|
||||
|
||||
test_patterns = ["tests/**"]
|
||||
|
||||
exclude_patterns = [
|
||||
"tests/**",
|
||||
"docs/**",
|
||||
"setup.py",
|
||||
"setup-raw.py"
|
||||
]
|
||||
|
||||
[[analyzers]]
|
||||
name = "python"
|
||||
enabled = true
|
||||
|
||||
[analyzers.meta]
|
||||
runtime_version = "3.x.x"
|
||||
max_line_length = 99
|
||||
skip_doc_coverage = ["module", "magic", "init", "nonpublic"]
|
||||
@@ -0,0 +1,7 @@
|
||||
# .git-blame-ignore-revs
|
||||
# Use locally as `git blame file.py --ignore-revs-file .git-blame-ignore-revs`
|
||||
# or configure git to always use it: `git config blame.ignoreRevsFile .git-blame-ignore-revs`
|
||||
# First migration to code style Black (#2122)
|
||||
264b2c9c72691c5937b80e84e061c52dd2d8861a
|
||||
# Use Black more extensively (#2972)
|
||||
950d9a0751d79b92d78ea44344ce3e3c5b3948f9
|
||||
+87
-63
@@ -1,10 +1,11 @@
|
||||
=================
|
||||
How To Contribute
|
||||
=================
|
||||
|
||||
Every open source project lives from the generous help by contributors that sacrifice their time and ``python-telegram-bot`` is no different. To make participation as pleasant as possible, this project adheres to the `Code of Conduct`_ by the Python Software Foundation.
|
||||
|
||||
Setting things up
|
||||
-----------------
|
||||
=================
|
||||
|
||||
1. Fork the ``python-telegram-bot`` repository to your GitHub account.
|
||||
|
||||
@@ -25,7 +26,7 @@ Setting things up
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ pip install -r requirements.txt -r requirements-dev.txt
|
||||
$ pip install -r requirements-all.txt
|
||||
|
||||
|
||||
5. Install pre-commit hooks:
|
||||
@@ -35,21 +36,23 @@ Setting things up
|
||||
$ pre-commit install
|
||||
|
||||
Finding something to do
|
||||
#######################
|
||||
=======================
|
||||
|
||||
If you already know what you'd like to work on, you can skip this section.
|
||||
|
||||
If you have an idea for something to do, first check if it's already been filed on the `issue tracker`_. If so, add a comment to the issue saying you'd like to work on it, and we'll help you get started! Otherwise, please file a new issue and assign yourself to it.
|
||||
|
||||
Another great way to start contributing is by writing tests. Tests are really important because they help prevent developers from accidentally breaking existing code, allowing them to build cool things faster. If you're interested in helping out, let the development team know by posting to the `Telegram group`_ (use `@admins` to mention the maintainers), and we'll help you get started.
|
||||
Another great way to start contributing is by writing tests. Tests are really important because they help prevent developers from accidentally breaking existing code, allowing them to build cool things faster. If you're interested in helping out, let the development team know by posting to the `Telegram group`_, and we'll help you get started.
|
||||
|
||||
That being said, we want to mention that we are very hesitant about adding new requirements to our projects. If you intend to do this, please state this in an issue and get a verification from one of the maintainers.
|
||||
|
||||
Instructions for making a code change
|
||||
#####################################
|
||||
=====================================
|
||||
|
||||
The central development branch is ``master``, which should be clean and ready for release at any time. In general, all changes should be done as feature branches based off of ``master``.
|
||||
|
||||
If you want to do solely documentation changes, base them and PR to the branch ``doc-fixes``. This branch also has its own `RTD build`_.
|
||||
|
||||
Here's how to make a one-off code change.
|
||||
|
||||
1. **Choose a descriptive branch name.** It should be lowercase, hyphen-separated, and a noun describing the change (so, ``fuzzy-rules``, but not ``implement-fuzzy-rules``). Also, it shouldn't start with ``hotfix`` or ``release``.
|
||||
@@ -69,29 +72,9 @@ Here's how to make a one-off code change.
|
||||
|
||||
- Your code should adhere to the `PEP 8 Style Guide`_, with the exception that we have a maximum line length of 99.
|
||||
|
||||
- Provide static typing with signature annotations. The documentation of `MyPy`_ will be a good start, the cheat sheet is `here`_. We also have some custom type aliases in ``telegram.utils.helpers.typing``.
|
||||
- Provide static typing with signature annotations. The documentation of `MyPy`_ will be a good start, the cheat sheet is `here`_. We also have some custom type aliases in ``telegram._utils.types``.
|
||||
|
||||
- Document your code. This project uses `sphinx`_ to generate static HTML docs. To build them, first make sure you have the required dependencies:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ pip install -r docs/requirements-docs.txt
|
||||
|
||||
then run the following from the PTB root directory:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ make -C docs html
|
||||
|
||||
or, if you don't have ``make`` available (e.g. on Windows):
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ sphinx-build docs/source docs/build/html
|
||||
|
||||
Once the process terminates, you can view the built documentation by opening ``docs/build/html/index.html`` with a browser.
|
||||
|
||||
- Add ``.. versionadded:: version``, ``.. versionchanged:: version`` or ``.. deprecated:: version`` to the associated documentation of your changes, depending on what kind of change you made. This only applies if the change you made is visible to an end user. The directives should be added to class/method descriptions if their general behaviour changed and to the description of all arguments & attributes that changed.
|
||||
- Document your code. This step is pretty important to us, so it has its own `section`_.
|
||||
|
||||
- For consistency, please conform to `Google Python Style Guide`_ and `Google Python Style Docstrings`_.
|
||||
|
||||
@@ -99,46 +82,42 @@ Here's how to make a one-off code change.
|
||||
|
||||
- Documenting types of global variables and complex types of class members can be done using the Sphinx docstring convention.
|
||||
|
||||
- In addition, PTB uses the `Black`_ coder formatting. Plugins for Black exist for some `popular editors`_. You can use those instead of manually formatting everything.
|
||||
- In addition, PTB uses some formatting/styling and linting tools in the pre-commit setup. Some of those tools also have command line tools that can help to run these tools outside of the pre-commit step. If you'd like to leverage that, please have a look at the `pre-commit config file`_ for an overview of which tools (and which versions of them) are used. For example, we use `Black`_ for code formatting. Plugins for Black exist for some `popular editors`_. You can use those instead of manually formatting everything.
|
||||
|
||||
- Please ensure that the code you write is well-tested.
|
||||
|
||||
- In addition to that, we provide the `dev` marker for pytest. If you write one or multiple tests and want to run only those, you can decorate them via `@pytest.mark.dev` and then run it with minimal overhead with `pytest ./path/to/test_file.py -m dev`.
|
||||
|
||||
- Don’t break backward compatibility.
|
||||
|
||||
- Add yourself to the AUTHORS.rst_ file in an alphabetical fashion.
|
||||
|
||||
- Before making a commit ensure that all automated tests still pass:
|
||||
|
||||
.. code-block::
|
||||
|
||||
$ make test
|
||||
|
||||
If you don't have ``make``, do:
|
||||
|
||||
.. code-block::
|
||||
.. code-block:: bash
|
||||
|
||||
$ pytest -v
|
||||
|
||||
To run ``test_official`` (particularly useful if you made API changes), run
|
||||
|
||||
.. code-block::
|
||||
.. code-block:: bash
|
||||
|
||||
$ export TEST_OFFICIAL=true
|
||||
|
||||
prior to running the tests.
|
||||
|
||||
- To actually make the commit (this will trigger tests for yapf, lint and pep8 automatically):
|
||||
- If you want run style & type checks before committing run
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ pre-commit run -a
|
||||
|
||||
- To actually make the commit (this will trigger tests style & type checks automatically):
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ git add your-file-changed.py
|
||||
|
||||
- yapf may change code formatting, make sure to re-add them to your commit.
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ git commit -a -m "your-commit-message-here"
|
||||
|
||||
- Finally, push it to your GitHub fork, run:
|
||||
|
||||
.. code-block:: bash
|
||||
@@ -155,10 +134,12 @@ Here's how to make a one-off code change.
|
||||
|
||||
5. **Address review comments until all reviewers give LGTM ('looks good to me').**
|
||||
|
||||
- When your reviewer has reviewed the code, you'll get an email. You'll need to respond in two ways:
|
||||
- When your reviewer has reviewed the code, you'll get a notification. You'll need to respond in two ways:
|
||||
|
||||
- Make a new commit addressing the comments you agree with, and push it to the same branch. Ideally, the commit message would explain what the commit does (e.g. "Fix lint error"), but if there are lots of disparate review comments, it's fine to refer to the original commit message and add something like "(address review comments)".
|
||||
|
||||
- In order to keep the commit history intact, please avoid squashing or amending history and then force-pushing to the PR. Reviewers often want to look at individual commits.
|
||||
|
||||
- In addition, please reply to each comment. Each reply should be either "Done" or a response explaining why the corresponding suggestion wasn't implemented. All comments must be resolved before LGTM can be given.
|
||||
|
||||
- Resolve any merge conflicts that arise. To resolve conflicts between 'your-branch-name' (in your fork) and 'master' (in the ``python-telegram-bot`` repository), run:
|
||||
@@ -173,12 +154,6 @@ Here's how to make a one-off code change.
|
||||
$ git commit -a
|
||||
$ git push origin your-branch-name
|
||||
|
||||
- If after merging you see local modified files in ``telegram/vendor/`` directory, that you didn't actually touch, that means you need to update submodules with this command:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ git submodule update --init --recursive
|
||||
|
||||
- At the end, the reviewer will merge the pull request.
|
||||
|
||||
6. **Tidy up!** Delete the feature branch from both your local clone and the GitHub repository:
|
||||
@@ -190,13 +165,56 @@ Here's how to make a one-off code change.
|
||||
|
||||
7. **Celebrate.** Congratulations, you have contributed to ``python-telegram-bot``!
|
||||
|
||||
Documenting
|
||||
===========
|
||||
|
||||
The documentation of this project is separated in two sections: User facing and dev facing.
|
||||
|
||||
User facing docs are hosted at `RTD`_. They are the main way the users of our library are supposed to get information about the objects. They don't care about the internals, they just want to know
|
||||
what they have to pass to make it work, what it actually does. You can/should provide examples for non obvious cases (like the Filter module), and notes/warnings.
|
||||
|
||||
Dev facing, on the other side, is for the devs/maintainers of this project. These
|
||||
doc strings don't have a separate documentation site they generate, instead, they document the actual code.
|
||||
|
||||
User facing documentation
|
||||
-------------------------
|
||||
We use `sphinx`_ to generate static HTML docs. To build them, first make sure you have the required dependencies:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ pip install -r docs/requirements-docs.txt
|
||||
|
||||
then run the following from the PTB root directory:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ make -C docs html
|
||||
|
||||
or, if you don't have ``make`` available (e.g. on Windows):
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
$ sphinx-build docs/source docs/build/html
|
||||
|
||||
Once the process terminates, you can view the built documentation by opening ``docs/build/html/index.html`` with a browser.
|
||||
|
||||
- Add ``.. versionadded:: version``, ``.. versionchanged:: version`` or ``.. deprecated:: version`` to the associated documentation of your changes, depending on what kind of change you made. This only applies if the change you made is visible to an end user. The directives should be added to class/method descriptions if their general behaviour changed and to the description of all arguments & attributes that changed.
|
||||
|
||||
Dev facing documentation
|
||||
------------------------
|
||||
We adhere to the `CSI`_ standard. This documentation is not fully implemented in the project, yet, but new code changes should comply with the `CSI` standard.
|
||||
The idea behind this is to make it very easy for you/a random maintainer or even a totally foreign person to drop anywhere into the code and more or less immediately understand what a particular line does. This will make it easier
|
||||
for new to make relevant changes if said lines don't do what they are supposed to.
|
||||
|
||||
|
||||
|
||||
Style commandments
|
||||
------------------
|
||||
==================
|
||||
|
||||
Assert comparison order
|
||||
#######################
|
||||
-----------------------
|
||||
|
||||
- assert statements should compare in **actual** == **expected** order.
|
||||
Assert statements should compare in **actual** == **expected** order.
|
||||
For example (assuming ``test_call`` is the thing being tested):
|
||||
|
||||
.. code-block:: python
|
||||
@@ -208,7 +226,7 @@ For example (assuming ``test_call`` is the thing being tested):
|
||||
assert 5 == test_call()
|
||||
|
||||
Properly calling callables
|
||||
##########################
|
||||
--------------------------
|
||||
|
||||
Methods, functions and classes can specify optional parameters (with default
|
||||
values) using Python's keyword arg syntax. When providing a value to such a
|
||||
@@ -226,7 +244,7 @@ This gives us the flexibility to re-order arguments and more importantly
|
||||
to add new required arguments. It's also more explicit and easier to read.
|
||||
|
||||
Properly defining optional arguments
|
||||
####################################
|
||||
------------------------------------
|
||||
|
||||
It's always good to not initialize optional arguments at class creation,
|
||||
instead use ``**kwargs`` to get them. It's well known Telegram API can
|
||||
@@ -237,22 +255,28 @@ break the API classes. For example:
|
||||
|
||||
# GOOD
|
||||
def __init__(self, id, name, last_name=None, **kwargs):
|
||||
self.last_name = last_name
|
||||
self.last_name = last_name
|
||||
|
||||
|
||||
# BAD
|
||||
def __init__(self, id, name, last_name=None):
|
||||
self.last_name = last_name
|
||||
self.last_name = last_name
|
||||
|
||||
|
||||
.. _`Code of Conduct`: https://www.python.org/psf/codeofconduct/
|
||||
.. _`Code of Conduct`: https://www.python.org/psf/conduct/
|
||||
.. _`issue tracker`: https://github.com/python-telegram-bot/python-telegram-bot/issues
|
||||
.. _`Telegram group`: https://telegram.me/pythontelegrambotgroup
|
||||
.. _`PEP 8 Style Guide`: https://www.python.org/dev/peps/pep-0008/
|
||||
.. _`sphinx`: http://sphinx-doc.org
|
||||
.. _`Google Python Style Guide`: http://google.github.io/styleguide/pyguide.html
|
||||
.. _`PEP 8 Style Guide`: https://peps.python.org/pep-0008/
|
||||
.. _`sphinx`: https://www.sphinx-doc.org/en/master
|
||||
.. _`Google Python Style Guide`: https://google.github.io/styleguide/pyguide.html
|
||||
.. _`Google Python Style Docstrings`: https://sphinxcontrib-napoleon.readthedocs.io/en/latest/example_google.html
|
||||
.. _AUTHORS.rst: ../AUTHORS.rst
|
||||
.. _AUTHORS.rst: https://github.com/python-telegram-bot/python-telegram-bot/blob/master/AUTHORS.rst
|
||||
.. _`MyPy`: https://mypy.readthedocs.io/en/stable/index.html
|
||||
.. _`here`: https://mypy.readthedocs.io/en/stable/cheat_sheet_py3.html
|
||||
.. _`pre-commit config file`: https://github.com/python-telegram-bot/python-telegram-bot/blob/master/.pre-commit-config.yaml
|
||||
.. _`Black`: https://black.readthedocs.io/en/stable/index.html
|
||||
.. _`popular editors`: https://black.readthedocs.io/en/stable/editor_integration.html
|
||||
.. _`popular editors`: https://black.readthedocs.io/en/stable/integrations/editors.html
|
||||
.. _`RTD`: https://docs.python-telegram-bot.org/
|
||||
.. _`RTD build`: https://docs.python-telegram-bot.org/en/doc-fixes
|
||||
.. _`CSI`: https://standards.mousepawmedia.com/en/stable/csi.html
|
||||
.. _`section`: #documenting
|
||||
|
||||
@@ -0,0 +1,76 @@
|
||||
name: Bug Report
|
||||
description: Create a report to help us improve
|
||||
title: "[BUG]"
|
||||
labels: ["bug :bug:"]
|
||||
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
Thanks for reporting issues of python-telegram-bot!
|
||||
|
||||
Use this template to notify us if you found a bug.
|
||||
|
||||
To make it easier for us to help you please enter detailed information below.
|
||||
|
||||
Please note, we only support the latest version of python-telegram-bot and master branch. Please make sure to upgrade & recreate the issue on the latest version prior to opening an issue.
|
||||
|
||||
- type: textarea
|
||||
id: steps-to-reproduce
|
||||
attributes:
|
||||
label: Steps to Reproduce
|
||||
value: |
|
||||
1.
|
||||
2.
|
||||
3.
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
id: expected-behaviour
|
||||
attributes:
|
||||
label: Expected behaviour
|
||||
description: Tell us what should happen
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
id: actual-behaviour
|
||||
attributes:
|
||||
label: Actual behaviour
|
||||
description: Tell us what happens instead
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: "### Configuration"
|
||||
|
||||
- type: input
|
||||
id: operating-system
|
||||
attributes:
|
||||
label: Operating System
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
id: versions
|
||||
attributes:
|
||||
label: Version of Python, python-telegram-bot & dependencies
|
||||
description: Paste the output of `$ python -m telegram` here. This will be automatically formatted into code, so no need for backticks.
|
||||
render: shell
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
id: logs
|
||||
attributes:
|
||||
label: Relevant log output
|
||||
description: Insert logs here (if necessary). This will be automatically formatted into code, so no need for backticks.
|
||||
render: python
|
||||
|
||||
- type: textarea
|
||||
id: additional-context
|
||||
attributes:
|
||||
label: Additional Context
|
||||
description: You may provide any other additional context to the bug here.
|
||||
@@ -1,43 +0,0 @@
|
||||
---
|
||||
name: Bug report
|
||||
about: Create a report to help us improve
|
||||
title: "[BUG]"
|
||||
labels: 'bug :bug:'
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
<!--
|
||||
Thanks for reporting issues of python-telegram-bot!
|
||||
|
||||
Use this template to notify us if you found a bug.
|
||||
|
||||
To make it easier for us to help you please enter detailed information below.
|
||||
|
||||
Please note, we only support the latest version of python-telegram-bot and
|
||||
master branch. Please make sure to upgrade & recreate the issue on the latest
|
||||
version prior to opening an issue.
|
||||
-->
|
||||
### Steps to reproduce
|
||||
1.
|
||||
|
||||
2.
|
||||
|
||||
3.
|
||||
|
||||
### Expected behaviour
|
||||
Tell us what should happen
|
||||
|
||||
### Actual behaviour
|
||||
Tell us what happens instead
|
||||
|
||||
### Configuration
|
||||
**Operating System:**
|
||||
|
||||
|
||||
**Version of Python, python-telegram-bot & dependencies:**
|
||||
|
||||
``$ python -m telegram``
|
||||
|
||||
### Logs
|
||||
Insert logs here (if necessary)
|
||||
@@ -3,6 +3,6 @@ contact_links:
|
||||
- name: Telegram Group
|
||||
url: https://telegram.me/pythontelegrambotgroup
|
||||
about: Questions asked on the group usually get answered faster.
|
||||
- name: IRC Channel
|
||||
url: https://webchat.freenode.net/?channels=##python-telegram-bot
|
||||
about: In case you are unable to join our group due to Telegram restrictions, you can use our IRC channel
|
||||
- name: GitHub Discussions
|
||||
url: https://github.com/python-telegram-bot/python-telegram-bot/discussions
|
||||
about: For getting answers to usage on GitHub, Discussions is even better than this bug tracker :)
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
name: Feature Request
|
||||
description: Suggest an idea for this project
|
||||
title: "[FEATURE]"
|
||||
labels: ["enhancement"]
|
||||
|
||||
body:
|
||||
- type: textarea
|
||||
id: related-problem
|
||||
attributes:
|
||||
label: "What kind of feature are you missing? Where do you notice a shortcoming of PTB?"
|
||||
description: "A clear and concise description of what the problem is."
|
||||
placeholder: "Example: I want to do X, but there is no way to do it."
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
id: solution
|
||||
attributes:
|
||||
label: "Describe the solution you'd like"
|
||||
description: "A clear and concise description of what you want to happen."
|
||||
placeholder: "Example: I think it would be nice if you would add feature Y so I can do X."
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
id: alternatives
|
||||
attributes:
|
||||
label: "Describe alternatives you've considered"
|
||||
description: "A clear and concise description of any alternative solutions or features you've considered."
|
||||
placeholder: "Example: I considered Z to be able to do X, but that didn't work because..."
|
||||
|
||||
- type: textarea
|
||||
id: additional-context
|
||||
attributes:
|
||||
label: "Additional context"
|
||||
description: "Add any other context or screenshots about the feature request here."
|
||||
placeholder: "Example: Here's a photo of my cat!"
|
||||
@@ -1,24 +0,0 @@
|
||||
---
|
||||
name: Feature request
|
||||
about: Suggest an idea for this project
|
||||
title: "[FEATURE]"
|
||||
labels: enhancement
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
#### Is your feature request related to a problem? Please describe.
|
||||
A clear and concise description of what the problem is.
|
||||
Ex. *I want to do X, but there is no way to do it.*
|
||||
|
||||
#### Describe the solution you'd like
|
||||
A clear and concise description of what you want to happen.
|
||||
Ex. *I think it would be nice if you would add feature Y so it will make it easier.*
|
||||
|
||||
#### Describe alternatives you've considered
|
||||
A clear and concise description of any alternative solutions or features you've considered.
|
||||
Ex. *I considered Z, but that didn't work because...*
|
||||
|
||||
#### Additional context
|
||||
Add any other context or screenshots about the feature request here.
|
||||
Ex. *Here's a photo of my cat!*
|
||||
@@ -1,29 +0,0 @@
|
||||
---
|
||||
name: Question
|
||||
about: Get help with errors or general questions
|
||||
title: "[QUESTION]"
|
||||
labels: question
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
<!--
|
||||
Hey there, you have a question? We are happy to answer. Please make sure no similar question was opened already.
|
||||
|
||||
To make it easier for us to help you, please read this article https://git.io/JURJO and try to follow the template below as closely as possible.
|
||||
|
||||
Please mind that there is also a users' Telegram group at https://t.me/pythontelegrambotgroup for questions about the library. Questions asked there might be answered quicker than here. In case you are unable to join our group due to Telegram restrictions, you can use our IRC channel at https://webchat.freenode.net/?channels=##python-telegram-bot to participate in the group.
|
||||
-->
|
||||
|
||||
### Issue I am facing
|
||||
Please describe the issue here in as much detail as possible
|
||||
|
||||
### Traceback to the issue
|
||||
```
|
||||
put it here
|
||||
```
|
||||
|
||||
### Related part of your code
|
||||
```python
|
||||
put it here
|
||||
```
|
||||
@@ -0,0 +1,68 @@
|
||||
name: Question
|
||||
description: Get help with errors or general questions
|
||||
title: "[QUESTION]"
|
||||
labels: ["question"]
|
||||
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
Hey there, you have a question? We are happy to answer. Please make sure no similar question was opened already.
|
||||
|
||||
To make it easier for us to help you, please read this [article](https://github.com/python-telegram-bot/python-telegram-bot/wiki/Ask-Right).
|
||||
|
||||
Please mind that there is also a users' [Telegram group](https://t.me/pythontelegrambotgroup) for questions about the library. Questions asked there might be answered quicker than here. Moreover, [GitHub Discussions](https://github.com/python-telegram-bot/python-telegram-bot/discussions) offer a slightly better format to discuss usage questions.
|
||||
|
||||
- type: textarea
|
||||
id: issue-faced
|
||||
attributes:
|
||||
label: "Issue I am facing"
|
||||
description: "Please describe the issue here in as much detail as possible"
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
id: traceback
|
||||
attributes:
|
||||
label: "Traceback to the issue"
|
||||
description: "If you are facing a specific error message, please paste the traceback here. This will be automatically formatted into python code, so no need for backticks."
|
||||
placeholder: |
|
||||
Traceback (most recent call last):
|
||||
File "/home/bot.py", line 1, in main
|
||||
foo = bar()
|
||||
...
|
||||
telegram.error.BadRequest: Traceback not found
|
||||
render: python
|
||||
|
||||
- type: textarea
|
||||
id: related-code
|
||||
attributes:
|
||||
label: "Related part of your code"
|
||||
description: "This will be automatically formatted into code (python), so no need for backticks."
|
||||
placeholder: |
|
||||
logging.basicConfig(
|
||||
format="%(asctime)s - %(name)s - %(levelname)s - %(message)s", level=logging.INFO
|
||||
)
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
render: python
|
||||
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: "### Configuration"
|
||||
|
||||
- type: input
|
||||
id: operating-system
|
||||
attributes:
|
||||
label: Operating System
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
id: versions
|
||||
attributes:
|
||||
label: Version of Python, python-telegram-bot & dependencies
|
||||
description: Paste the output of `$ python -m telegram` here. This will be automatically formatted into code, so no need for backticks.
|
||||
render: shell
|
||||
validations:
|
||||
required: true
|
||||
@@ -0,0 +1,14 @@
|
||||
version: 2
|
||||
updates:
|
||||
- package-ecosystem: "pip"
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: "weekly"
|
||||
day: "friday"
|
||||
|
||||
# Updates the dependencies of the GitHub Actions workflows
|
||||
- package-ecosystem: "github-actions"
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: "monthly"
|
||||
day: "friday"
|
||||
@@ -6,7 +6,9 @@ Hey! You're PRing? Cool! Please have a look at the below checklist. It's here to
|
||||
|
||||
- [ ] Added `.. versionadded:: version`, `.. versionchanged:: version` or `.. deprecated:: version` to the docstrings for user facing changes (for methods/class descriptions, arguments and attributes)
|
||||
- [ ] Created new or adapted existing unit tests
|
||||
- [ ] Documented code changes according to the [CSI standard](https://standards.mousepawmedia.com/en/stable/csi.html)
|
||||
- [ ] Added myself alphabetically to `AUTHORS.rst` (optional)
|
||||
- [ ] Added new classes & modules to the docs and all suitable `__all__` s
|
||||
|
||||
|
||||
### If the PR contains API changes (otherwise, you can delete this passage)
|
||||
@@ -24,7 +26,12 @@ Hey! You're PRing? Cool! Please have a look at the below checklist. It's here to
|
||||
* If relevant:
|
||||
|
||||
- [ ] Added new constants at `telegram.constants` and shortcuts to them as class variables
|
||||
- [ ] Link new and existing constants in docstrings instead of hard coded number and strings
|
||||
- [ ] Add new message types to `Message.effective_attachment`
|
||||
- [ ] Added new handlers for new update types
|
||||
- [ ] Add the handlers to the warning loop in the `ConversationHandler`
|
||||
- [ ] Added new filters for new message (sub)types
|
||||
- [ ] Added or updated documentation for the changed class(es) and/or method(s)
|
||||
- [ ] Updated the Bot API version number in all places in `README.rst` and `README_RAW.rst`, including the badge
|
||||
- [ ] Added or updated `bot_methods.rst`
|
||||
- [ ] Updated the Bot API version number in all places: `README.rst` and `README_RAW.rst` (including the badge), as well as `telegram.constants.BOT_API_VERSION`
|
||||
- [ ] Added logic for arbitrary callback data in `tg.ext.Bot` for new methods that either accept a `reply_markup` in some form or have a return type that is/contains `telegram.Message`
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
name: Check Links in Documentation
|
||||
on:
|
||||
schedule:
|
||||
# First day of month at 05:46 in every 2nd month
|
||||
- cron: '46 5 1 */2 *'
|
||||
|
||||
jobs:
|
||||
test-sphinx-build:
|
||||
name: test-sphinx-linkcheck
|
||||
runs-on: ${{matrix.os}}
|
||||
strategy:
|
||||
matrix:
|
||||
python-version: [3.7]
|
||||
os: [ubuntu-latest]
|
||||
fail-fast: False
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Set up Python ${{ matrix.python-version }}
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
python -W ignore -m pip install --upgrade pip
|
||||
python -W ignore -m pip install -r requirements-all.txt
|
||||
- name: Check Links
|
||||
run: sphinx-build docs/source docs/build/html -W --keep-going -j auto -b linkcheck
|
||||
@@ -0,0 +1,32 @@
|
||||
name: Test Documentation Build
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- master
|
||||
- doc-fixes
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
- doc-fixes
|
||||
|
||||
jobs:
|
||||
test-sphinx-build:
|
||||
name: test-sphinx-build
|
||||
runs-on: ${{matrix.os}}
|
||||
strategy:
|
||||
matrix:
|
||||
python-version: [3.7]
|
||||
os: [ubuntu-latest]
|
||||
fail-fast: False
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Set up Python ${{ matrix.python-version }}
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
python -W ignore -m pip install --upgrade pip
|
||||
python -W ignore -m pip install -r requirements-all.txt
|
||||
- name: Build docs
|
||||
run: sphinx-build docs/source docs/build/html -W --keep-going -j auto
|
||||
@@ -1,14 +0,0 @@
|
||||
name: Warning maintainers
|
||||
on:
|
||||
pull_request:
|
||||
paths: examples/**
|
||||
jobs:
|
||||
job:
|
||||
runs-on: ubuntu-latest
|
||||
name: about example change
|
||||
steps:
|
||||
- name: running the check
|
||||
uses: Poolitzer/notifier-action@master
|
||||
with:
|
||||
notify-message: Hey there. Relax, I am just a little warning for the maintainers to release directly after merging your PR, otherwise we have broken examples and people might get confused :)
|
||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -9,10 +9,10 @@ jobs:
|
||||
lock:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: dessant/lock-threads@v2.0.1
|
||||
- uses: dessant/lock-threads@v3.0.0
|
||||
with:
|
||||
github-token: ${{ github.token }}
|
||||
issue-lock-inactive-days: '1'
|
||||
issue-inactive-days: '7'
|
||||
issue-lock-reason: ''
|
||||
pr-lock-inactive-days: '1'
|
||||
pr-inactive-days: '7'
|
||||
pr-lock-reason: ''
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
name: Warning maintainers
|
||||
on:
|
||||
pull_request_target:
|
||||
paths:
|
||||
- requirements.txt
|
||||
- requirements-opts.txt
|
||||
- .pre-commit-config.yaml
|
||||
permissions:
|
||||
pull-requests: write
|
||||
jobs:
|
||||
job:
|
||||
runs-on: ubuntu-latest
|
||||
name: about pre-commit and dependency change
|
||||
steps:
|
||||
- name: running the check
|
||||
uses: Poolitzer/notifier-action@master
|
||||
with:
|
||||
notify-message: Hey! Looks like you edited the (optional) requirements or the pre-commit hooks. I'm just a friendly reminder to keep the additional dependencies for the hooks in sync with the requirements :)
|
||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -1,9 +1,11 @@
|
||||
name: Warning maintainers
|
||||
on:
|
||||
pull_request:
|
||||
pull_request_target:
|
||||
paths:
|
||||
- README.rst
|
||||
- README_RAW.rst
|
||||
permissions:
|
||||
pull-requests: write
|
||||
jobs:
|
||||
job:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
+39
-44
@@ -4,25 +4,37 @@ on:
|
||||
branches:
|
||||
- master
|
||||
push:
|
||||
branches:
|
||||
branches:
|
||||
- master
|
||||
schedule:
|
||||
# Run monday and friday morning at 03:07 - odd time to spread load on GitHub Actions
|
||||
- cron: '7 3 * * 1,5'
|
||||
|
||||
jobs:
|
||||
pytest:
|
||||
name: pytest
|
||||
runs-on: ${{matrix.os}}
|
||||
continue-on-error: ${{ matrix.experimental }}
|
||||
strategy:
|
||||
matrix:
|
||||
python-version: [3.6, 3.7, 3.8, 3.9]
|
||||
python-version: ['3.7', '3.8', '3.9', '3.10']
|
||||
os: [ubuntu-latest, windows-latest, macos-latest]
|
||||
experimental: [false]
|
||||
include:
|
||||
- python-version: 3.11.0-rc.1
|
||||
os: ubuntu-latest
|
||||
experimental: true
|
||||
- python-version: 3.11.0-rc.1
|
||||
os: windows-latest
|
||||
experimental: true
|
||||
- python-version: 3.11.0-rc.1
|
||||
os: macos-latest
|
||||
experimental: true
|
||||
fail-fast: False
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Initialize vendored libs
|
||||
run:
|
||||
git submodule update --init --recursive
|
||||
- uses: actions/checkout@v3
|
||||
- name: Set up Python ${{ matrix.python-version }}
|
||||
uses: actions/setup-python@v2
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
- name: Install dependencies
|
||||
@@ -30,37 +42,46 @@ jobs:
|
||||
python -W ignore -m pip install --upgrade pip
|
||||
python -W ignore -m pip install -U codecov pytest-cov
|
||||
python -W ignore -m pip install -r requirements.txt
|
||||
python -W ignore -m pip install -r requirements-opts.txt
|
||||
python -W ignore -m pip install -r requirements-dev.txt
|
||||
|
||||
- name: Test with pytest
|
||||
# We run 3 different suites here
|
||||
# 1. Test just utils.helpers.py without pytz being installed
|
||||
# We run 4 different suites here
|
||||
# 1. Test just utils.datetime.py without pytz being installed
|
||||
# 2. Test just test_no_passport.py without passport dependencies being installed
|
||||
# 3. Test everything else
|
||||
# 3. Test just test_rate_limiter.py without passport dependencies being installed
|
||||
# 4. Test everything else
|
||||
# The first & second one are achieved by mocking the corresponding import
|
||||
# See test_helpers.py & test_no_passport.py for details
|
||||
run: |
|
||||
pytest -v --cov -k test_no_passport.py
|
||||
no_passport_exit=$?
|
||||
export TEST_NO_PASSPORT='false'
|
||||
export TEST_PASSPORT='true'
|
||||
pytest -v --cov --cov-append -k test_helpers.py
|
||||
no_pytz_exit=$?
|
||||
export TEST_NO_PYTZ='false'
|
||||
export TEST_PYTZ='true'
|
||||
pip uninstall aiolimiter -y
|
||||
pytest -v --cov --cov-append -k test_ratelimiter.py
|
||||
no_rate_limiter_exit=$?
|
||||
export TEST_RATE_LIMITER='true'
|
||||
pip install -r requirements-opts.txt
|
||||
pytest -v --cov --cov-append
|
||||
full_exit=$?
|
||||
special_exit=$(( no_pytz_exit > no_passport_exit ? no_pytz_exit : no_passport_exit ))
|
||||
special_exit=$(( special_exit > no_rate_limiter_exit ? special_exit : no_rate_limiter_exit ))
|
||||
global_exit=$(( special_exit > full_exit ? special_exit : full_exit ))
|
||||
exit ${global_exit}
|
||||
env:
|
||||
JOB_INDEX: ${{ strategy.job-index }}
|
||||
BOTS: W3sidG9rZW4iOiAiNjk2MTg4NzMyOkFBR1Z3RUtmSEhsTmpzY3hFRE5LQXdraEdzdFpfa28xbUMwIiwgInBheW1lbnRfcHJvdmlkZXJfdG9rZW4iOiAiMjg0Njg1MDYzOlRFU1Q6WldGaU1UUmxNbVF5TnpNeSIsICJib3RfbmFtZSI6ICJQVEIgdGVzdHMgb24gVHJhdmlzIHVzaW5nIENQeXRob24gMi43IiwgInN1cGVyX2dyb3VwX2lkIjogIi0xMDAxMzkwOTgzOTk3IiwgImJvdF91c2VybmFtZSI6ICJAcHRiX3RyYXZpc19jcHl0aG9uXzI3X2JvdCJ9LCB7InRva2VuIjogIjY3MTQ2ODg4NjpBQUdQR2ZjaVJJQlVORmU4MjR1SVZkcTdKZTNfWW5BVE5HdyIsICJwYXltZW50X3Byb3ZpZGVyX3Rva2VuIjogIjI4NDY4NTA2MzpURVNUOlpHWXdPVGxrTXpNeE4yWTIiLCAiYm90X25hbWUiOiAiUFRCIHRlc3RzIG9uIFRyYXZpcyB1c2luZyBDUHl0aG9uIDMuNCIsICJzdXBlcl9ncm91cF9pZCI6ICItMTAwMTQ0NjAyMjUyMiIsICJib3RfdXNlcm5hbWUiOiAiQHB0Yl90cmF2aXNfY3B5dGhvbl8zNF9ib3QifSwgeyJ0b2tlbiI6ICI2MjkzMjY1Mzg6QUFGUnJaSnJCN29CM211ekdzR0pYVXZHRTVDUXpNNUNVNG8iLCAicGF5bWVudF9wcm92aWRlcl90b2tlbiI6ICIyODQ2ODUwNjM6VEVTVDpNbU01WVdKaFl6a3hNMlUxIiwgImJvdF9uYW1lIjogIlBUQiB0ZXN0cyBvbiBUcmF2aXMgdXNpbmcgQ1B5dGhvbiAzLjUiLCAic3VwZXJfZ3JvdXBfaWQiOiAiLTEwMDE0OTY5MTc3NTAiLCAiYm90X3VzZXJuYW1lIjogIkBwdGJfdHJhdmlzX2NweXRob25fMzVfYm90In0sIHsidG9rZW4iOiAiNjQwMjA4OTQzOkFBRmhCalFwOXFtM1JUeFN6VXBZekJRakNsZS1Kano1aGNrIiwgInBheW1lbnRfcHJvdmlkZXJfdG9rZW4iOiAiMjg0Njg1MDYzOlRFU1Q6WXpoa1pUZzFOamMxWXpWbCIsICJib3RfbmFtZSI6ICJQVEIgdGVzdHMgb24gVHJhdmlzIHVzaW5nIENQeXRob24gMy42IiwgInN1cGVyX2dyb3VwX2lkIjogIi0xMDAxMzMzODcxNDYxIiwgImJvdF91c2VybmFtZSI6ICJAcHRiX3RyYXZpc19jcHl0aG9uXzM2X2JvdCJ9LCB7InRva2VuIjogIjY5NTEwNDA4ODpBQUhmenlsSU9qU0lJUy1lT25JMjB5MkUyMEhvZEhzZnotMCIsICJwYXltZW50X3Byb3ZpZGVyX3Rva2VuIjogIjI4NDY4NTA2MzpURVNUOk9HUTFNRGd3WmpJd1pqRmwiLCAiYm90X25hbWUiOiAiUFRCIHRlc3RzIG9uIFRyYXZpcyB1c2luZyBDUHl0aG9uIDMuNyIsICJzdXBlcl9ncm91cF9pZCI6ICItMTAwMTQ3ODI5MzcxNCIsICJib3RfdXNlcm5hbWUiOiAiQHB0Yl90cmF2aXNfY3B5dGhvbl8zN19ib3QifSwgeyJ0b2tlbiI6ICI2OTE0MjM1NTQ6QUFGOFdrakNaYm5IcVBfaTZHaFRZaXJGRWxackdhWU9oWDAiLCAicGF5bWVudF9wcm92aWRlcl90b2tlbiI6ICIyODQ2ODUwNjM6VEVTVDpZamM1TlRoaU1tUXlNV1ZoIiwgImJvdF9uYW1lIjogIlBUQiB0ZXN0cyBvbiBUcmF2aXMgdXNpbmcgUHlQeSAyLjciLCAic3VwZXJfZ3JvdXBfaWQiOiAiLTEwMDEzNjM5MzI1NzMiLCAiYm90X3VzZXJuYW1lIjogIkBwdGJfdHJhdmlzX3B5cHlfMjdfYm90In0sIHsidG9rZW4iOiAiNjg0MzM5OTg0OkFBRk1nRUVqcDAxcjVyQjAwN3lDZFZOc2c4QWxOc2FVLWNjIiwgInBheW1lbnRfcHJvdmlkZXJfdG9rZW4iOiAiMjg0Njg1MDYzOlRFU1Q6TVRBek1UWTNNR1V5TmpnMCIsICJib3RfbmFtZSI6ICJQVEIgdGVzdHMgb24gVHJhdmlzIHVzaW5nIFB5UHkgMy41IiwgInN1cGVyX2dyb3VwX2lkIjogIi0xMDAxNDA3ODM2NjA1IiwgImJvdF91c2VybmFtZSI6ICJAcHRiX3RyYXZpc19weXB5XzM1X2JvdCJ9LCB7InRva2VuIjogIjY5MDA5MTM0NzpBQUZMbVI1cEFCNVljcGVfbU9oN3pNNEpGQk9oMHozVDBUbyIsICJwYXltZW50X3Byb3ZpZGVyX3Rva2VuIjogIjI4NDY4NTA2MzpURVNUOlpEaGxOekU1TURrd1lXSmkiLCAiYm90X25hbWUiOiAiUFRCIHRlc3RzIG9uIEFwcFZleW9yIHVzaW5nIENQeXRob24gMy40IiwgInN1cGVyX2dyb3VwX2lkIjogIi0xMDAxMjc5NjAwMDI2IiwgImJvdF91c2VybmFtZSI6ICJAcHRiX2FwcHZleW9yX2NweXRob25fMzRfYm90In0sIHsidG9rZW4iOiAiNjk0MzA4MDUyOkFBRUIyX3NvbkNrNTVMWTlCRzlBTy1IOGp4aVBTNTVvb0JBIiwgInBheW1lbnRfcHJvdmlkZXJfdG9rZW4iOiAiMjg0Njg1MDYzOlRFU1Q6WW1aaVlXWm1NakpoWkdNeSIsICJib3RfbmFtZSI6ICJQVEIgdGVzdHMgb24gQXBwVmV5b3IgdXNpbmcgQ1B5dGhvbiAyLjciLCAic3VwZXJfZ3JvdXBfaWQiOiAiLTEwMDEyOTMwNzkxNjUiLCAiYm90X3VzZXJuYW1lIjogIkBwdGJfYXBwdmV5b3JfY3B5dGhvbl8yN19ib3QifSwgeyJ0b2tlbiI6ICIxMDU1Mzk3NDcxOkFBRzE4bkJfUzJXQXd1SjNnN29oS0JWZ1hYY2VNbklPeVNjIiwgInBheW1lbnRfcHJvdmlkZXJfdG9rZW4iOiAiMjg0Njg1MDYzOlRFU1Q6TmpBd056QXpZalZpTkdOayIsICJuYW1lIjogIlBUQiB0ZXN0cyBbMF0iLCAic3VwZXJfZ3JvdXBfaWQiOiAiLTEwMDExODU1MDk2MzYiLCAidXNlcm5hbWUiOiAicHRiXzBfYm90In0sIHsidG9rZW4iOiAiMTA0NzMyNjc3MTpBQUY4bk90ODFGcFg4bGJidno4VWV3UVF2UmZUYkZmQnZ1SSIsICJwYXltZW50X3Byb3ZpZGVyX3Rva2VuIjogIjI4NDY4NTA2MzpURVNUOllUVTFOVEk0WkdSallqbGkiLCAibmFtZSI6ICJQVEIgdGVzdHMgWzFdIiwgInN1cGVyX2dyb3VwX2lkIjogIi0xMDAxNDg0Nzk3NjEyIiwgInVzZXJuYW1lIjogInB0Yl8xX2JvdCJ9LCB7InRva2VuIjogIjk3MTk5Mjc0NTpBQUdPa09hVzBOSGpnSXY1LTlqUWJPajR2R3FkaFNGLVV1cyIsICJwYXltZW50X3Byb3ZpZGVyX3Rva2VuIjogIjI4NDY4NTA2MzpURVNUOk5XWmtNV1ZoWWpsallqVTUiLCAibmFtZSI6ICJQVEIgdGVzdHMgWzJdIiwgInN1cGVyX2dyb3VwX2lkIjogIi0xMDAxNDAyMjU1MDcwIiwgInVzZXJuYW1lIjogInB0Yl8yX2JvdCJ9XQ==
|
||||
TEST_NO_PYTZ : "true"
|
||||
TEST_NO_PASSPORT: "true"
|
||||
TEST_PYTZ : "false"
|
||||
TEST_PASSPORT: "false"
|
||||
TEST_RATE_LIMITER: "false"
|
||||
TEST_BUILD: "true"
|
||||
shell: bash --noprofile --norc {0}
|
||||
|
||||
- name: Submit coverage
|
||||
uses: codecov/codecov-action@v1.0.13
|
||||
uses: codecov/codecov-action@v3
|
||||
with:
|
||||
env_vars: OS,PYTHON
|
||||
name: ${{ matrix.os }}-${{ matrix.python-version }}
|
||||
@@ -74,18 +95,16 @@ jobs:
|
||||
os: [ubuntu-latest]
|
||||
fail-fast: False
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Initialize vendored libs
|
||||
run:
|
||||
git submodule update --init --recursive
|
||||
- uses: actions/checkout@v3
|
||||
- name: Set up Python ${{ matrix.python-version }}
|
||||
uses: actions/setup-python@v1
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
python -W ignore -m pip install --upgrade pip
|
||||
python -W ignore -m pip install -r requirements.txt
|
||||
python -W ignore -m pip install -r requirements-opts.txt
|
||||
python -W ignore -m pip install -r requirements-dev.txt
|
||||
- name: Compare to official api
|
||||
run: |
|
||||
@@ -94,27 +113,3 @@ jobs:
|
||||
env:
|
||||
TEST_OFFICIAL: "true"
|
||||
shell: bash --noprofile --norc {0}
|
||||
test_pre_commit:
|
||||
name: test-pre-commit
|
||||
runs-on: ${{matrix.os}}
|
||||
strategy:
|
||||
matrix:
|
||||
python-version: [3.7]
|
||||
os: [ubuntu-latest]
|
||||
fail-fast: False
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Initialize vendored libs
|
||||
run:
|
||||
git submodule update --init --recursive
|
||||
- name: Set up Python ${{ matrix.python-version }}
|
||||
uses: actions/setup-python@v1
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
python -W ignore -m pip install --upgrade pip
|
||||
python -W ignore -m pip install -r requirements.txt
|
||||
python -W ignore -m pip install -r requirements-dev.txt
|
||||
- name: Run pre-commit tests
|
||||
run: pre-commit run --all-files
|
||||
|
||||
@@ -69,6 +69,9 @@ target/
|
||||
# Sublime Text 2
|
||||
*.sublime*
|
||||
|
||||
# VS Code
|
||||
.vscode
|
||||
|
||||
# unitests files
|
||||
game.gif
|
||||
telegram.mp3
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
[submodule "telegram/vendor/urllib3"]
|
||||
path = telegram/vendor/ptb_urllib3
|
||||
url = https://github.com/python-telegram-bot/urllib3.git
|
||||
branch = ptb
|
||||
+59
-12
@@ -1,34 +1,81 @@
|
||||
# Make sure that
|
||||
# * the revs specified here match requirements-dev.txt
|
||||
# * the makefile checks the same files as pre-commit
|
||||
# Make sure that the additional_dependencies here match requirements.txt
|
||||
|
||||
ci:
|
||||
autofix_prs: false
|
||||
autoupdate_schedule: monthly
|
||||
# We currently only need this behavior on the v13.x branch were we have the vendored urllib
|
||||
# TODO: Remove once we discontinue v13
|
||||
submodules: true
|
||||
|
||||
repos:
|
||||
- repo: https://github.com/psf/black
|
||||
rev: 20.8b1
|
||||
rev: 22.6.0
|
||||
hooks:
|
||||
- id: black
|
||||
args:
|
||||
- --diff
|
||||
- --check
|
||||
- repo: https://gitlab.com/pycqa/flake8
|
||||
rev: 3.8.4
|
||||
- repo: https://github.com/PyCQA/flake8
|
||||
rev: 5.0.2
|
||||
hooks:
|
||||
- id: flake8
|
||||
- repo: https://github.com/PyCQA/pylint
|
||||
rev: pylint-2.6.0
|
||||
rev: v2.13.9
|
||||
hooks:
|
||||
- id: pylint
|
||||
files: ^(telegram|examples)/.*\.py$
|
||||
args:
|
||||
- --rcfile=setup.cfg
|
||||
- --rcfile=setup.cfg
|
||||
# run pylint across multiple cpu cores to speed it up-
|
||||
# https://pylint.pycqa.org/en/latest/user_guide/run.html?#parallel-execution to know more
|
||||
- --jobs=0
|
||||
|
||||
additional_dependencies:
|
||||
- httpx~=0.23.0
|
||||
- tornado~=6.2
|
||||
- APScheduler~=3.9.1
|
||||
- cachetools~=5.2.0
|
||||
- aiolimiter~=1.0.0
|
||||
- . # this basically does `pip install -e .`
|
||||
- repo: https://github.com/pre-commit/mirrors-mypy
|
||||
rev: v0.800
|
||||
rev: v0.971
|
||||
hooks:
|
||||
- id: mypy
|
||||
files: ^(telegram|examples)/.*\.py$
|
||||
name: mypy-ptb
|
||||
files: ^telegram/.*\.py$
|
||||
additional_dependencies:
|
||||
- types-pytz
|
||||
- types-cryptography
|
||||
- types-cachetools
|
||||
- httpx~=0.23.0
|
||||
- tornado~=6.2
|
||||
- APScheduler~=3.9.1
|
||||
- cachetools~=5.2.0
|
||||
- aiolimiter~=1.0.0
|
||||
- . # this basically does `pip install -e .`
|
||||
- id: mypy
|
||||
name: mypy-examples
|
||||
files: ^examples/.*\.py$
|
||||
args:
|
||||
- --no-strict-optional
|
||||
- --follow-imports=silent
|
||||
additional_dependencies:
|
||||
- tornado~=6.2
|
||||
- APScheduler~=3.9.1
|
||||
- cachetools~=5.2.0
|
||||
- . # this basically does `pip install -e .`
|
||||
- repo: https://github.com/asottile/pyupgrade
|
||||
rev: v2.10.0
|
||||
rev: v2.37.3
|
||||
hooks:
|
||||
- id: pyupgrade
|
||||
files: ^(telegram|examples|tests)/.*\.py$
|
||||
args:
|
||||
- --py36-plus
|
||||
- --py37-plus
|
||||
- repo: https://github.com/pycqa/isort
|
||||
rev: 5.10.1
|
||||
hooks:
|
||||
- id: isort
|
||||
name: isort
|
||||
args:
|
||||
- --diff
|
||||
- --check
|
||||
|
||||
+21
-5
@@ -1,10 +1,26 @@
|
||||
# syntax: https://docs.readthedocs.io/en/latest/yaml-config.html
|
||||
# .readthedocs.yaml
|
||||
# Read the Docs configuration file
|
||||
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
|
||||
|
||||
# Required
|
||||
version: 2
|
||||
|
||||
# Build documentation in the docs/ directory with Sphinx
|
||||
sphinx:
|
||||
configuration: docs/source/conf.py
|
||||
|
||||
# Optionally build your docs in additional formats such as PDF
|
||||
formats:
|
||||
- pdf
|
||||
- pdf
|
||||
|
||||
# Optionally set the version of Python and requirements required to build your docs
|
||||
python:
|
||||
setup_py_install: true
|
||||
version: 3
|
||||
install:
|
||||
- method: pip
|
||||
path: .
|
||||
- requirements: docs/requirements-docs.txt
|
||||
|
||||
requirements_file: docs/requirements-docs.txt
|
||||
build:
|
||||
os: ubuntu-20.04
|
||||
tools:
|
||||
python: "3" # latest stable cpython version
|
||||
|
||||
+22
-7
@@ -2,22 +2,24 @@ Credits
|
||||
=======
|
||||
|
||||
``python-telegram-bot`` was originally created by
|
||||
`Leandro Toledo <https://github.com/leandrotoledo>`_ and is now maintained by `Hinrich Mahler <https://github.com/Bibo-Joshi>`_.
|
||||
`Leandro Toledo <https://github.com/leandrotoledo>`_.
|
||||
The current development team includes
|
||||
|
||||
- `Hinrich Mahler <https://github.com/Bibo-Joshi>`_ (maintainer)
|
||||
- `Poolitzer <https://github.com/Poolitzer>`_ (community liaison)
|
||||
- `Shivam <https://github.com/Starry69>`_
|
||||
- `Harshil <https://github.com/harshil21>`_
|
||||
|
||||
Emeritus maintainers include
|
||||
`Jannes Höke <https://github.com/jh0ker>`_ (`@jh0ker <https://t.me/jh0ker>`_ on Telegram),
|
||||
`Noam Meltzer <https://github.com/tsnoam>`_, `Pieter Schutz <https://github.com/eldinnie>`_ and `Jasmin Bom <https://github.com/jsmnbom>`_.
|
||||
|
||||
The maintainers are actively supported by `Poolitzer <https://github.com/Poolitzer>`_ in terms of development and community liaison.
|
||||
|
||||
We're vendoring urllib3 as part of ``python-telegram-bot`` which is distributed under the MIT
|
||||
license. For more info, full credits & license terms, the sources can be found here:
|
||||
`https://github.com/python-telegram-bot/urllib3`.
|
||||
|
||||
Contributors
|
||||
------------
|
||||
|
||||
The following wonderful people contributed directly or indirectly to this project:
|
||||
|
||||
- `Abshar <https://github.com/abxhr>`_
|
||||
- `Alateas <https://github.com/alateas>`_
|
||||
- `Ales Dokshanin <https://github.com/alesdokshanin>`_
|
||||
- `Ambro17 <https://github.com/Ambro17>`_
|
||||
@@ -27,12 +29,15 @@ The following wonderful people contributed directly or indirectly to this projec
|
||||
- `Balduro <https://github.com/Balduro>`_
|
||||
- `Bibo-Joshi <https://github.com/Bibo-Joshi>`_
|
||||
- `bimmlerd <https://github.com/bimmlerd>`_
|
||||
- `cyc8 <https://github.com/cyc8>`_
|
||||
- `d-qoi <https://github.com/d-qoi>`_
|
||||
- `daimajia <https://github.com/daimajia>`_
|
||||
- `Daniel Reed <https://github.com/nmlorg>`_
|
||||
- `D David Livingston <https://github.com/daviddl9>`_
|
||||
- `DonalDuck004 <https://github.com/DonalDuck004>`_
|
||||
- `Eana Hufwe <https://github.com/blueset>`_
|
||||
- `Ehsan Online <https://github.com/ehsanonline>`_
|
||||
- `Eldad Carin <https://github.com/eldbud>`_
|
||||
- `Eli Gao <https://github.com/eligao>`_
|
||||
- `Emilio Molinari <https://github.com/xates>`_
|
||||
- `ErgoZ Riftbit Vaper <https://github.com/ergoz>`_
|
||||
@@ -41,6 +46,7 @@ The following wonderful people contributed directly or indirectly to this projec
|
||||
- `Evan Haberecht <https://github.com/habereet>`_
|
||||
- `Evgeny Denisov <https://github.com/eIGato>`_
|
||||
- `evgfilim1 <https://github.com/evgfilim1>`_
|
||||
- `ExalFabu <https://github.com/ExalFabu>`_
|
||||
- `franciscod <https://github.com/franciscod>`_
|
||||
- `gamgi <https://github.com/gamgi>`_
|
||||
- `Gauthamram Ravichandran <https://github.com/GauthamramRavichandran>`_
|
||||
@@ -57,6 +63,7 @@ The following wonderful people contributed directly or indirectly to this projec
|
||||
- `Joscha Götzer <https://github.com/Rostgnom>`_
|
||||
- `jossalgon <https://github.com/jossalgon>`_
|
||||
- `JRoot3D <https://github.com/JRoot3D>`_
|
||||
- `kennethcheo <https://github.com/kennethcheo>`_
|
||||
- `Kirill Vasin <https://github.com/vasinkd>`_
|
||||
- `Kjwon15 <https://github.com/kjwon15>`_
|
||||
- `Li-aung Yip <https://github.com/LiaungYip>`_
|
||||
@@ -69,15 +76,19 @@ The following wonderful people contributed directly or indirectly to this projec
|
||||
- `naveenvhegde <https://github.com/naveenvhegde>`_
|
||||
- `neurrone <https://github.com/neurrone>`_
|
||||
- `NikitaPirate <https://github.com/NikitaPirate>`_
|
||||
- `Nikolai Krivenko <https://github.com/nkrivenko>`_
|
||||
- `njittam <https://github.com/njittam>`_
|
||||
- `Noam Meltzer <https://github.com/tsnoam>`_
|
||||
- `Oleg Shlyazhko <https://github.com/ollmer>`_
|
||||
- `Oleg Sushchenko <https://github.com/feuillemorte>`_
|
||||
- `Or Bin <https://github.com/OrBin>`_
|
||||
- `overquota <https://github.com/overquota>`_
|
||||
- `Paradox <https://github.com/paradox70>`_
|
||||
- `Patrick Hofmann <https://github.com/PH89>`_
|
||||
- `Paul Larsen <https://github.com/PaulSonOfLars>`_
|
||||
- `Pawan <https://github.com/pawanrai9999>`_
|
||||
- `Pieter Schutz <https://github.com/eldinnie>`_
|
||||
- `Piraty <https://github.com/piraty>`_
|
||||
- `Poolitzer <https://github.com/Poolitzer>`_
|
||||
- `Pranjalya Tiwari <https://github.com/Pranjalya>`_
|
||||
- `Rahiel Kasim <https://github.com/rahiel>`_
|
||||
@@ -97,6 +108,10 @@ The following wonderful people contributed directly or indirectly to this projec
|
||||
- `Vorobjev Simon <https://github.com/simonvorobjev>`_
|
||||
- `Wagner Macedo <https://github.com/wagnerluis1982>`_
|
||||
- `wjt <https://github.com/wjt>`_
|
||||
- `Yaw Danso <https://github.com/dglitxh>`_
|
||||
- `zeroone2numeral2 <https://github.com/zeroone2numeral2>`_
|
||||
- `zeshuaro <https://github.com/zeshuaro>`_
|
||||
- `zpavloudis <https://github.com/zpavloudis>`_
|
||||
|
||||
|
||||
Please add yourself here alphabetically when you submit your first pull request.
|
||||
|
||||
+661
-4
@@ -2,6 +2,663 @@
|
||||
Changelog
|
||||
=========
|
||||
|
||||
Version 20.0a3
|
||||
==============
|
||||
*Released 2022-08-27*
|
||||
|
||||
This is the technical changelog for version 20.0a3. More elaborate release notes can be found in the news channel `@pythontelegrambotchannel <https://t.me/pythontelegrambotchannel>`_.
|
||||
|
||||
Major Changes
|
||||
-------------
|
||||
|
||||
- Full Support for API 6.2 (`#3195`_)
|
||||
|
||||
New Features
|
||||
------------
|
||||
|
||||
- New Rate Limiting Mechanism (`#3148`_)
|
||||
- Make ``chat/user_data`` Available in Error Handler for Errors in Jobs (`#3152`_)
|
||||
- Add ``Application.post_shutdown`` (`#3126`_)
|
||||
|
||||
Bug Fixes
|
||||
---------
|
||||
|
||||
- Fix ``helpers.mention_markdown`` for Markdown V1 and Improve Related Unit Tests (`#3155`_)
|
||||
- Add ``api_kwargs`` Parameter to ``Bot.log_out`` and Improve Related Unit Tests (`#3147`_)
|
||||
- Make ``Bot.delete_my_commands`` a Coroutine Function (`#3136`_)
|
||||
- Fix ``ConversationHandler.check_update`` not respecting ``per_user`` (`#3128`_)
|
||||
|
||||
Minor Changes, Documentation Improvements and CI
|
||||
------------------------------------------------
|
||||
|
||||
- Add Python 3.11 to Test Suite & Adapt Enum Behaviour (`#3168`_)
|
||||
- Drop Manual Token Validation (`#3167`_)
|
||||
- Simplify Unit Tests for ``Bot.send_chat_action`` (`#3151`_)
|
||||
- Drop ``pre-commit`` Dependencies from ``requirements-dev.txt`` (`#3120`_)
|
||||
- Change Default Values for ``concurrent_updates`` and ``connection_pool_size`` (`#3127`_)
|
||||
- Documentation Improvements (`#3139`_, `#3153`_, `#3135`_)
|
||||
- Type Hinting Fixes (`#3202`_)
|
||||
|
||||
Dependencies
|
||||
------------
|
||||
|
||||
- Bump ``sphinx`` from 5.0.2 to 5.1.1 (`#3177`_)
|
||||
- Update ``pre-commit`` Dependencies (`#3085`_)
|
||||
- Bump ``pytest-asyncio`` from 0.18.3 to 0.19.0 (`#3158`_)
|
||||
- Update ``tornado`` requirement from ~=6.1 to ~=6.2 (`#3149`_)
|
||||
- Bump ``black`` from 22.3.0 to 22.6.0 (`#3132`_)
|
||||
- Bump ``actions/setup-python`` from 3 to 4 (`#3131`_)
|
||||
|
||||
.. _`#3195`: https://github.com/python-telegram-bot/python-telegram-bot/pull/3195
|
||||
.. _`#3148`: https://github.com/python-telegram-bot/python-telegram-bot/pull/3148
|
||||
.. _`#3152`: https://github.com/python-telegram-bot/python-telegram-bot/pull/3152
|
||||
.. _`#3126`: https://github.com/python-telegram-bot/python-telegram-bot/pull/3126
|
||||
.. _`#3155`: https://github.com/python-telegram-bot/python-telegram-bot/pull/3155
|
||||
.. _`#3147`: https://github.com/python-telegram-bot/python-telegram-bot/pull/3147
|
||||
.. _`#3136`: https://github.com/python-telegram-bot/python-telegram-bot/pull/3136
|
||||
.. _`#3128`: https://github.com/python-telegram-bot/python-telegram-bot/pull/3128
|
||||
.. _`#3168`: https://github.com/python-telegram-bot/python-telegram-bot/pull/3168
|
||||
.. _`#3167`: https://github.com/python-telegram-bot/python-telegram-bot/pull/3167
|
||||
.. _`#3151`: https://github.com/python-telegram-bot/python-telegram-bot/pull/3151
|
||||
.. _`#3120`: https://github.com/python-telegram-bot/python-telegram-bot/pull/3120
|
||||
.. _`#3127`: https://github.com/python-telegram-bot/python-telegram-bot/pull/3127
|
||||
.. _`#3139`: https://github.com/python-telegram-bot/python-telegram-bot/pull/3139
|
||||
.. _`#3153`: https://github.com/python-telegram-bot/python-telegram-bot/pull/3153
|
||||
.. _`#3135`: https://github.com/python-telegram-bot/python-telegram-bot/pull/3135
|
||||
.. _`#3202`: https://github.com/python-telegram-bot/python-telegram-bot/pull/3202
|
||||
.. _`#3177`: https://github.com/python-telegram-bot/python-telegram-bot/pull/3177
|
||||
.. _`#3085`: https://github.com/python-telegram-bot/python-telegram-bot/pull/3085
|
||||
.. _`#3158`: https://github.com/python-telegram-bot/python-telegram-bot/pull/3158
|
||||
.. _`#3149`: https://github.com/python-telegram-bot/python-telegram-bot/pull/3149
|
||||
.. _`#3132`: https://github.com/python-telegram-bot/python-telegram-bot/pull/3132
|
||||
.. _`#3131`: https://github.com/python-telegram-bot/python-telegram-bot/pull/3131
|
||||
|
||||
Version 20.0a2
|
||||
==============
|
||||
*Released 2022-06-27*
|
||||
|
||||
This is the technical changelog for version 20.0a2. More elaborate release notes can be found in the news channel `@pythontelegrambotchannel <https://t.me/pythontelegrambotchannel>`_.
|
||||
|
||||
Major Changes
|
||||
-------------
|
||||
|
||||
- Full Support for API 6.1 (`#3112`_)
|
||||
|
||||
New Features
|
||||
------------
|
||||
|
||||
- Add Additional Shortcut Methods to ``Chat`` (`#3115`_)
|
||||
- Mermaid-based Example State Diagrams (`#3090`_)
|
||||
|
||||
Minor Changes, Documentation Improvements and CI
|
||||
------------------------------------------------
|
||||
|
||||
- Documentation Improvements (`#3103`_, `#3121`_, `#3098`_)
|
||||
- Stabilize CI (`#3119`_)
|
||||
- Bump ``pyupgrade`` from 2.32.1 to 2.34.0 (`#3096`_)
|
||||
- Bump ``furo`` from 2022.6.4 to 2022.6.4.1 (`#3095`_)
|
||||
- Bump ``mypy`` from 0.960 to 0.961 (`#3093`_)
|
||||
|
||||
.. _`#3112`: https://github.com/python-telegram-bot/python-telegram-bot/pull/3112
|
||||
.. _`#3115`: https://github.com/python-telegram-bot/python-telegram-bot/pull/3115
|
||||
.. _`#3090`: https://github.com/python-telegram-bot/python-telegram-bot/pull/3090
|
||||
.. _`#3103`: https://github.com/python-telegram-bot/python-telegram-bot/pull/3103
|
||||
.. _`#3121`: https://github.com/python-telegram-bot/python-telegram-bot/pull/3121
|
||||
.. _`#3098`: https://github.com/python-telegram-bot/python-telegram-bot/pull/3098
|
||||
.. _`#3119`: https://github.com/python-telegram-bot/python-telegram-bot/pull/3119
|
||||
.. _`#3096`: https://github.com/python-telegram-bot/python-telegram-bot/pull/3096
|
||||
.. _`#3095`: https://github.com/python-telegram-bot/python-telegram-bot/pull/3095
|
||||
.. _`#3093`: https://github.com/python-telegram-bot/python-telegram-bot/pull/3093
|
||||
|
||||
Version 20.0a1
|
||||
==============
|
||||
*Released 2022-06-09*
|
||||
|
||||
This is the technical changelog for version 20.0a1. More elaborate release notes can be found in the news channel `@pythontelegrambotchannel <https://t.me/pythontelegrambotchannel>`_.
|
||||
|
||||
Major Changes:
|
||||
--------------
|
||||
|
||||
- Drop Support for ``ujson`` and instead ``BaseRequest.parse_json_payload`` (`#3037`_, `#3072`_)
|
||||
- Drop ``InputFile.is_image`` (`#3053`_)
|
||||
- Drop Explicit Type conversions in ``__init__`` s (`#3056`_)
|
||||
- Handle List-Valued Attributes More Consistently (`#3057`_)
|
||||
- Split ``{Command, Prefix}Handler`` And Make Attributes Immutable (`#3045`_)
|
||||
- Align Behavior Of ``JobQueue.run_daily`` With ``cron`` (`#3046`_)
|
||||
- Make PTB Specific Keyword-Only Arguments for PTB Specific in Bot methods (`#3035`_)
|
||||
- Adjust Equality Comparisons to Fit Bot API 6.0 (`#3033`_)
|
||||
- Add Tuple Based Version Info (`#3030`_)- Improve Type Annotations for ``CallbackContext`` and Move Default Type Alias to ``ContextTypes.DEFAULT_TYPE`` (`#3017`_, `#3023`_)
|
||||
- Rename ``Job.context`` to ``Job.data`` (`#3028`_)
|
||||
- Rename ``Handler`` to ``BaseHandler`` (`#3019`_)
|
||||
|
||||
New Features:
|
||||
-------------
|
||||
|
||||
- Add ``Application.post_init`` (`#3078`_)
|
||||
- Add Arguments ``chat/user_id`` to ``CallbackContext`` And Example On Custom Webhook Setups (`#3059`_)
|
||||
- Add Convenience Property ``Message.id`` (`#3077`_)
|
||||
- Add Example for ``WebApp`` (`#3052`_)
|
||||
- Rename ``telegram.bot_api_version`` to ``telegram.__bot_api_version__`` (`#3030`_)
|
||||
|
||||
Bug Fixes:
|
||||
----------
|
||||
|
||||
- Fix Non-Blocking Entry Point in ``ConversationHandler`` (`#3068`_)
|
||||
- Escape Backslashes in ``escape_markdown`` (`#3055`_)
|
||||
|
||||
Dependencies:
|
||||
-------------
|
||||
|
||||
- Update ``httpx`` requirement from ~=0.22.0 to ~=0.23.0 (`#3069`_)
|
||||
- Update ``cachetools`` requirement from ~=5.0.0 to ~=5.2.0 (`#3058`_, `#3080`_)
|
||||
|
||||
Minor Changes, Documentation Improvements and CI:
|
||||
-------------------------------------------------
|
||||
|
||||
- Move Examples To Documentation (`#3089`_)
|
||||
- Documentation Improvements and Update Dependencies (`#3010`_, `#3007`_, `#3012`_, `#3067`_, `#3081`_, `#3082`_)
|
||||
- Improve Some Unit Tests (`#3026`_)
|
||||
- Update Code Quality dependencies (`#3070`_, `#3032`_,`#2998`_, `#2999`_)
|
||||
- Don't Set Signal Handlers On Windows By Default (`#3065`_)
|
||||
- Split ``{Command, Prefix}Handler`` And Make Attributes Immutable (`#3045`_)
|
||||
- Apply ``isort`` and Update ``pre-commit.ci`` Configuration (`#3049`_)
|
||||
- Adjust ``pre-commit`` Settings for ``isort`` (`#3043`_)
|
||||
- Add Version Check to Examples (`#3036`_)
|
||||
- Use ``Collection`` Instead of ``List`` and ``Tuple`` (`#3025`_)
|
||||
- Remove Client-Side Parameter Validation (`#3024`_)
|
||||
- Don't Pass Default Values of Optional Parameters to Telegram (`#2978`_)
|
||||
- Stabilize ``Application.run_*`` on Python 3.7 (`#3009`_)
|
||||
- Ignore Code Style Commits in ``git blame`` (`#3003`_)
|
||||
- Adjust Tests to Changed API Behavior (`#3002`_)
|
||||
|
||||
.. _`#2978`: https://github.com/python-telegram-bot/python-telegram-bot/pull/2978
|
||||
.. _`#2998`: https://github.com/python-telegram-bot/python-telegram-bot/pull/2998
|
||||
.. _`#2999`: https://github.com/python-telegram-bot/python-telegram-bot/pull/2999
|
||||
.. _`#3002`: https://github.com/python-telegram-bot/python-telegram-bot/pull/3002
|
||||
.. _`#3003`: https://github.com/python-telegram-bot/python-telegram-bot/pull/3003
|
||||
.. _`#3007`: https://github.com/python-telegram-bot/python-telegram-bot/pull/3007
|
||||
.. _`#3009`: https://github.com/python-telegram-bot/python-telegram-bot/pull/3009
|
||||
.. _`#3010`: https://github.com/python-telegram-bot/python-telegram-bot/pull/3010
|
||||
.. _`#3012`: https://github.com/python-telegram-bot/python-telegram-bot/pull/3012
|
||||
.. _`#3017`: https://github.com/python-telegram-bot/python-telegram-bot/pull/3017
|
||||
.. _`#3019`: https://github.com/python-telegram-bot/python-telegram-bot/pull/3019
|
||||
.. _`#3023`: https://github.com/python-telegram-bot/python-telegram-bot/pull/3023
|
||||
.. _`#3024`: https://github.com/python-telegram-bot/python-telegram-bot/pull/3024
|
||||
.. _`#3025`: https://github.com/python-telegram-bot/python-telegram-bot/pull/3025
|
||||
.. _`#3026`: https://github.com/python-telegram-bot/python-telegram-bot/pull/3026
|
||||
.. _`#3028`: https://github.com/python-telegram-bot/python-telegram-bot/pull/3028
|
||||
.. _`#3030`: https://github.com/python-telegram-bot/python-telegram-bot/pull/3030
|
||||
.. _`#3032`: https://github.com/python-telegram-bot/python-telegram-bot/pull/3032
|
||||
.. _`#3033`: https://github.com/python-telegram-bot/python-telegram-bot/pull/3033
|
||||
.. _`#3035`: https://github.com/python-telegram-bot/python-telegram-bot/pull/3035
|
||||
.. _`#3036`: https://github.com/python-telegram-bot/python-telegram-bot/pull/3036
|
||||
.. _`#3037`: https://github.com/python-telegram-bot/python-telegram-bot/pull/3037
|
||||
.. _`#3043`: https://github.com/python-telegram-bot/python-telegram-bot/pull/3043
|
||||
.. _`#3045`: https://github.com/python-telegram-bot/python-telegram-bot/pull/3045
|
||||
.. _`#3046`: https://github.com/python-telegram-bot/python-telegram-bot/pull/3046
|
||||
.. _`#3049`: https://github.com/python-telegram-bot/python-telegram-bot/pull/3049
|
||||
.. _`#3052`: https://github.com/python-telegram-bot/python-telegram-bot/pull/3052
|
||||
.. _`#3053`: https://github.com/python-telegram-bot/python-telegram-bot/pull/3053
|
||||
.. _`#3055`: https://github.com/python-telegram-bot/python-telegram-bot/pull/3055
|
||||
.. _`#3056`: https://github.com/python-telegram-bot/python-telegram-bot/pull/3056
|
||||
.. _`#3057`: https://github.com/python-telegram-bot/python-telegram-bot/pull/3057
|
||||
.. _`#3058`: https://github.com/python-telegram-bot/python-telegram-bot/pull/3058
|
||||
.. _`#3059`: https://github.com/python-telegram-bot/python-telegram-bot/pull/3059
|
||||
.. _`#3065`: https://github.com/python-telegram-bot/python-telegram-bot/pull/3065
|
||||
.. _`#3067`: https://github.com/python-telegram-bot/python-telegram-bot/pull/3067
|
||||
.. _`#3068`: https://github.com/python-telegram-bot/python-telegram-bot/pull/3068
|
||||
.. _`#3069`: https://github.com/python-telegram-bot/python-telegram-bot/pull/3069
|
||||
.. _`#3070`: https://github.com/python-telegram-bot/python-telegram-bot/pull/3070
|
||||
.. _`#3072`: https://github.com/python-telegram-bot/python-telegram-bot/pull/3072
|
||||
.. _`#3077`: https://github.com/python-telegram-bot/python-telegram-bot/pull/3077
|
||||
.. _`#3078`: https://github.com/python-telegram-bot/python-telegram-bot/pull/3078
|
||||
.. _`#3080`: https://github.com/python-telegram-bot/python-telegram-bot/pull/3080
|
||||
.. _`#3081`: https://github.com/python-telegram-bot/python-telegram-bot/pull/3081
|
||||
.. _`#3082`: https://github.com/python-telegram-bot/python-telegram-bot/pull/3082
|
||||
.. _`#3089`: https://github.com/python-telegram-bot/python-telegram-bot/pull/3089
|
||||
|
||||
Version 20.0a0
|
||||
==============
|
||||
*Released 2022-05-06*
|
||||
|
||||
This is the technical changelog for version 20.0a0. More elaborate release notes can be found in the news channel `@pythontelegrambotchannel <https://t.me/pythontelegrambotchannel>`_.
|
||||
|
||||
Major Changes:
|
||||
--------------
|
||||
|
||||
- Refactor Initialization of Persistence Classes
|
||||
(`#2604 <https://github.com/python-telegram-bot/python-telegram-bot/pull/2604>`__)
|
||||
- Drop Non-``CallbackContext`` API
|
||||
(`#2617 <https://github.com/python-telegram-bot/python-telegram-bot/pull/2617>`__)
|
||||
- Remove ``__dict__`` from ``__slots__`` and drop Python 3.6
|
||||
(`#2619 <https://github.com/python-telegram-bot/python-telegram-bot/pull/2619>`__,
|
||||
`#2636 <https://github.com/python-telegram-bot/python-telegram-bot/pull/2636>`__)
|
||||
- Move and Rename ``TelegramDecryptionError`` to
|
||||
``telegram.error.PassportDecryptionError``
|
||||
(`#2621 <https://github.com/python-telegram-bot/python-telegram-bot/pull/2621>`__)
|
||||
- Make ``BasePersistence`` Methods Abstract
|
||||
(`#2624 <https://github.com/python-telegram-bot/python-telegram-bot/pull/2624>`__)
|
||||
- Remove ``day_is_strict`` argument of ``JobQueue.run_monthly``
|
||||
(`#2634 <https://github.com/python-telegram-bot/python-telegram-bot/pull/2634>`__
|
||||
by `iota-008 <https://github.com/iota-008>`__)
|
||||
- Move ``Defaults`` to ``telegram.ext``
|
||||
(`#2648 <https://github.com/python-telegram-bot/python-telegram-bot/pull/2648>`__)
|
||||
- Remove Deprecated Functionality
|
||||
(`#2644 <https://github.com/python-telegram-bot/python-telegram-bot/pull/2644>`__,
|
||||
`#2740 <https://github.com/python-telegram-bot/python-telegram-bot/pull/2740>`__,
|
||||
`#2745 <https://github.com/python-telegram-bot/python-telegram-bot/pull/2745>`__)
|
||||
- Overhaul of Filters
|
||||
(`#2759 <https://github.com/python-telegram-bot/python-telegram-bot/pull/2759>`__,
|
||||
`#2922 <https://github.com/python-telegram-bot/python-telegram-bot/pull/2922>`__)
|
||||
- Switch to ``asyncio`` and Refactor PTBs Architecture
|
||||
(`#2731 <https://github.com/python-telegram-bot/python-telegram-bot/pull/2731>`__)
|
||||
- Improve ``Job.__getattr__``
|
||||
(`#2832 <https://github.com/python-telegram-bot/python-telegram-bot/pull/2832>`__)
|
||||
- Remove ``telegram.ReplyMarkup``
|
||||
(`#2870 <https://github.com/python-telegram-bot/python-telegram-bot/pull/2870>`__)
|
||||
- Persistence of ``Bots``: Refactor Automatic Replacement and
|
||||
Integration with ``TelegramObject``
|
||||
(`#2893 <https://github.com/python-telegram-bot/python-telegram-bot/pull/2893>`__)
|
||||
|
||||
New Features:
|
||||
-------------
|
||||
|
||||
- Introduce Builder Pattern
|
||||
(`#2646 <https://github.com/python-telegram-bot/python-telegram-bot/pull/2646>`__)
|
||||
- Add ``Filters.update.edited``
|
||||
(`#2705 <https://github.com/python-telegram-bot/python-telegram-bot/pull/2705>`__
|
||||
by `PhilippFr <https://github.com/PhilippFr>`__)
|
||||
- Introduce ``Enums`` for ``telegram.constants``
|
||||
(`#2708 <https://github.com/python-telegram-bot/python-telegram-bot/pull/2708>`__)
|
||||
- Accept File Paths for ``private_key``
|
||||
(`#2724 <https://github.com/python-telegram-bot/python-telegram-bot/pull/2724>`__)
|
||||
- Associate ``Jobs`` with ``chat/user_id``
|
||||
(`#2731 <https://github.com/python-telegram-bot/python-telegram-bot/pull/2731>`__)
|
||||
- Convenience Functionality for ``ChatInviteLinks``
|
||||
(`#2782 <https://github.com/python-telegram-bot/python-telegram-bot/pull/2782>`__)
|
||||
- Add ``Dispatcher.add_handlers``
|
||||
(`#2823 <https://github.com/python-telegram-bot/python-telegram-bot/pull/2823>`__)
|
||||
- Improve Error Messages in ``CommandHandler.__init__``
|
||||
(`#2837 <https://github.com/python-telegram-bot/python-telegram-bot/pull/2837>`__)
|
||||
- ``Defaults.protect_content``
|
||||
(`#2840 <https://github.com/python-telegram-bot/python-telegram-bot/pull/2840>`__)
|
||||
- Add ``Dispatcher.migrate_chat_data``
|
||||
(`#2848 <https://github.com/python-telegram-bot/python-telegram-bot/pull/2848>`__
|
||||
by `DonalDuck004 <https://github.com/DonalDuck004>`__)
|
||||
- Add Method ``drop_chat/user_data`` to ``Dispatcher`` and Persistence
|
||||
(`#2852 <https://github.com/python-telegram-bot/python-telegram-bot/pull/2852>`__)
|
||||
- Add methods ``ChatPermissions.{all, no}_permissions`` (`#2948 <https://github.com/python-telegram-bot/python-telegram-bot/pull/2948>`__)
|
||||
- Full Support for API 6.0
|
||||
(`#2956 <https://github.com/python-telegram-bot/python-telegram-bot/pull/2956>`__)
|
||||
- Add Python 3.10 to Test Suite
|
||||
(`#2968 <https://github.com/python-telegram-bot/python-telegram-bot/pull/2968>`__)
|
||||
|
||||
Bug Fixes & Minor Changes:
|
||||
--------------------------
|
||||
|
||||
- Improve Type Hinting for ``CallbackContext``
|
||||
(`#2587 <https://github.com/python-telegram-bot/python-telegram-bot/pull/2587>`__
|
||||
by `revolter <https://github.com/revolter>`__)
|
||||
- Fix Signatures and Improve ``test_official``
|
||||
(`#2643 <https://github.com/python-telegram-bot/python-telegram-bot/pull/2643>`__)
|
||||
- Refine ``Dispatcher.dispatch_error``
|
||||
(`#2660 <https://github.com/python-telegram-bot/python-telegram-bot/pull/2660>`__)
|
||||
- Make ``InlineQuery.answer`` Raise ``ValueError``
|
||||
(`#2675 <https://github.com/python-telegram-bot/python-telegram-bot/pull/2675>`__)
|
||||
- Improve Signature Inspection for Bot Methods
|
||||
(`#2686 <https://github.com/python-telegram-bot/python-telegram-bot/pull/2686>`__)
|
||||
- Introduce ``TelegramObject.set/get_bot``
|
||||
(`#2712 <https://github.com/python-telegram-bot/python-telegram-bot/pull/2712>`__
|
||||
by `zpavloudis <https://github.com/zpavloudis>`__)
|
||||
- Improve Subscription of ``TelegramObject``
|
||||
(`#2719 <https://github.com/python-telegram-bot/python-telegram-bot/pull/2719>`__
|
||||
by `SimonDamberg <https://github.com/SimonDamberg>`__)
|
||||
- Use Enums for Dynamic Types & Rename Two Attributes in ``ChatMember``
|
||||
(`#2817 <https://github.com/python-telegram-bot/python-telegram-bot/pull/2817>`__)
|
||||
- Return Plain Dicts from ``BasePersistence.get_*_data``
|
||||
(`#2873 <https://github.com/python-telegram-bot/python-telegram-bot/pull/2873>`__)
|
||||
- Fix a Bug in ``ChatMemberUpdated.difference``
|
||||
(`#2947 <https://github.com/python-telegram-bot/python-telegram-bot/pull/2947>`__)
|
||||
- Update Dependency Policy
|
||||
(`#2958 <https://github.com/python-telegram-bot/python-telegram-bot/pull/2958>`__)
|
||||
|
||||
Internal Restructurings & Improvements:
|
||||
---------------------------------------
|
||||
|
||||
- Add User Friendly Type Check For Init Of
|
||||
``{Inline, Reply}KeyboardMarkup``
|
||||
(`#2657 <https://github.com/python-telegram-bot/python-telegram-bot/pull/2657>`__)
|
||||
- Warnings Overhaul
|
||||
(`#2662 <https://github.com/python-telegram-bot/python-telegram-bot/pull/2662>`__)
|
||||
- Clear Up Import Policy
|
||||
(`#2671 <https://github.com/python-telegram-bot/python-telegram-bot/pull/2671>`__)
|
||||
- Mark Internal Modules As Private
|
||||
(`#2687 <https://github.com/python-telegram-bot/python-telegram-bot/pull/2687>`__
|
||||
by `kencx <https://github.com/kencx>`__)
|
||||
- Handle Filepaths via the ``pathlib`` Module
|
||||
(`#2688 <https://github.com/python-telegram-bot/python-telegram-bot/pull/2688>`__
|
||||
by `eldbud <https://github.com/eldbud>`__)
|
||||
- Refactor MRO of ``InputMedia*`` and Some File-Like Classes
|
||||
(`#2717 <https://github.com/python-telegram-bot/python-telegram-bot/pull/2717>`__
|
||||
by `eldbud <https://github.com/eldbud>`__)
|
||||
- Update Exceptions for Immutable Attributes
|
||||
(`#2749 <https://github.com/python-telegram-bot/python-telegram-bot/pull/2749>`__)
|
||||
- Refactor Warnings in ``ConversationHandler``
|
||||
(`#2755 <https://github.com/python-telegram-bot/python-telegram-bot/pull/2755>`__,
|
||||
`#2784 <https://github.com/python-telegram-bot/python-telegram-bot/pull/2784>`__)
|
||||
- Use ``__all__`` Consistently
|
||||
(`#2805 <https://github.com/python-telegram-bot/python-telegram-bot/pull/2805>`__)
|
||||
|
||||
CI, Code Quality & Test Suite Improvements:
|
||||
-------------------------------------------
|
||||
|
||||
- Add Custom ``pytest`` Marker to Ease Development
|
||||
(`#2628 <https://github.com/python-telegram-bot/python-telegram-bot/pull/2628>`__)
|
||||
- Pass Failing Jobs to Error Handlers
|
||||
(`#2692 <https://github.com/python-telegram-bot/python-telegram-bot/pull/2692>`__)
|
||||
- Update Notification Workflows
|
||||
(`#2695 <https://github.com/python-telegram-bot/python-telegram-bot/pull/2695>`__)
|
||||
- Use Error Messages for ``pylint`` Instead of Codes
|
||||
(`#2700 <https://github.com/python-telegram-bot/python-telegram-bot/pull/2700>`__
|
||||
by `Piraty <https://github.com/Piraty>`__)
|
||||
- Make Tests Agnostic of the CWD
|
||||
(`#2727 <https://github.com/python-telegram-bot/python-telegram-bot/pull/2727>`__
|
||||
by `eldbud <https://github.com/eldbud>`__)
|
||||
- Update Code Quality Dependencies
|
||||
(`#2748 <https://github.com/python-telegram-bot/python-telegram-bot/pull/2748>`__)
|
||||
- Improve Code Quality
|
||||
(`#2783 <https://github.com/python-telegram-bot/python-telegram-bot/pull/2783>`__)
|
||||
- Update ``pre-commit`` Settings & Improve a Test
|
||||
(`#2796 <https://github.com/python-telegram-bot/python-telegram-bot/pull/2796>`__)
|
||||
- Improve Code Quality & Test Suite
|
||||
(`#2843 <https://github.com/python-telegram-bot/python-telegram-bot/pull/2843>`__)
|
||||
- Fix failing animation tests
|
||||
(`#2865 <https://github.com/python-telegram-bot/python-telegram-bot/pull/2865>`__)
|
||||
- Update and Expand Tests & pre-commit Settings and Improve Code
|
||||
Quality
|
||||
(`#2925 <https://github.com/python-telegram-bot/python-telegram-bot/pull/2925>`__)
|
||||
- Extend Code Formatting With Black
|
||||
(`#2972 <https://github.com/python-telegram-bot/python-telegram-bot/pull/2972>`__)
|
||||
- Update Workflow Permissions
|
||||
(`#2984 <https://github.com/python-telegram-bot/python-telegram-bot/pull/2984>`__)
|
||||
- Adapt Tests to Changed ``Bot.get_file`` Behavior
|
||||
(`#2995 <https://github.com/python-telegram-bot/python-telegram-bot/pull/2995>`__)
|
||||
|
||||
Documentation Improvements:
|
||||
---------------------------
|
||||
|
||||
- Doc Fixes
|
||||
(`#2597 <https://github.com/python-telegram-bot/python-telegram-bot/pull/2597>`__)
|
||||
- Add Code Comment Guidelines to Contribution Guide
|
||||
(`#2612 <https://github.com/python-telegram-bot/python-telegram-bot/pull/2612>`__)
|
||||
- Add Cross-References to External Libraries & Other Documentation
|
||||
Improvements
|
||||
(`#2693 <https://github.com/python-telegram-bot/python-telegram-bot/pull/2693>`__,
|
||||
`#2691 <https://github.com/python-telegram-bot/python-telegram-bot/pull/2691>`__
|
||||
by `joesinghh <https://github.com/joesinghh>`__,
|
||||
`#2739 <https://github.com/python-telegram-bot/python-telegram-bot/pull/2739>`__
|
||||
by `eldbud <https://github.com/eldbud>`__)
|
||||
- Use Furo Theme, Make Parameters Referenceable, Add Documentation
|
||||
Building to CI, Improve Links to Source Code & Other Improvements
|
||||
(`#2856 <https://github.com/python-telegram-bot/python-telegram-bot/pull/2856>`__,
|
||||
`#2798 <https://github.com/python-telegram-bot/python-telegram-bot/pull/2798>`__,
|
||||
`#2854 <https://github.com/python-telegram-bot/python-telegram-bot/pull/2854>`__,
|
||||
`#2841 <https://github.com/python-telegram-bot/python-telegram-bot/pull/2841>`__)
|
||||
- Documentation Fixes & Improvements
|
||||
(`#2822 <https://github.com/python-telegram-bot/python-telegram-bot/pull/2822>`__)
|
||||
- Replace ``git.io`` Links
|
||||
(`#2872 <https://github.com/python-telegram-bot/python-telegram-bot/pull/2872>`__
|
||||
by `murugu-21 <https://github.com/murugu-21>`__)
|
||||
- Overhaul Readmes, Update RTD Startpage & Other Improvements
|
||||
(`#2969 <https://github.com/python-telegram-bot/python-telegram-bot/pull/2969>`__)
|
||||
|
||||
Version 13.11
|
||||
=============
|
||||
*Released 2022-02-02*
|
||||
|
||||
This is the technical changelog for version 13.11. More elaborate release notes can be found in the news channel `@pythontelegrambotchannel <https://t.me/pythontelegrambotchannel>`_.
|
||||
|
||||
**Major Changes:**
|
||||
|
||||
- Full Support for Bot API 5.7 (`#2881`_)
|
||||
|
||||
.. _`#2881`: https://github.com/python-telegram-bot/python-telegram-bot/pull/2881
|
||||
|
||||
Version 13.10
|
||||
=============
|
||||
*Released 2022-01-03*
|
||||
|
||||
This is the technical changelog for version 13.10. More elaborate release notes can be found in the news channel `@pythontelegrambotchannel <https://t.me/pythontelegrambotchannel>`_.
|
||||
|
||||
**Major Changes:**
|
||||
|
||||
- Full Support for API 5.6 (`#2835`_)
|
||||
|
||||
**Minor Changes & Doc fixes:**
|
||||
|
||||
- Update Copyright to 2022 (`#2836`_)
|
||||
- Update Documentation of ``BotCommand`` (`#2820`_)
|
||||
|
||||
.. _`#2835`: https://github.com/python-telegram-bot/python-telegram-bot/pull/2835
|
||||
.. _`#2836`: https://github.com/python-telegram-bot/python-telegram-bot/pull/2836
|
||||
.. _`#2820`: https://github.com/python-telegram-bot/python-telegram-bot/pull/2820
|
||||
|
||||
Version 13.9
|
||||
============
|
||||
*Released 2021-12-11*
|
||||
|
||||
This is the technical changelog for version 13.9. More elaborate release notes can be found in the news channel `@pythontelegrambotchannel <https://t.me/pythontelegrambotchannel>`_.
|
||||
|
||||
**Major Changes:**
|
||||
|
||||
- Full Support for Api 5.5 (`#2809`_)
|
||||
|
||||
**Minor Changes**
|
||||
|
||||
- Adjust Automated Locking of Inactive Issues (`#2775`_)
|
||||
|
||||
.. _`#2809`: https://github.com/python-telegram-bot/python-telegram-bot/pull/2809
|
||||
.. _`#2775`: https://github.com/python-telegram-bot/python-telegram-bot/pull/2775
|
||||
|
||||
Version 13.8.1
|
||||
==============
|
||||
*Released 2021-11-08*
|
||||
|
||||
This is the technical changelog for version 13.8.1. More elaborate release notes can be found in the news channel `@pythontelegrambotchannel <https://t.me/pythontelegrambotchannel>`_.
|
||||
|
||||
**Doc fixes:**
|
||||
|
||||
- Add ``ChatJoinRequest(Handler)`` to Docs (`#2771`_)
|
||||
|
||||
.. _`#2771`: https://github.com/python-telegram-bot/python-telegram-bot/pull/2771
|
||||
|
||||
Version 13.8
|
||||
============
|
||||
*Released 2021-11-08*
|
||||
|
||||
This is the technical changelog for version 13.8. More elaborate release notes can be found in the news channel `@pythontelegrambotchannel <https://t.me/pythontelegrambotchannel>`_.
|
||||
|
||||
**Major Changes:**
|
||||
|
||||
- Full support for API 5.4 (`#2767`_)
|
||||
|
||||
**Minor changes, CI improvements, Doc fixes and Type hinting:**
|
||||
|
||||
- Create Issue Template Forms (`#2689`_)
|
||||
- Fix ``camelCase`` Functions in ``ExtBot`` (`#2659`_)
|
||||
- Fix Empty Captions not Being Passed by ``Bot.copy_message`` (`#2651`_)
|
||||
- Fix Setting Thumbs When Uploading A Single File (`#2583`_)
|
||||
- Fix Bug in ``BasePersistence.insert``/``replace_bot`` for Objects with ``__dict__`` not in ``__slots__`` (`#2603`_)
|
||||
|
||||
.. _`#2767`: https://github.com/python-telegram-bot/python-telegram-bot/pull/2767
|
||||
.. _`#2689`: https://github.com/python-telegram-bot/python-telegram-bot/pull/2689
|
||||
.. _`#2659`: https://github.com/python-telegram-bot/python-telegram-bot/pull/2659
|
||||
.. _`#2651`: https://github.com/python-telegram-bot/python-telegram-bot/pull/2651
|
||||
.. _`#2583`: https://github.com/python-telegram-bot/python-telegram-bot/pull/2583
|
||||
.. _`#2603`: https://github.com/python-telegram-bot/python-telegram-bot/pull/2603
|
||||
|
||||
Version 13.7
|
||||
============
|
||||
*Released 2021-07-01*
|
||||
|
||||
This is the technical changelog for version 13.7. More elaborate release notes can be found in the news channel `@pythontelegrambotchannel <https://t.me/pythontelegrambotchannel>`_.
|
||||
|
||||
**Major Changes:**
|
||||
|
||||
- Full support for Bot API 5.3 (`#2572`_)
|
||||
|
||||
**Bug Fixes:**
|
||||
|
||||
- Fix Bug in ``BasePersistence.insert/replace_bot`` for Objects with ``__dict__`` in their slots (`#2561`_)
|
||||
- Remove Incorrect Warning About ``Defaults`` and ``ExtBot`` (`#2553`_)
|
||||
|
||||
**Minor changes, CI improvements, Doc fixes and Type hinting:**
|
||||
|
||||
- Type Hinting Fixes (`#2552`_)
|
||||
- Doc Fixes (`#2551`_)
|
||||
- Improve Deprecation Warning for ``__slots__`` (`#2574`_)
|
||||
- Stabilize CI (`#2575`_)
|
||||
- Fix Coverage Configuration (`#2571`_)
|
||||
- Better Exception-Handling for ``BasePersistence.replace/insert_bot`` (`#2564`_)
|
||||
- Remove Deprecated ``pass_args`` from Deeplinking Example (`#2550`_)
|
||||
|
||||
.. _`#2572`: https://github.com/python-telegram-bot/python-telegram-bot/pull/2572
|
||||
.. _`#2561`: https://github.com/python-telegram-bot/python-telegram-bot/pull/2561
|
||||
.. _`#2553`: https://github.com/python-telegram-bot/python-telegram-bot/pull/2553
|
||||
.. _`#2552`: https://github.com/python-telegram-bot/python-telegram-bot/pull/2552
|
||||
.. _`#2551`: https://github.com/python-telegram-bot/python-telegram-bot/pull/2551
|
||||
.. _`#2574`: https://github.com/python-telegram-bot/python-telegram-bot/pull/2574
|
||||
.. _`#2575`: https://github.com/python-telegram-bot/python-telegram-bot/pull/2575
|
||||
.. _`#2571`: https://github.com/python-telegram-bot/python-telegram-bot/pull/2571
|
||||
.. _`#2564`: https://github.com/python-telegram-bot/python-telegram-bot/pull/2564
|
||||
.. _`#2550`: https://github.com/python-telegram-bot/python-telegram-bot/pull/2550
|
||||
|
||||
Version 13.6
|
||||
============
|
||||
*Released 2021-06-06*
|
||||
|
||||
New Features:
|
||||
|
||||
- Arbitrary ``callback_data`` (`#1844`_)
|
||||
- Add ``ContextTypes`` & ``BasePersistence.refresh_user/chat/bot_data`` (`#2262`_)
|
||||
- Add ``Filters.attachment`` (`#2528`_)
|
||||
- Add ``pattern`` Argument to ``ChosenInlineResultHandler`` (`#2517`_)
|
||||
|
||||
Major Changes:
|
||||
|
||||
- Add ``slots`` (`#2345`_)
|
||||
|
||||
Minor changes, CI improvements, Doc fixes and Type hinting:
|
||||
|
||||
- Doc Fixes (`#2495`_, `#2510`_)
|
||||
- Add ``max_connections`` Parameter to ``Updater.start_webhook`` (`#2547`_)
|
||||
- Fix for ``Promise.done_callback`` (`#2544`_)
|
||||
- Improve Code Quality (`#2536`_, `#2454`_)
|
||||
- Increase Test Coverage of ``CallbackQueryHandler`` (`#2520`_)
|
||||
- Stabilize CI (`#2522`_, `#2537`_, `#2541`_)
|
||||
- Fix ``send_phone_number_to_provider`` argument for ``Bot.send_invoice`` (`#2527`_)
|
||||
- Handle Classes as Input for ``BasePersistence.replace/insert_bot`` (`#2523`_)
|
||||
- Bump Tornado Version and Remove Workaround from `#2067`_ (`#2494`_)
|
||||
|
||||
.. _`#1844`: https://github.com/python-telegram-bot/python-telegram-bot/pull/1844
|
||||
.. _`#2262`: https://github.com/python-telegram-bot/python-telegram-bot/pull/2262
|
||||
.. _`#2528`: https://github.com/python-telegram-bot/python-telegram-bot/pull/2528
|
||||
.. _`#2517`: https://github.com/python-telegram-bot/python-telegram-bot/pull/2517
|
||||
.. _`#2345`: https://github.com/python-telegram-bot/python-telegram-bot/pull/2345
|
||||
.. _`#2495`: https://github.com/python-telegram-bot/python-telegram-bot/pull/2495
|
||||
.. _`#2547`: https://github.com/python-telegram-bot/python-telegram-bot/pull/2547
|
||||
.. _`#2544`: https://github.com/python-telegram-bot/python-telegram-bot/pull/2544
|
||||
.. _`#2536`: https://github.com/python-telegram-bot/python-telegram-bot/pull/2536
|
||||
.. _`#2454`: https://github.com/python-telegram-bot/python-telegram-bot/pull/2454
|
||||
.. _`#2520`: https://github.com/python-telegram-bot/python-telegram-bot/pull/2520
|
||||
.. _`#2522`: https://github.com/python-telegram-bot/python-telegram-bot/pull/2522
|
||||
.. _`#2537`: https://github.com/python-telegram-bot/python-telegram-bot/pull/2537
|
||||
.. _`#2541`: https://github.com/python-telegram-bot/python-telegram-bot/pull/2541
|
||||
.. _`#2527`: https://github.com/python-telegram-bot/python-telegram-bot/pull/2527
|
||||
.. _`#2523`: https://github.com/python-telegram-bot/python-telegram-bot/pull/2523
|
||||
.. _`#2067`: https://github.com/python-telegram-bot/python-telegram-bot/pull/2067
|
||||
.. _`#2494`: https://github.com/python-telegram-bot/python-telegram-bot/pull/2494
|
||||
.. _`#2510`: https://github.com/python-telegram-bot/python-telegram-bot/pull/2510
|
||||
|
||||
Version 13.5
|
||||
============
|
||||
*Released 2021-04-30*
|
||||
|
||||
**Major Changes:**
|
||||
|
||||
- Full support of Bot API 5.2 (`#2489`_).
|
||||
|
||||
.. note::
|
||||
The ``start_parameter`` argument of ``Bot.send_invoice`` and the corresponding shortcuts is now optional, so the order of
|
||||
parameters had to be changed. Make sure to update your method calls accordingly.
|
||||
|
||||
- Update ``ChatActions``, Deprecating ``ChatAction.RECORD_AUDIO`` and ``ChatAction.UPLOAD_AUDIO`` (`#2460`_)
|
||||
|
||||
**New Features:**
|
||||
|
||||
- Convenience Utilities & Example for Handling ``ChatMemberUpdated`` (`#2490`_)
|
||||
- ``Filters.forwarded_from`` (`#2446`_)
|
||||
|
||||
**Minor changes, CI improvements, Doc fixes and Type hinting:**
|
||||
|
||||
- Improve Timeouts in ``ConversationHandler`` (`#2417`_)
|
||||
- Stabilize CI (`#2480`_)
|
||||
- Doc Fixes (`#2437`_)
|
||||
- Improve Type Hints of Data Filters (`#2456`_)
|
||||
- Add Two ``UserWarnings`` (`#2464`_)
|
||||
- Improve Code Quality (`#2450`_)
|
||||
- Update Fallback Test-Bots (`#2451`_)
|
||||
- Improve Examples (`#2441`_, `#2448`_)
|
||||
|
||||
.. _`#2489`: https://github.com/python-telegram-bot/python-telegram-bot/pull/2489
|
||||
.. _`#2460`: https://github.com/python-telegram-bot/python-telegram-bot/pull/2460
|
||||
.. _`#2490`: https://github.com/python-telegram-bot/python-telegram-bot/pull/2490
|
||||
.. _`#2446`: https://github.com/python-telegram-bot/python-telegram-bot/pull/2446
|
||||
.. _`#2417`: https://github.com/python-telegram-bot/python-telegram-bot/pull/2417
|
||||
.. _`#2480`: https://github.com/python-telegram-bot/python-telegram-bot/pull/2480
|
||||
.. _`#2437`: https://github.com/python-telegram-bot/python-telegram-bot/pull/2437
|
||||
.. _`#2456`: https://github.com/python-telegram-bot/python-telegram-bot/pull/2456
|
||||
.. _`#2464`: https://github.com/python-telegram-bot/python-telegram-bot/pull/2464
|
||||
.. _`#2450`: https://github.com/python-telegram-bot/python-telegram-bot/pull/2450
|
||||
.. _`#2451`: https://github.com/python-telegram-bot/python-telegram-bot/pull/2451
|
||||
.. _`#2441`: https://github.com/python-telegram-bot/python-telegram-bot/pull/2441
|
||||
.. _`#2448`: https://github.com/python-telegram-bot/python-telegram-bot/pull/2448
|
||||
|
||||
Version 13.4.1
|
||||
==============
|
||||
*Released 2021-03-14*
|
||||
|
||||
**Hot fix release:**
|
||||
|
||||
- Fixed a bug in ``setup.py`` (`#2431`_)
|
||||
|
||||
.. _`#2431`: https://github.com/python-telegram-bot/python-telegram-bot/pull/2431
|
||||
|
||||
Version 13.4
|
||||
============
|
||||
*Released 2021-03-14*
|
||||
|
||||
**Major Changes:**
|
||||
|
||||
- Full support of Bot API 5.1 (`#2424`_)
|
||||
|
||||
**Minor changes, CI improvements, doc fixes and type hinting:**
|
||||
|
||||
- Improve ``Updater.set_webhook`` (`#2419`_)
|
||||
- Doc Fixes (`#2404`_)
|
||||
- Type Hinting Fixes (`#2425`_)
|
||||
- Update ``pre-commit`` Settings (`#2415`_)
|
||||
- Fix Logging for Vendored ``urllib3`` (`#2427`_)
|
||||
- Stabilize Tests (`#2409`_)
|
||||
|
||||
.. _`#2424`: https://github.com/python-telegram-bot/python-telegram-bot/pull/2424
|
||||
.. _`#2419`: https://github.com/python-telegram-bot/python-telegram-bot/pull/2419
|
||||
.. _`#2404`: https://github.com/python-telegram-bot/python-telegram-bot/pull/2404
|
||||
.. _`#2425`: https://github.com/python-telegram-bot/python-telegram-bot/pull/2425
|
||||
.. _`#2415`: https://github.com/python-telegram-bot/python-telegram-bot/pull/2415
|
||||
.. _`#2427`: https://github.com/python-telegram-bot/python-telegram-bot/pull/2427
|
||||
.. _`#2409`: https://github.com/python-telegram-bot/python-telegram-bot/pull/2409
|
||||
|
||||
Version 13.3
|
||||
============
|
||||
*Released 2021-02-19*
|
||||
@@ -648,7 +1305,7 @@ Expect minor releases soon (mainly complete Bot API 4.4 support)
|
||||
- Error Handler now handles all types of exceptions (`#1485`_)
|
||||
- Return UTC from from_timestamp() (`#1485`_)
|
||||
|
||||
**See the wiki page at https://git.io/fxJuV for a detailed guide on how to migrate from version 11 to version 12.**
|
||||
**See the wiki page at https://github.com/python-telegram-bot/python-telegram-bot/wiki/Transition-guide-to-Version-12.0 for a detailed guide on how to migrate from version 11 to version 12.**
|
||||
|
||||
Context based callbacks (`#1100`_)
|
||||
----------------------------------
|
||||
@@ -853,7 +1510,7 @@ Non Bot API 4.0 changes:
|
||||
.. _`#1172`: https://github.com/python-telegram-bot/python-telegram-bot/pull/1172
|
||||
.. _`#1179`: https://github.com/python-telegram-bot/python-telegram-bot/pull/1179
|
||||
.. _`#1184`: https://github.com/python-telegram-bot/python-telegram-bot/pull/1184
|
||||
.. _`our telegram passport wiki page`: https://git.io/fAvYd
|
||||
.. _`our telegram passport wiki page`: https://github.com/python-telegram-bot/python-telegram-bot/wiki/Telegram-Passport
|
||||
|
||||
Version 10.1.0
|
||||
==============
|
||||
@@ -1078,7 +1735,7 @@ Changes
|
||||
- Lots of small improvements to our tests and documentation.
|
||||
|
||||
|
||||
.. _`see docs`: http://python-telegram-bot.readthedocs.io/en/stable/telegram.ext.dispatcher.html#telegram.ext.Dispatcher.add_handler
|
||||
.. _`see docs`: https://docs.python-telegram-bot.org/en/stable/telegram.ext.dispatcher.html#telegram.ext.Dispatcher.add_handler
|
||||
.. _`#777`: https://github.com/python-telegram-bot/python-telegram-bot/pull/777
|
||||
.. _`#806`: https://github.com/python-telegram-bot/python-telegram-bot/pull/806
|
||||
.. _`#766`: https://github.com/python-telegram-bot/python-telegram-bot/pull/766
|
||||
@@ -1320,7 +1977,7 @@ Pre-version 7.0
|
||||
|
||||
- Implement Bot API 2.0
|
||||
- Almost complete recode of ``Dispatcher``
|
||||
- Please read the `Transistion Guide to 4.0 <https://github.com/python-telegram-bot/python-telegram-bot/wiki/Transistion-guide-to-Version-4.0>`_
|
||||
- Please read the `Transistion Guide to 4.0 <https://github.com/python-telegram-bot/python-telegram-bot/wiki/Transition-guide-to-Version-4.0>`_
|
||||
|
||||
**2016-03-22**
|
||||
|
||||
|
||||
@@ -1,10 +1,14 @@
|
||||
# Contributor Covenant Code of Conduct
|
||||
====================================
|
||||
Contributor Covenant Code of Conduct
|
||||
====================================
|
||||
|
||||
## Our Pledge
|
||||
Our Pledge
|
||||
==========
|
||||
|
||||
In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
|
||||
|
||||
## Our Standards
|
||||
Our Standards
|
||||
=============
|
||||
|
||||
Examples of behavior that contributes to creating a positive environment include:
|
||||
|
||||
@@ -23,25 +27,26 @@ Examples of unacceptable behavior by participants include:
|
||||
* Publishing others' private information, such as a physical or electronic address, without explicit permission
|
||||
* Other conduct which could reasonably be considered inappropriate in a professional setting
|
||||
|
||||
## Our Responsibilities
|
||||
Our Responsibilities
|
||||
====================
|
||||
|
||||
Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
|
||||
|
||||
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
|
||||
|
||||
## Scope
|
||||
Scope
|
||||
=====
|
||||
|
||||
This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
|
||||
|
||||
## Enforcement
|
||||
Enforcement
|
||||
===========
|
||||
|
||||
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at devs@python-telegram-bot.org. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
|
||||
|
||||
Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
|
||||
|
||||
## Attribution
|
||||
Attribution
|
||||
===========
|
||||
|
||||
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]
|
||||
|
||||
[homepage]: http://contributor-covenant.org
|
||||
[version]: http://contributor-covenant.org/version/1/4/
|
||||
This Code of Conduct is adapted from the `Contributor Covenant <https://www.contributor-covenant.org>`_, version 1.4, available at `https://www.contributor-covenant.org/version/1/4 <https://www.contributor-covenant.org/version/1/4/>`_.
|
||||
+1
-1
@@ -1 +1 @@
|
||||
include LICENSE LICENSE.lesser Makefile requirements.txt README_RAW.rst telegram/py.typed
|
||||
include LICENSE LICENSE.lesser Makefile requirements.txt requirements-opts.txt README_RAW.rst telegram/py.typed
|
||||
|
||||
@@ -1,53 +0,0 @@
|
||||
.DEFAULT_GOAL := help
|
||||
.PHONY: clean pep8 black lint test install
|
||||
|
||||
PYLINT := pylint
|
||||
PYTEST := pytest
|
||||
PEP8 := flake8
|
||||
BLACK := black
|
||||
MYPY := mypy
|
||||
PIP := pip
|
||||
|
||||
clean:
|
||||
rm -fr build
|
||||
rm -fr dist
|
||||
find . -name '*.pyc' -exec rm -f {} \;
|
||||
find . -name '*.pyo' -exec rm -f {} \;
|
||||
find . -name '*~' -exec rm -f {} \;
|
||||
find . -regex "./telegram[0-9]*.\(jpg\|mp3\|mp4\|ogg\|png\|webp\)" -exec rm {} \;
|
||||
|
||||
pep8:
|
||||
$(PEP8) telegram tests examples
|
||||
|
||||
black:
|
||||
$(BLACK) .
|
||||
|
||||
lint:
|
||||
$(PYLINT) --rcfile=setup.cfg telegram examples
|
||||
|
||||
mypy:
|
||||
$(MYPY) -p telegram
|
||||
$(MYPY) examples
|
||||
|
||||
test:
|
||||
$(PYTEST) -v
|
||||
|
||||
install:
|
||||
$(PIP) install -r requirements.txt -r requirements-dev.txt
|
||||
|
||||
help:
|
||||
@echo "Available targets:"
|
||||
@echo "- clean Clean up the source directory"
|
||||
@echo "- pep8 Check style with flake8"
|
||||
@echo "- lint Check style with pylint"
|
||||
@echo "- black Check style with black"
|
||||
@echo "- mypy Check type hinting with mypy"
|
||||
@echo "- test Run tests using pytest"
|
||||
@echo
|
||||
@echo "Available variables:"
|
||||
@echo "- PYLINT default: $(PYLINT)"
|
||||
@echo "- PYTEST default: $(PYTEST)"
|
||||
@echo "- PEP8 default: $(PEP8)"
|
||||
@echo "- BLACK default: $(BLACK)"
|
||||
@echo "- MYPY default: $(MYPY)"
|
||||
@echo "- PIP default: $(PIP)"
|
||||
+90
-126
@@ -1,17 +1,11 @@
|
||||
..
|
||||
Make user to apply any changes to this file to README_RAW.rst as well!
|
||||
Make sure to apply any changes to this file to README_RAW.rst as well!
|
||||
|
||||
.. image:: https://github.com/python-telegram-bot/logos/blob/master/logo-text/png/ptb-logo-text_768.png?raw=true
|
||||
.. image:: https://raw.githubusercontent.com/python-telegram-bot/logos/master/logo-text/png/ptb-logo-text_768.png
|
||||
:align: center
|
||||
:target: https://python-telegram-bot.org
|
||||
:alt: python-telegram-bot Logo
|
||||
|
||||
We have made you a wrapper you can't refuse
|
||||
|
||||
We have a vibrant community of developers helping each other in our `Telegram group <https://telegram.me/pythontelegrambotgroup>`_. Join us!
|
||||
|
||||
*Stay tuned for library updates and new releases on our* `Telegram Channel <https://telegram.me/pythontelegrambotchannel>`_.
|
||||
|
||||
.. image:: https://img.shields.io/pypi/v/python-telegram-bot.svg
|
||||
:target: https://pypi.org/project/python-telegram-bot/
|
||||
:alt: PyPi Package Version
|
||||
@@ -20,7 +14,7 @@ We have a vibrant community of developers helping each other in our `Telegram gr
|
||||
:target: https://pypi.org/project/python-telegram-bot/
|
||||
:alt: Supported Python versions
|
||||
|
||||
.. image:: https://img.shields.io/badge/Bot%20API-5.0-blue?logo=telegram
|
||||
.. image:: https://img.shields.io/badge/Bot%20API-6.2-blue?logo=telegram
|
||||
:target: https://core.telegram.org/bots/api-changelog
|
||||
:alt: Supported Bot API versions
|
||||
|
||||
@@ -29,7 +23,7 @@ We have a vibrant community of developers helping each other in our `Telegram gr
|
||||
:alt: PyPi Package Monthly Download
|
||||
|
||||
.. image:: https://readthedocs.org/projects/python-telegram-bot/badge/?version=stable
|
||||
:target: https://python-telegram-bot.readthedocs.io/en/stable/?badge=stable
|
||||
:target: https://docs.python-telegram-bot.org/en/stable/
|
||||
:alt: Documentation Status
|
||||
|
||||
.. image:: https://img.shields.io/pypi/l/python-telegram-bot.svg
|
||||
@@ -41,59 +35,49 @@ We have a vibrant community of developers helping each other in our `Telegram gr
|
||||
:alt: Github Actions workflow
|
||||
|
||||
.. image:: https://codecov.io/gh/python-telegram-bot/python-telegram-bot/branch/master/graph/badge.svg
|
||||
:target: https://codecov.io/gh/python-telegram-bot/python-telegram-bot
|
||||
:target: https://app.codecov.io/gh/python-telegram-bot/python-telegram-bot
|
||||
:alt: Code coverage
|
||||
|
||||
.. image:: http://isitmaintained.com/badge/resolution/python-telegram-bot/python-telegram-bot.svg
|
||||
:target: http://isitmaintained.com/project/python-telegram-bot/python-telegram-bot
|
||||
.. image:: https://isitmaintained.com/badge/resolution/python-telegram-bot/python-telegram-bot.svg
|
||||
:target: https://isitmaintained.com/project/python-telegram-bot/python-telegram-bot
|
||||
:alt: Median time to resolve an issue
|
||||
|
||||
.. image:: https://api.codacy.com/project/badge/Grade/99d901eaa09b44b4819aec05c330c968
|
||||
:target: https://www.codacy.com/app/python-telegram-bot/python-telegram-bot?utm_source=github.com&utm_medium=referral&utm_content=python-telegram-bot/python-telegram-bot&utm_campaign=Badge_Grade
|
||||
:alt: Code quality
|
||||
:target: https://app.codacy.com/gh/python-telegram-bot/python-telegram-bot/dashboard
|
||||
:alt: Code quality: Codacy
|
||||
|
||||
.. image:: https://deepsource.io/gh/python-telegram-bot/python-telegram-bot.svg/?label=active+issues
|
||||
:target: https://deepsource.io/gh/python-telegram-bot/python-telegram-bot/?ref=repository-badge
|
||||
:alt: Code quality: DeepSource
|
||||
|
||||
.. image:: https://results.pre-commit.ci/badge/github/python-telegram-bot/python-telegram-bot/master.svg
|
||||
:target: https://results.pre-commit.ci/latest/github/python-telegram-bot/python-telegram-bot/master
|
||||
:alt: pre-commit.ci status
|
||||
|
||||
.. image:: https://img.shields.io/badge/code%20style-black-000000.svg
|
||||
:target: https://github.com/psf/black
|
||||
:target: https://github.com/psf/black
|
||||
:alt: Code Style: Black
|
||||
|
||||
.. image:: https://img.shields.io/badge/Telegram-Channel-blue.svg?logo=telegram
|
||||
:target: https://t.me/pythontelegrambotchannel
|
||||
:alt: Telegram Channel
|
||||
|
||||
.. image:: https://img.shields.io/badge/Telegram-Group-blue.svg?logo=telegram
|
||||
:target: https://telegram.me/pythontelegrambotgroup
|
||||
:alt: Telegram Group
|
||||
|
||||
.. image:: https://img.shields.io/badge/IRC-Channel-blue.svg
|
||||
:target: https://webchat.freenode.net/?channels=##python-telegram-bot
|
||||
:alt: IRC Bridge
|
||||
We have made you a wrapper you can't refuse
|
||||
|
||||
=================
|
||||
Table of contents
|
||||
=================
|
||||
We have a vibrant community of developers helping each other in our `Telegram group <https://telegram.me/pythontelegrambotgroup>`_. Join us!
|
||||
|
||||
- `Introduction`_
|
||||
*Stay tuned for library updates and new releases on our* `Telegram Channel <https://telegram.me/pythontelegrambotchannel>`_.
|
||||
|
||||
- `Telegram API support`_
|
||||
|
||||
- `Installing`_
|
||||
|
||||
- `Getting started`_
|
||||
|
||||
#. `Learning by example`_
|
||||
|
||||
#. `Logging`_
|
||||
|
||||
#. `Documentation`_
|
||||
|
||||
- `Getting help`_
|
||||
|
||||
- `Contributing`_
|
||||
|
||||
- `License`_
|
||||
|
||||
============
|
||||
Introduction
|
||||
============
|
||||
|
||||
This library provides a pure Python interface for the
|
||||
This library provides a pure Python, asynchronous interface for the
|
||||
`Telegram Bot API <https://core.telegram.org/bots/api>`_.
|
||||
It's compatible with Python versions 3.6+. PTB might also work on `PyPy <http://pypy.org/>`_, though there have been a lot of issues before. Hence, PyPy is not officially supported.
|
||||
It's compatible with Python versions **3.7+**.
|
||||
|
||||
In addition to the pure API implementation, this library features a number of high-level classes to
|
||||
make the development of bots easy and straightforward. These classes are contained in the
|
||||
@@ -101,137 +85,117 @@ make the development of bots easy and straightforward. These classes are contain
|
||||
|
||||
A pure API implementation *without* ``telegram.ext`` is available as the standalone package ``python-telegram-bot-raw``. `See here for details. <https://github.com/python-telegram-bot/python-telegram-bot/blob/master/README_RAW.rst>`_
|
||||
|
||||
----
|
||||
Note
|
||||
----
|
||||
|
||||
Installing both ``python-telegram-bot`` and ``python-telegram-bot-raw`` in conjunction will result in undesired side-effects, so only install *one* of both.
|
||||
|
||||
====================
|
||||
Telegram API support
|
||||
====================
|
||||
|
||||
All types and methods of the Telegram Bot API **5.0** are supported.
|
||||
All types and methods of the Telegram Bot API **6.2** are supported.
|
||||
|
||||
==========
|
||||
Installing
|
||||
==========
|
||||
|
||||
You can install or upgrade python-telegram-bot with:
|
||||
You can install or upgrade ``python-telegram-bot`` via
|
||||
|
||||
.. code:: shell
|
||||
|
||||
$ pip install python-telegram-bot --upgrade
|
||||
|
||||
Or you can install from source with:
|
||||
To install a pre-release, use the ``--pre`` `flag <https://pip.pypa.io/en/stable/cli/pip_install/#cmdoption-pre>`_ in addition.
|
||||
|
||||
You can also install ``python-telegram-bot`` from source, though this is usually not necessary.
|
||||
|
||||
.. code:: shell
|
||||
|
||||
$ git clone https://github.com/python-telegram-bot/python-telegram-bot --recursive
|
||||
$ git clone https://github.com/python-telegram-bot/python-telegram-bot
|
||||
$ cd python-telegram-bot
|
||||
$ python setup.py install
|
||||
|
||||
In case you have a previously cloned local repository already, you should initialize the added urllib3 submodule before installing with:
|
||||
|
||||
.. code:: shell
|
||||
Dependencies & Their Versions
|
||||
-----------------------------
|
||||
|
||||
$ git submodule update --init --recursive
|
||||
``python-telegram-bot`` tries to use as few 3rd party dependencies as possible.
|
||||
However, for some features using a 3rd party library is more sane than implementing the functionality again.
|
||||
The dependencies are:
|
||||
|
||||
* `httpx ~= 0.23.0 <https://www.python-httpx.org>`_ for ``telegram.request.HTTPXRequest``, the default networking backend
|
||||
* `tornado~=6.2 <https://www.tornadoweb.org/en/stable/>`_ for ``telegram.ext.Updater.start_webhook``
|
||||
* `cachetools~=5.2.0 <https://cachetools.readthedocs.io/en/latest/>`_ for ``telegram.ext.CallbackDataCache``
|
||||
* `APScheduler~=3.9.1 <https://apscheduler.readthedocs.io/en/3.x/>`_ for ``telegram.ext.JobQueue``
|
||||
|
||||
``python-telegram-bot`` is most useful when used along with additional libraries.
|
||||
To minimize dependency conflicts, we try to be liberal in terms of version requirements on the dependencies.
|
||||
On the other hand, we have to ensure stability of ``python-telegram-bot``, which is why we do apply version bounds.
|
||||
If you encounter dependency conflicts due to these bounds, feel free to reach out.
|
||||
|
||||
---------------------
|
||||
Optional Dependencies
|
||||
---------------------
|
||||
|
||||
PTB can be installed with optional dependencies:
|
||||
|
||||
* ``pip install python-telegram-bot[passport]`` installs the `cryptography <https://cryptography.io>`_ library. Use this, if you want to use Telegram Passport related functionality.
|
||||
* ``pip install python-telegram-bot[ujson]`` installs the `ujson <https://pypi.org/project/ujson/>`_ library. It will then be used for JSON de- & encoding, which can bring speed up compared to the standard `json <https://docs.python.org/3/library/json.html>`_ library.
|
||||
* ``pip install python-telegram-bot[socks]`` installs the `PySocks <https://pypi.org/project/PySocks/>`_ library. Use this, if you want to work behind a Socks5 server.
|
||||
* ``pip install python-telegram-bot[passport]`` installs the `cryptography>=3.0 <https://cryptography.io/en/stable>`_ library. Use this, if you want to use Telegram Passport related functionality.
|
||||
* ``pip install python-telegram-bot[socks]`` installs ``httpx[socks]``. Use this, if you want to work behind a Socks5 server.
|
||||
* ``pip install python-telegram-bot[rate-limiter]`` installs ``aiolimiter~=1.0.0``. Use this, if you want to use ``telegram.ext.AIORateLimiter``.
|
||||
|
||||
===============
|
||||
Getting started
|
||||
===============
|
||||
Quick Start
|
||||
===========
|
||||
|
||||
Our Wiki contains a lot of resources to get you started with ``python-telegram-bot``:
|
||||
Our Wiki contains an `Introduction to the API <https://github.com/python-telegram-bot/python-telegram-bot/wiki/Introduction-to-the-API>`_ explaining how the pure Bot API can be accessed via ``python-telegram-bot``.
|
||||
Moreover, the `Tutorial: Your first Bot <https://github.com/python-telegram-bot/python-telegram-bot/wiki/Extensions-%E2%80%93-Your-first-Bot>`_ gives an introduction on how chatbots can be easily programmed with the help of the ``telegram.ext`` module.
|
||||
|
||||
- `Introduction to the API <https://github.com/python-telegram-bot/python-telegram-bot/wiki/Introduction-to-the-API>`_
|
||||
- Tutorial: `Your first Bot <https://github.com/python-telegram-bot/python-telegram-bot/wiki/Extensions-%E2%80%93-Your-first-Bot>`_
|
||||
Resources
|
||||
=========
|
||||
|
||||
Other references:
|
||||
- The `package documentation <https://docs.python-telegram-bot.org/>`_ is the technical reference for ``python-telegram-bot``.
|
||||
It contains descriptions of all available classes, modules, methods and arguments as well as the `changelog <https://docs.python-telegram-bot.org/changelog.html>`_.
|
||||
- The `wiki <https://github.com/python-telegram-bot/python-telegram-bot/wiki/>`_ is home to number of more elaborate introductions of the different features of ``python-telegram-bot`` and other useful resources that go beyond the technical documentation.
|
||||
- Our `examples section <https://docs.python-telegram-bot.org/examples.html>`_ contains several examples that showcase the different features of both the Bot API and ``python-telegram-bot``.
|
||||
Even if it is not your approach for learning, please take a look at ``echobot.py``. It is the de facto base for most of the bots out there.
|
||||
The code for these examples is released to the public domain, so you can start by grabbing the code and building on top of it.
|
||||
- The `official Telegram Bot API documentation <https://core.telegram.org/bots/api>`_ is of course always worth a read.
|
||||
|
||||
- `Telegram API documentation <https://core.telegram.org/bots/api>`_
|
||||
- `python-telegram-bot documentation <https://python-telegram-bot.readthedocs.io/>`_
|
||||
|
||||
-------------------
|
||||
Learning by example
|
||||
-------------------
|
||||
|
||||
We believe that the best way to learn this package is by example. Here
|
||||
are some examples for you to review. Even if it is not your approach for learning, please take a
|
||||
look at ``echobot.py``, it is the de facto base for most of the bots out there. Best of all,
|
||||
the code for these examples are released to the public domain, so you can start by grabbing the
|
||||
code and building on top of it.
|
||||
|
||||
Visit `this page <https://github.com/python-telegram-bot/python-telegram-bot/blob/master/examples/README.md>`_ to discover the official examples or look at the examples on the `wiki <https://github.com/python-telegram-bot/python-telegram-bot/wiki/Examples>`_ to see other bots the community has built.
|
||||
|
||||
-------
|
||||
Logging
|
||||
-------
|
||||
|
||||
This library uses the ``logging`` module. To set up logging to standard output, put:
|
||||
|
||||
.. code:: python
|
||||
|
||||
import logging
|
||||
logging.basicConfig(level=logging.DEBUG,
|
||||
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s')
|
||||
|
||||
at the beginning of your script.
|
||||
|
||||
You can also use logs in your application by calling ``logging.getLogger()`` and setting the log level you want:
|
||||
|
||||
.. code:: python
|
||||
|
||||
logger = logging.getLogger()
|
||||
logger.setLevel(logging.INFO)
|
||||
|
||||
If you want DEBUG logs instead:
|
||||
|
||||
.. code:: python
|
||||
|
||||
logger.setLevel(logging.DEBUG)
|
||||
|
||||
|
||||
=============
|
||||
Documentation
|
||||
=============
|
||||
|
||||
``python-telegram-bot``'s documentation lives at `readthedocs.io <https://python-telegram-bot.readthedocs.io/>`_.
|
||||
|
||||
============
|
||||
Getting help
|
||||
============
|
||||
|
||||
You can get help in several ways:
|
||||
If the resources mentioned above don't answer your questions or simply overwhelm you, there are several ways of getting help.
|
||||
|
||||
1. We have a vibrant community of developers helping each other in our `Telegram group <https://telegram.me/pythontelegrambotgroup>`_. Join us!
|
||||
1. We have a vibrant community of developers helping each other in our `Telegram group <https://telegram.me/pythontelegrambotgroup>`_. Join us! Asking a question here is often the quickest way to get a pointer in the right direction.
|
||||
|
||||
2. In case you are unable to join our group due to Telegram restrictions, you can use our `IRC channel <https://webchat.freenode.net/?channels=##python-telegram-bot>`_.
|
||||
2. Ask questions by opening `a discussion <https://github.com/python-telegram-bot/python-telegram-bot/discussions/new>`_.
|
||||
|
||||
3. Report bugs, request new features or ask questions by `creating an issue <https://github.com/python-telegram-bot/python-telegram-bot/issues/new/choose>`_ or `a discussion <https://github.com/python-telegram-bot/python-telegram-bot/discussions/new>`_.
|
||||
3. You can even ask for help on Stack Overflow using the `python-telegram-bot tag <https://stackoverflow.com/questions/tagged/python-telegram-bot>`_.
|
||||
|
||||
4. Our `Wiki pages <https://github.com/python-telegram-bot/python-telegram-bot/wiki/>`_ offer a growing amount of resources.
|
||||
Concurrency
|
||||
===========
|
||||
|
||||
5. You can even ask for help on Stack Overflow using the `python-telegram-bot tag <https://stackoverflow.com/questions/tagged/python-telegram-bot>`_.
|
||||
Since v20.0, ``python-telegram-bot`` is built on top of Pythons ``asyncio`` module.
|
||||
Because ``asyncio`` is in general single-threaded, ``python-telegram-bot`` does currently not aim to be thread-safe.
|
||||
Noteworthy parts of ``python-telegram-bots`` API that are likely to cause issues (e.g. race conditions) when used in a multi-threaded setting include:
|
||||
|
||||
* ``telegram.ext.Application/Updater.update_queue``
|
||||
* ``telegram.ext.ConversationHandler.check/handle_update``
|
||||
* ``telegram.ext.CallbackDataCache``
|
||||
* ``telegram.ext.BasePersistence``
|
||||
* all classes in the ``telegram.ext.filters`` module that allow to add/remove allowed users/chats at runtime
|
||||
|
||||
============
|
||||
Contributing
|
||||
============
|
||||
|
||||
Contributions of all sizes are welcome. Please review our `contribution guidelines <https://github.com/python-telegram-bot/python-telegram-bot/blob/master/.github/CONTRIBUTING.rst>`_ to get started. You can also help by `reporting bugs <https://github.com/python-telegram-bot/python-telegram-bot/issues/new>`_.
|
||||
Contributions of all sizes are welcome.
|
||||
Please review our `contribution guidelines <https://github.com/python-telegram-bot/python-telegram-bot/blob/master/.github/CONTRIBUTING.rst>`_ to get started.
|
||||
You can also help by `reporting bugs or feature requests <https://github.com/python-telegram-bot/python-telegram-bot/issues/new>`_.
|
||||
|
||||
Donating
|
||||
========
|
||||
Occasionally we are asked if we accept donations to support the development.
|
||||
While we appreciate the thought, maintaining PTB is our hobby, and we have almost no running costs for it. We therefore have nothing set up to accept donations.
|
||||
If you still want to donate, we kindly ask you to donate to another open source project/initiative of your choice instead.
|
||||
|
||||
=======
|
||||
License
|
||||
=======
|
||||
|
||||
You may copy, distribute and modify the software provided that modifications are described and licensed for free under `LGPL-3 <https://www.gnu.org/licenses/lgpl-3.0.html>`_. Derivatives works (including modifications or anything statically linked to the library) can only be redistributed under LGPL-3, but applications that use the library don't have to be.
|
||||
You may copy, distribute and modify the software provided that modifications are described and licensed for free under `LGPL-3 <https://www.gnu.org/licenses/lgpl-3.0.html>`_.
|
||||
Derivatives works (including modifications or anything statically linked to the library) can only be redistributed under LGPL-3, but applications that use the library don't have to be.
|
||||
|
||||
+84
-113
@@ -1,17 +1,11 @@
|
||||
..
|
||||
Make user to apply any changes to this file to README.rst as well!
|
||||
Make sure to apply any changes to this file to README.rst as well!
|
||||
|
||||
.. image:: https://github.com/python-telegram-bot/logos/blob/master/logo-text/png/ptb-raw-logo-text_768.png?raw=true
|
||||
:align: center
|
||||
:target: https://python-telegram-bot.org
|
||||
:alt: python-telegram-bot-raw Logo
|
||||
|
||||
We have made you a wrapper you can't refuse
|
||||
|
||||
We have a vibrant community of developers helping each other in our `Telegram group <https://telegram.me/pythontelegrambotgroup>`_. Join us!
|
||||
|
||||
*Stay tuned for library updates and new releases on our* `Telegram Channel <https://telegram.me/pythontelegrambotchannel>`_.
|
||||
|
||||
.. image:: https://img.shields.io/pypi/v/python-telegram-bot-raw.svg
|
||||
:target: https://pypi.org/project/python-telegram-bot-raw/
|
||||
:alt: PyPi Package Version
|
||||
@@ -20,7 +14,7 @@ We have a vibrant community of developers helping each other in our `Telegram gr
|
||||
:target: https://pypi.org/project/python-telegram-bot-raw/
|
||||
:alt: Supported Python versions
|
||||
|
||||
.. image:: https://img.shields.io/badge/Bot%20API-5.0-blue?logo=telegram
|
||||
.. image:: https://img.shields.io/badge/Bot%20API-6.2-blue?logo=telegram
|
||||
:target: https://core.telegram.org/bots/api-changelog
|
||||
:alt: Supported Bot API versions
|
||||
|
||||
@@ -29,7 +23,7 @@ We have a vibrant community of developers helping each other in our `Telegram gr
|
||||
:alt: PyPi Package Monthly Download
|
||||
|
||||
.. image:: https://readthedocs.org/projects/python-telegram-bot/badge/?version=stable
|
||||
:target: https://python-telegram-bot.readthedocs.io/
|
||||
:target: https://docs.python-telegram-bot.org/
|
||||
:alt: Documentation Status
|
||||
|
||||
.. image:: https://img.shields.io/pypi/l/python-telegram-bot-raw.svg
|
||||
@@ -40,180 +34,157 @@ We have a vibrant community of developers helping each other in our `Telegram gr
|
||||
:target: https://github.com/python-telegram-bot/python-telegram-bot/
|
||||
:alt: Github Actions workflow
|
||||
|
||||
.. image:: https://codecov.io/gh/python-telegram-bot/python-telegram-bot/branch/master/graph/badge.svg
|
||||
:target: https://codecov.io/gh/python-telegram-bot/python-telegram-bot
|
||||
.. image:: https://app.codecov.io/gh/python-telegram-bot/python-telegram-bot
|
||||
:target: https://app.codecov.io/gh/python-telegram-bot/python-telegram-bot
|
||||
:alt: Code coverage
|
||||
|
||||
.. image:: http://isitmaintained.com/badge/resolution/python-telegram-bot/python-telegram-bot.svg
|
||||
:target: http://isitmaintained.com/project/python-telegram-bot/python-telegram-bot
|
||||
.. image:: https://isitmaintained.com/badge/resolution/python-telegram-bot/python-telegram-bot.svg
|
||||
:target: https://isitmaintained.com/project/python-telegram-bot/python-telegram-bot
|
||||
:alt: Median time to resolve an issue
|
||||
|
||||
.. image:: https://api.codacy.com/project/badge/Grade/99d901eaa09b44b4819aec05c330c968
|
||||
:target: https://www.codacy.com/app/python-telegram-bot/python-telegram-bot?utm_source=github.com&utm_medium=referral&utm_content=python-telegram-bot/python-telegram-bot&utm_campaign=Badge_Grade
|
||||
:alt: Code quality
|
||||
:target: https://app.codacy.com/gh/python-telegram-bot/python-telegram-bot/dashboard
|
||||
:alt: Code quality: Codacy
|
||||
|
||||
.. image:: https://deepsource.io/gh/python-telegram-bot/python-telegram-bot.svg/?label=active+issues
|
||||
:target: https://deepsource.io/gh/python-telegram-bot/python-telegram-bot/?ref=repository-badge
|
||||
:alt: Code quality: DeepSource
|
||||
|
||||
.. image:: https://results.pre-commit.ci/badge/github/python-telegram-bot/python-telegram-bot/master.svg
|
||||
:target: https://results.pre-commit.ci/latest/github/python-telegram-bot/python-telegram-bot/master
|
||||
:alt: pre-commit.ci status
|
||||
|
||||
.. image:: https://img.shields.io/badge/code%20style-black-000000.svg
|
||||
:target: https://github.com/psf/black
|
||||
:target: https://github.com/psf/black
|
||||
:alt: Code Style: Black
|
||||
|
||||
.. image:: https://img.shields.io/badge/Telegram-Channel-blue.svg?logo=telegram
|
||||
:target: https://t.me/pythontelegrambotchannel
|
||||
:alt: Telegram Channel
|
||||
|
||||
.. image:: https://img.shields.io/badge/Telegram-Group-blue.svg?logo=telegram
|
||||
:target: https://telegram.me/pythontelegrambotgroup
|
||||
:alt: Telegram Group
|
||||
|
||||
.. image:: https://img.shields.io/badge/IRC-Channel-blue.svg
|
||||
:target: https://webchat.freenode.net/?channels=##python-telegram-bot
|
||||
:alt: IRC Bridge
|
||||
We have made you a wrapper you can't refuse
|
||||
|
||||
=================
|
||||
Table of contents
|
||||
=================
|
||||
We have a vibrant community of developers helping each other in our `Telegram group <https://telegram.me/pythontelegrambotgroup>`_. Join us!
|
||||
|
||||
- `Introduction`_
|
||||
*Stay tuned for library updates and new releases on our* `Telegram Channel <https://telegram.me/pythontelegrambotchannel>`_.
|
||||
|
||||
- `Telegram API support`_
|
||||
|
||||
- `Installing`_
|
||||
|
||||
- `Getting started`_
|
||||
|
||||
#. `Logging`_
|
||||
|
||||
#. `Documentation`_
|
||||
|
||||
- `Getting help`_
|
||||
|
||||
- `Contributing`_
|
||||
|
||||
- `License`_
|
||||
|
||||
============
|
||||
Introduction
|
||||
============
|
||||
|
||||
This library provides a pure Python, lightweight interface for the
|
||||
This library provides a pure Python, asynchronous interface for the
|
||||
`Telegram Bot API <https://core.telegram.org/bots/api>`_.
|
||||
It's compatible with Python versions 3.6+. PTB-Raw might also work on `PyPy <http://pypy.org/>`_, though there have been a lot of issues before. Hence, PyPy is not officially supported.
|
||||
It's compatible with Python versions **3.7+**.
|
||||
|
||||
``python-telegram-bot-raw`` is part of the `python-telegram-bot <https://python-telegram-bot.org>`_ ecosystem and provides the pure API functionality extracted from PTB. It therefore does *not* have independent release schedules, changelogs or documentation. Please consult the PTB resources.
|
||||
``python-telegram-bot-raw`` is part of the `python-telegram-bot <https://python-telegram-bot.org>`_ ecosystem and provides the pure API functionality extracted from PTB. It therefore does not have independent release schedules, changelogs or documentation.
|
||||
|
||||
----
|
||||
Note
|
||||
----
|
||||
|
||||
Installing both ``python-telegram-bot`` and ``python-telegram-bot-raw`` in conjunction will result in undesired side-effects, so only install *one* of both.
|
||||
|
||||
====================
|
||||
Telegram API support
|
||||
====================
|
||||
|
||||
All types and methods of the Telegram Bot API **5.0** are supported.
|
||||
All types and methods of the Telegram Bot API **6.2** are supported.
|
||||
|
||||
==========
|
||||
Installing
|
||||
==========
|
||||
|
||||
You can install or upgrade python-telegram-bot-raw with:
|
||||
You can install or upgrade ``python-telegram-bot`` via
|
||||
|
||||
.. code:: shell
|
||||
|
||||
$ pip install python-telegram-bot-raw --upgrade
|
||||
|
||||
Or you can install from source with:
|
||||
To install a pre-release, use the ``--pre`` `flag <https://pip.pypa.io/en/stable/cli/pip_install/#cmdoption-pre>`_ in addition.
|
||||
|
||||
You can also install ``python-telegram-bot-raw`` from source, though this is usually not necessary.
|
||||
|
||||
.. code:: shell
|
||||
|
||||
$ git clone https://github.com/python-telegram-bot/python-telegram-bot --recursive
|
||||
$ git clone https://github.com/python-telegram-bot/python-telegram-bot
|
||||
$ cd python-telegram-bot
|
||||
$ python setup-raw.py install
|
||||
|
||||
In case you have a previously cloned local repository already, you should initialize the added urllib3 submodule before installing with:
|
||||
|
||||
.. code:: shell
|
||||
|
||||
$ git submodule update --init --recursive
|
||||
|
||||
----
|
||||
Note
|
||||
----
|
||||
|
||||
Installing the `.tar.gz` archive available on PyPi directly via `pip` will *not* work as expected, as `pip` does not recognize that it should use `setup-raw.py` instead of `setup.py`.
|
||||
Installing the ``.tar.gz`` archive available on PyPi directly via ``pip`` will *not* work as expected, as ``pip`` does not recognize that it should use ``setup-raw.py`` instead of ``setup.py``.
|
||||
|
||||
Dependencies & Their Versions
|
||||
-----------------------------
|
||||
|
||||
``python-telegram-bot`` tries to use as few 3rd party dependencies as possible.
|
||||
However, for some features using a 3rd party library is more sane than implementing the functionality again.
|
||||
The dependencies are:
|
||||
|
||||
* `httpx ~= 0.23.0 <https://www.python-httpx.org>`_ for ``telegram.request.HTTPXRequest``, the default networking backend
|
||||
|
||||
``python-telegram-bot`` is most useful when used along with additional libraries.
|
||||
To minimize dependency conflicts, we try to be liberal in terms of version requirements on the dependencies.
|
||||
On the other hand, we have to ensure stability of ``python-telegram-bot``, which is why we do apply version bounds.
|
||||
If you encounter dependency conflicts due to these bounds, feel free to reach out.
|
||||
|
||||
---------------------
|
||||
Optional Dependencies
|
||||
---------------------
|
||||
|
||||
PTB can be installed with optional dependencies:
|
||||
``python-telegram-bot-raw`` can be installed with optional dependencies:
|
||||
|
||||
* ``pip install python-telegram-bot-raw[passport]`` installs the `cryptography <https://cryptography.io>`_ library. Use this, if you want to use Telegram Passport related functionality.
|
||||
* ``pip install python-telegram-bot-raw[ujson]`` installs the `ujson <https://pypi.org/project/ujson/>`_ library. It will then be used for JSON de- & encoding, which can bring speed up compared to the standard `json <https://docs.python.org/3/library/json.html>`_ library.
|
||||
* ``pip install python-telegram-bot[passport]`` installs the `cryptography <https://cryptography.io/en/stable>`_ library. Use this, if you want to use Telegram Passport related functionality.
|
||||
* ``pip install python-telegram-bot[socks]`` installs the `PySocks <https://pypi.org/project/PySocks/>`_ library. Use this, if you want to work behind a Socks5 server.
|
||||
|
||||
===============
|
||||
Getting started
|
||||
===============
|
||||
Quick Start
|
||||
===========
|
||||
|
||||
Our Wiki contains an `Introduction to the API <https://github.com/python-telegram-bot/python-telegram-bot/wiki/Introduction-to-the-API>`_. Other references are:
|
||||
Our Wiki contains an `Introduction to the API <https://github.com/python-telegram-bot/python-telegram-bot/wiki/Introduction-to-the-API>`_ explaining how the pure Bot API can be accessed via ``python-telegram-bot``.
|
||||
|
||||
- the `Telegram API documentation <https://core.telegram.org/bots/api>`_
|
||||
- the `python-telegram-bot documentation <https://python-telegram-bot.readthedocs.io/>`_
|
||||
Resources
|
||||
=========
|
||||
|
||||
-------
|
||||
Logging
|
||||
-------
|
||||
- The `package documentation <https://docs.python-telegram-bot.org/>`_ is the technical reference for ``python-telegram-bot``.
|
||||
It contains descriptions of all available classes, modules, methods and arguments as well as the `changelog <https://docs.python-telegram-bot.org/changelog.html>`_.
|
||||
- The `wiki <https://github.com/python-telegram-bot/python-telegram-bot/wiki/>`_ is home to number of more elaborate introductions of the different features of ``python-telegram-bot`` and other useful resources that go beyond the technical documentation.
|
||||
- Our `examples section <https://docs.python-telegram-bot.org/examples.html>`_ contains several examples that showcase the different features of both the Bot API and ``python-telegram-bot``.
|
||||
Even if it is not your approach for learning, please take a look at ``echobot.py``. It is the de facto base for most of the bots out there.
|
||||
The code for these examples is released to the public domain, so you can start by grabbing the code and building on top of it.
|
||||
- The `official Telegram Bot API documentation <https://core.telegram.org/bots/api>`_ is of course always worth a read.
|
||||
|
||||
This library uses the ``logging`` module. To set up logging to standard output, put:
|
||||
|
||||
.. code:: python
|
||||
|
||||
import logging
|
||||
logging.basicConfig(level=logging.DEBUG,
|
||||
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s')
|
||||
|
||||
at the beginning of your script.
|
||||
|
||||
You can also use logs in your application by calling ``logging.getLogger()`` and setting the log level you want:
|
||||
|
||||
.. code:: python
|
||||
|
||||
logger = logging.getLogger()
|
||||
logger.setLevel(logging.INFO)
|
||||
|
||||
If you want DEBUG logs instead:
|
||||
|
||||
.. code:: python
|
||||
|
||||
logger.setLevel(logging.DEBUG)
|
||||
|
||||
|
||||
=============
|
||||
Documentation
|
||||
=============
|
||||
|
||||
``python-telegram-bot``'s documentation lives at `readthedocs.io <https://python-telegram-bot.readthedocs.io/>`_, which
|
||||
includes the relevant documentation for ``python-telegram-bot-raw``.
|
||||
|
||||
============
|
||||
Getting help
|
||||
============
|
||||
|
||||
You can get help in several ways:
|
||||
If the resources mentioned above don't answer your questions or simply overwhelm you, there are several ways of getting help.
|
||||
|
||||
1. We have a vibrant community of developers helping each other in our `Telegram group <https://telegram.me/pythontelegrambotgroup>`_. Join us!
|
||||
1. We have a vibrant community of developers helping each other in our `Telegram group <https://telegram.me/pythontelegrambotgroup>`_. Join us! Asking a question here is often the quickest way to get a pointer in the right direction.
|
||||
|
||||
2. In case you are unable to join our group due to Telegram restrictions, you can use our `IRC channel <https://webchat.freenode.net/?channels=##python-telegram-bot>`_.
|
||||
2. Ask questions by opening `a discussion <https://github.com/python-telegram-bot/python-telegram-bot/discussions/new>`_.
|
||||
|
||||
3. Report bugs, request new features or ask questions by `creating an issue <https://github.com/python-telegram-bot/python-telegram-bot/issues/new/choose>`_ or `a discussion <https://github.com/python-telegram-bot/python-telegram-bot/discussions/new>`_.
|
||||
3. You can even ask for help on Stack Overflow using the `python-telegram-bot tag <https://stackoverflow.com/questions/tagged/python-telegram-bot>`_.
|
||||
|
||||
4. Our `Wiki pages <https://github.com/python-telegram-bot/python-telegram-bot/wiki/>`_ offer a growing amount of resources.
|
||||
Concurrency
|
||||
===========
|
||||
|
||||
5. You can even ask for help on Stack Overflow using the `python-telegram-bot tag <https://stackoverflow.com/questions/tagged/python-telegram-bot>`_.
|
||||
Since v20.0, ``python-telegram-bot`` is built on top of Pythons ``asyncio`` module.
|
||||
Because ``asyncio`` is in general single-threaded, ``python-telegram-bot`` does currently not aim to be thread-safe.
|
||||
|
||||
============
|
||||
Contributing
|
||||
============
|
||||
|
||||
Contributions of all sizes are welcome. Please review our `contribution guidelines <https://github.com/python-telegram-bot/python-telegram-bot/blob/master/.github/CONTRIBUTING.rst>`_ to get started. You can also help by `reporting bugs <https://github.com/python-telegram-bot/python-telegram-bot/issues/new>`_.
|
||||
Contributions of all sizes are welcome.
|
||||
Please review our `contribution guidelines <https://github.com/python-telegram-bot/python-telegram-bot/blob/master/.github/CONTRIBUTING.rst>`_ to get started.
|
||||
You can also help by `reporting bugs or feature requests <https://github.com/python-telegram-bot/python-telegram-bot/issues/new>`_.
|
||||
|
||||
Donating
|
||||
========
|
||||
Occasionally we are asked if we accept donations to support the development.
|
||||
While we appreciate the thought, maintaining PTB is our hobby, and we have almost no running costs for it. We therefore have nothing set up to accept donations.
|
||||
If you still want to donate, we kindly ask you to donate to another open source project/initiative of your choice instead.
|
||||
|
||||
=======
|
||||
License
|
||||
=======
|
||||
|
||||
You may copy, distribute and modify the software provided that modifications are described and licensed for free under `LGPL-3 <https://www.gnu.org/licenses/lgpl-3.0.html>`_. Derivatives works (including modifications or anything statically linked to the library) can only be redistributed under LGPL-3, but applications that use the library don't have to be.
|
||||
You may copy, distribute and modify the software provided that modifications are described and licensed for free under `LGPL-3 <https://www.gnu.org/licenses/lgpl-3.0.html>`_.
|
||||
Derivatives works (including modifications or anything statically linked to the library) can only be redistributed under LGPL-3, but applications that use the library don't have to be.
|
||||
|
||||
+1
-1
@@ -15,7 +15,7 @@ endif
|
||||
# Internal variables.
|
||||
PAPEROPT_a4 = -D latex_paper_size=a4
|
||||
PAPEROPT_letter = -D latex_paper_size=letter
|
||||
ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source
|
||||
ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source -j auto
|
||||
# the i18n builder cannot share the environment and doctrees with the others
|
||||
I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
sphinx>=1.7.9
|
||||
sphinx_rtd_theme
|
||||
sphinx==5.1.1
|
||||
sphinx-pypi-upload
|
||||
furo==2022.6.21
|
||||
sphinx-paramlinks==0.5.4
|
||||
sphinxcontrib-mermaid==0.7.1
|
||||
@@ -0,0 +1,5 @@
|
||||
article a.reference.external:not([href*="/python-telegram-bot/blob/"])::after {
|
||||
content: url('data:image/svg+xml,<svg width="12" height="12" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" stroke-width="1.5" stroke="%23607D8B" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z"/><path d="M11 7h-5a2 2 0 0 0 -2 2v9a2 2 0 0 0 2 2h9a2 2 0 0 0 2 -2v-5" /><line x1="10" y1="14" x2="20" y2="4" /><polyline points="15 4 20 4 20 9" /></svg>');
|
||||
margin: 0 0.25rem;
|
||||
vertical-align: middle;
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
.mermaid svg {
|
||||
height: auto;
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
.. include:: ../../CODE_OF_CONDUCT.rst
|
||||
+428
-220
@@ -1,272 +1,261 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# Python Telegram Bot documentation build configuration file, created by
|
||||
# sphinx-quickstart on Mon Aug 10 22:25:07 2015.
|
||||
#
|
||||
# This file is execfile()d with the current directory set to its
|
||||
# containing dir.
|
||||
#
|
||||
# Note that not all possible configuration values are present in this
|
||||
# autogenerated file.
|
||||
#
|
||||
# All configuration values have a default; values that are commented out
|
||||
# serve to show the default.
|
||||
import sys
|
||||
import inspect
|
||||
import os
|
||||
import shlex
|
||||
# import telegram
|
||||
import re
|
||||
import subprocess
|
||||
import sys
|
||||
from enum import Enum
|
||||
from pathlib import Path
|
||||
from typing import Tuple
|
||||
|
||||
# If extensions (or modules to document with autodoc) are in another directory,
|
||||
# add these directories to sys.path here. If the directory is relative to the
|
||||
# documentation root, use os.path.abspath to make it absolute, like shown here.
|
||||
sys.path.insert(0, os.path.abspath('../..'))
|
||||
from docutils.nodes import Element
|
||||
from sphinx.application import Sphinx
|
||||
from sphinx.domains.python import PyXRefRole
|
||||
from sphinx.environment import BuildEnvironment
|
||||
from sphinx.util import logging
|
||||
|
||||
sys.path.insert(0, os.path.abspath("../.."))
|
||||
|
||||
# -- General configuration ------------------------------------------------
|
||||
|
||||
# If your documentation needs a minimal Sphinx version, state it here.
|
||||
needs_sphinx = '1.7.9'
|
||||
|
||||
# Add any Sphinx extension module names here, as strings. They can be
|
||||
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
|
||||
# ones.
|
||||
extensions = [
|
||||
'sphinx.ext.autodoc',
|
||||
'sphinx.ext.napoleon'
|
||||
]
|
||||
# Don't show type hints in the signature - that just makes it hardly readable
|
||||
# and we document the types anyway
|
||||
autodoc_typehints = 'description'
|
||||
|
||||
# Add any paths that contain templates here, relative to this directory.
|
||||
templates_path = ['_templates']
|
||||
|
||||
# The suffix(es) of source filenames.
|
||||
# You can specify multiple suffix as a list of string:
|
||||
# source_suffix = ['.rst', '.md']
|
||||
source_suffix = '.rst'
|
||||
|
||||
# The encoding of source files.
|
||||
#source_encoding = 'utf-8-sig'
|
||||
|
||||
# The master toctree document.
|
||||
master_doc = 'index'
|
||||
|
||||
# General information about the project.
|
||||
project = u'Python Telegram Bot'
|
||||
copyright = u'2015-2021, Leandro Toledo'
|
||||
author = u'Leandro Toledo'
|
||||
project = "python-telegram-bot"
|
||||
copyright = "2015-2022, Leandro Toledo"
|
||||
author = "Leandro Toledo"
|
||||
|
||||
# The version info for the project you're documenting, acts as replacement for
|
||||
# |version| and |release|, also used in various other places throughout the
|
||||
# built documents.
|
||||
#
|
||||
# The short X.Y version.
|
||||
version = '13.3' # telegram.__version__[:3]
|
||||
version = "20.0a3" # telegram.__version__[:3]
|
||||
# The full version, including alpha/beta/rc tags.
|
||||
release = '13.3' # telegram.__version__
|
||||
release = "20.0a3" # telegram.__version__
|
||||
|
||||
# The language for content autogenerated by Sphinx. Refer to documentation
|
||||
# for a list of supported languages.
|
||||
#
|
||||
# This is also used if you do content translation via gettext catalogs.
|
||||
# Usually you set "language" from the command line for these cases.
|
||||
language = None
|
||||
# If your documentation needs a minimal Sphinx version, state it here.
|
||||
needs_sphinx = "4.5.0"
|
||||
|
||||
# There are two options for replacing |today|: either, you set today to some
|
||||
# non-false value, then it is used:
|
||||
#today = ''
|
||||
# Else, today_fmt is used as the format for a strftime call.
|
||||
#today_fmt = '%B %d, %Y'
|
||||
# Add any Sphinx extension module names here, as strings. They can be
|
||||
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
|
||||
# ones.
|
||||
extensions = [
|
||||
"sphinx.ext.autodoc",
|
||||
"sphinx.ext.napoleon",
|
||||
"sphinx.ext.intersphinx",
|
||||
"sphinx.ext.linkcode",
|
||||
"sphinx_paramlinks",
|
||||
"sphinxcontrib.mermaid",
|
||||
]
|
||||
|
||||
# List of patterns, relative to source directory, that match files and
|
||||
# directories to ignore when looking for source files.
|
||||
exclude_patterns = []
|
||||
# Use intersphinx to reference the python builtin library docs
|
||||
intersphinx_mapping = {
|
||||
"python": ("https://docs.python.org/3", None),
|
||||
"APScheduler": ("https://apscheduler.readthedocs.io/en/3.x/", None),
|
||||
}
|
||||
|
||||
# The reST default role (used for this markup: `text`) to use for all
|
||||
# documents.
|
||||
#default_role = None
|
||||
# Add any paths that contain templates here, relative to this directory.
|
||||
templates_path = ["_templates"]
|
||||
|
||||
# If true, '()' will be appended to :func: etc. cross-reference text.
|
||||
#add_function_parentheses = True
|
||||
# The suffix(es) of source filenames.
|
||||
# You can specify multiple suffix as a list of string:
|
||||
source_suffix = ".rst"
|
||||
|
||||
# If true, the current module name will be prepended to all description
|
||||
# unit titles (such as .. function::).
|
||||
#add_module_names = True
|
||||
# The master toctree document.
|
||||
master_doc = "index"
|
||||
|
||||
# -- Extension settings ------------------------------------------------
|
||||
napoleon_use_admonition_for_examples = True
|
||||
|
||||
# Don't show type hints in the signature - that just makes it hardly readable
|
||||
# and we document the types anyway
|
||||
autodoc_typehints = "none"
|
||||
|
||||
# Fail on warnings & unresolved references etc
|
||||
nitpicky = True
|
||||
|
||||
# Paramlink style
|
||||
paramlinks_hyperlink_param = "name"
|
||||
|
||||
# Linkcheck settings
|
||||
linkcheck_ignore = [
|
||||
# Let's not check issue/PR links - that's wasted resources
|
||||
r"http(s)://github\.com/python-telegram-bot/python-telegram-bot/(issues|pull)/\d+/?",
|
||||
# For some reason linkcheck has a problem with these two:
|
||||
re.escape("https://github.com/python-telegram-bot/python-telegram-bot/discussions/new"),
|
||||
re.escape("https://github.com/python-telegram-bot/python-telegram-bot/issues/new"),
|
||||
# Anchors are apparently inserted by GitHub dynamically, so let's skip checking them
|
||||
"https://github.com/python-telegram-bot/python-telegram-bot/tree/master/examples#",
|
||||
r"https://github\.com/python-telegram-bot/python-telegram-bot/wiki/[\w\-_,]+\#",
|
||||
]
|
||||
linkcheck_allowed_redirects = {
|
||||
# Redirects to the default version are okay
|
||||
r"https://docs\.python-telegram-bot\.org/.*": r"https://docs\.python-telegram-bot\.org/en/[\w\d\.]+/.*",
|
||||
# pre-commit.ci always redirects to the latest run
|
||||
re.escape(
|
||||
"https://results.pre-commit.ci/latest/github/python-telegram-bot/python-telegram-bot/master"
|
||||
): r"https://results\.pre-commit\.ci/run/github/.*",
|
||||
}
|
||||
|
||||
# If true, sectionauthor and moduleauthor directives will be shown in the
|
||||
# output. They are ignored by default.
|
||||
#show_authors = False
|
||||
|
||||
# The name of the Pygments (syntax highlighting) style to use.
|
||||
pygments_style = 'sphinx'
|
||||
pygments_style = "sphinx"
|
||||
|
||||
# A list of ignored prefixes for module index sorting.
|
||||
#modindex_common_prefix = []
|
||||
|
||||
# If true, keep warnings as "system message" paragraphs in the built documents.
|
||||
#keep_warnings = False
|
||||
# Decides the language used for syntax highlighting of code blocks.
|
||||
highlight_language = "python3"
|
||||
|
||||
# If true, `todo` and `todoList` produce output, else they produce nothing.
|
||||
todo_include_todos = False
|
||||
|
||||
|
||||
# -- Options for HTML output ----------------------------------------------
|
||||
|
||||
# The theme to use for HTML and HTML Help pages. See the documentation for
|
||||
# a list of builtin themes.
|
||||
html_theme = 'sphinx_rtd_theme'
|
||||
html_theme = "furo"
|
||||
|
||||
# Theme options are theme-specific and customize the look and feel of a theme
|
||||
# further. For a list of options available for each theme, see the
|
||||
# documentation.
|
||||
#html_theme_options = {}
|
||||
|
||||
# Add any paths that contain custom themes here, relative to this directory.
|
||||
#html_theme_path = []
|
||||
# further. For a list of options available for each theme, see the documentation.
|
||||
html_theme_options = {
|
||||
"navigation_with_keys": True,
|
||||
"dark_css_variables": {
|
||||
"admonition-title-font-size": "0.95rem",
|
||||
"admonition-font-size": "0.92rem",
|
||||
},
|
||||
"light_css_variables": {
|
||||
"admonition-title-font-size": "0.95rem",
|
||||
"admonition-font-size": "0.92rem",
|
||||
},
|
||||
"announcement": "PTB has undergone significant changes in v20. Please read the documentation "
|
||||
"carefully and also check out the transition guide in the "
|
||||
'<a href="https://github.com/python-telegram-bot/python-telegram-bot/wiki/'
|
||||
'Transition-guide-to-Version-20.0">wiki</a>.',
|
||||
"footer_icons": [
|
||||
{
|
||||
# Telegram channel logo
|
||||
"name": "Telegram Channel",
|
||||
"url": "https://t.me/pythontelegrambotchannel/",
|
||||
# Following svg is from https://react-icons.github.io/react-icons/search?q=telegram
|
||||
"html": '<svg stroke="currentColor" fill="currentColor" stroke-width="0" '
|
||||
'viewBox="0 0 16 16" height="1em" width="1em" xmlns="http://www.w3.org/2000/svg">'
|
||||
'<path d="M16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0zM8.287 5.906c-.778.324-2.334.994'
|
||||
"-4.666 2.01-.378.15-.577.298-.595.442-.03.243.275.339.69.47l.175.055c.408.133."
|
||||
"958.288 1.243.294.26.006.549-.1.868-.32 2.179-1.471 3.304-2.214 3.374-2.23.0"
|
||||
"5-.012.12-.026.166.016.047.041.042.12.037.141-.03.129-1.227 1.241-1.846 1.81"
|
||||
"7-.193.18-.33.307-.358.336a8.154 8.154 0 0 1-.188.186c-.38.366-.664.64.015 1.08"
|
||||
"8.327.216.589.393.85.571.284.194.568.387.936.629.093.06.183.125.27.187.331.23"
|
||||
"6.63.448.997.414.214-.02.435-.22.547-.82.265-1.417.786-4.486.906-5.751a1.426 "
|
||||
"1.426 0 0 0-.013-.315.337.337 0 0 0-.114-.217.526.526 0 0 0-.31-.093c-.3.005-.7"
|
||||
'63.166-2.984 1.09z"></path></svg>',
|
||||
"class": "",
|
||||
},
|
||||
{ # Github logo
|
||||
"name": "GitHub",
|
||||
"url": "https://github.com/python-telegram-bot/python-telegram-bot/",
|
||||
"html": '<svg stroke="currentColor" fill="currentColor" stroke-width="0" '
|
||||
'viewBox="0 0 16 16"><path fill-rule="evenodd" d="M8 0C3.58 0 0 3.58 0 8c0 3.54 '
|
||||
"2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.4"
|
||||
"9-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23"
|
||||
".82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 "
|
||||
"0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.2"
|
||||
"7 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.5"
|
||||
"1.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 "
|
||||
'1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0 0 16 8c0-4.42-3.58-8-8-8z">'
|
||||
"</path></svg>",
|
||||
"class": "",
|
||||
},
|
||||
{ # PTB website logo - globe
|
||||
"name": "python-telegram-bot website",
|
||||
"url": "https://python-telegram-bot.org/",
|
||||
"html": '<svg stroke="currentColor" fill="currentColor" stroke-width="0" '
|
||||
'viewBox="0 0 16 16" height="1em" width="1em" xmlns="http://www.w3.org/2000/svg">'
|
||||
'<path d="M0 8a8 8 0 1 1 16 0A8 8 0 0 1 0 8zm7.5-6.923c-.67.204-1.335.82-1.887 '
|
||||
"1.855-.143.268-.276.56-.395.872.705.157 1.472.257 2.282.287V1.077zM4.249 3.53"
|
||||
"9c.142-.384.304-.744.481-1.078a6.7 6.7 0 0 1 .597-.933A7.01 7.01 0 0 0 3.051 "
|
||||
"3.05c.362.184.763.349 1.198.49zM3.509 7.5c.036-1.07.188-2.087.436-3.008a9.124 "
|
||||
"9.124 0 0 1-1.565-.667A6.964 6.964 0 0 0 1.018 7.5h2.49zm1.4-2.741a12.344 "
|
||||
"12.344 0 0 0-.4 2.741H7.5V5.091c-.91-.03-1.783-.145-2.591-.332zM8.5 5.09V7.5h"
|
||||
"2.99a12.342 12.342 0 0 0-.399-2.741c-.808.187-1.681.301-2.591.332zM4.51 8.5c.03"
|
||||
"5.987.176 1.914.399 2.741A13.612 13.612 0 0 1 7.5 10.91V8.5H4.51zm3.99 0v2.409"
|
||||
"c.91.03 1.783.145 2.591.332.223-.827.364-1.754.4-2.741H8.5zm-3.282 3.696c.12.31"
|
||||
"2.252.604.395.872.552 1.035 1.218 1.65 1.887 1.855V11.91c-.81.03-1.577.13-2.28"
|
||||
"2.287zm.11 2.276a6.696 6.696 0 0 1-.598-.933 8.853 8.853 0 0 1-.481-1.079 8.38 "
|
||||
"8.38 0 0 0-1.198.49 7.01 7.01 0 0 0 2.276 1.522zm-1.383-2.964A13.36 13.36 0 0 1"
|
||||
" 3.508 8.5h-2.49a6.963 6.963 0 0 0 1.362 3.675c.47-.258.995-.482 1.565-.667zm"
|
||||
"6.728 2.964a7.009 7.009 0 0 0 2.275-1.521 8.376 8.376 0 0 0-1.197-.49 8.853 "
|
||||
"8.853 0 0 1-.481 1.078 6.688 6.688 0 0 1-.597.933zM8.5 11.909v3.014c.67-.204 "
|
||||
"1.335-.82 1.887-1.855.143-.268.276-.56.395-.872A12.63 12.63 0 0 0 8.5 11.91zm"
|
||||
"3.555-.401c.57.185 1.095.409 1.565.667A6.963 6.963 0 0 0 14.982 8.5h-2.49a1"
|
||||
"3.36 13.36 0 0 1-.437 3.008zM14.982 7.5a6.963 6.963 0 0 0-1.362-3.675c-.47.25"
|
||||
"8-.995.482-1.565.667.248.92.4 1.938.437 3.008h2.49zM11.27 2.461c.177.334.339.6"
|
||||
"94.482 1.078a8.368 8.368 0 0 0 1.196-.49 7.01 7.01 0 0 0-2.275-1.52c.218.283.4"
|
||||
"18.597.597.932zm-.488 1.343a7.765 7.765 0 0 0-.395-.872C9.835 1.897 9.17 1.282 "
|
||||
'8.5 1.077V4.09c.81-.03 1.577-.13 2.282-.287z"></path></svg>',
|
||||
"class": "",
|
||||
},
|
||||
],
|
||||
}
|
||||
|
||||
# The name for this set of Sphinx documents. If None, it defaults to
|
||||
# "<project> v<release> documentation".
|
||||
#html_title = None
|
||||
|
||||
# A shorter title for the navigation bar. Default is the same as html_title.
|
||||
#html_short_title = None
|
||||
html_title = f"python-telegram-bot<br> v{version}"
|
||||
|
||||
# The name of an image file (relative to this directory) to place at the top
|
||||
# of the sidebar.
|
||||
html_logo = 'ptb-logo-orange.png'
|
||||
html_logo = "ptb-logo_1024.png"
|
||||
|
||||
# The name of an image file (within the static path) to use as favicon of the
|
||||
# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
|
||||
# pixels large.
|
||||
html_favicon = 'ptb-logo-orange.ico'
|
||||
html_favicon = "ptb-logo_1024.ico"
|
||||
|
||||
# Add any paths that contain custom static files (such as style sheets) here,
|
||||
# relative to this directory. They are copied after the builtin static files,
|
||||
# so a file named "default.css" will overwrite the builtin "default.css".
|
||||
html_static_path = ['_static']
|
||||
|
||||
# Add any extra paths that contain custom files (such as robots.txt or
|
||||
# .htaccess) here, relative to this directory. These files are copied
|
||||
# directly to the root of the documentation.
|
||||
#html_extra_path = []
|
||||
|
||||
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
|
||||
# using the given strftime format.
|
||||
#html_last_updated_fmt = '%b %d, %Y'
|
||||
|
||||
# If true, SmartyPants will be used to convert quotes and dashes to
|
||||
# typographically correct entities.
|
||||
#html_use_smartypants = True
|
||||
|
||||
# Custom sidebar templates, maps document names to template names.
|
||||
#html_sidebars = {}
|
||||
|
||||
# Additional templates that should be rendered to pages, maps page names to
|
||||
# template names.
|
||||
#html_additional_pages = {}
|
||||
|
||||
# If false, no module index is generated.
|
||||
#html_domain_indices = True
|
||||
|
||||
# If false, no index is generated.
|
||||
#html_use_index = True
|
||||
|
||||
# If true, the index is split into individual pages for each letter.
|
||||
#html_split_index = False
|
||||
|
||||
# If true, links to the reST sources are added to the pages.
|
||||
#html_show_sourcelink = True
|
||||
|
||||
# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
|
||||
#html_show_sphinx = True
|
||||
|
||||
# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
|
||||
#html_show_copyright = True
|
||||
|
||||
# If true, an OpenSearch description file will be output, and all pages will
|
||||
# contain a <link> tag referring to it. The value of this option must be the
|
||||
# base URL from which the finished HTML is served.
|
||||
#html_use_opensearch = ''
|
||||
|
||||
# This is the file name suffix for HTML files (e.g. ".xhtml").
|
||||
#html_file_suffix = None
|
||||
|
||||
# Language to be used for generating the HTML full-text search index.
|
||||
# Sphinx supports the following languages:
|
||||
# 'da', 'de', 'en', 'es', 'fi', 'fr', 'hu', 'it', 'ja'
|
||||
# 'nl', 'no', 'pt', 'ro', 'ru', 'sv', 'tr'
|
||||
#html_search_language = 'en'
|
||||
|
||||
# A dictionary with options for the search language support, empty by default.
|
||||
# Now only 'ja' uses this config value
|
||||
#html_search_options = {'type': 'default'}
|
||||
|
||||
# The name of a javascript file (relative to the configuration directory) that
|
||||
# implements a search results scorer. If empty, the default will be used.
|
||||
#html_search_scorer = 'scorer.js'
|
||||
html_static_path = ["_static"]
|
||||
html_css_files = [
|
||||
"style_external_link.css",
|
||||
"style_mermaid_diagrams.css",
|
||||
]
|
||||
html_permalinks_icon = "¶" # Furo's default permalink icon is `#`` which doesn't look great imo.
|
||||
|
||||
# Output file base name for HTML help builder.
|
||||
htmlhelp_basename = 'PythonTelegramBotdoc'
|
||||
htmlhelp_basename = "python-telegram-bot-doc"
|
||||
|
||||
# The base URL which points to the root of the HTML documentation. It is used to indicate the
|
||||
# location of document using The Canonical Link Relation. Default: ''.
|
||||
html_baseurl = "https://docs.python-telegram-bot.org"
|
||||
|
||||
# -- Options for LaTeX output ---------------------------------------------
|
||||
|
||||
latex_elements = {
|
||||
|
||||
# The paper size ('letterpaper' or 'a4paper').
|
||||
'papersize': 'a4paper',
|
||||
|
||||
# The font size ('10pt', '11pt' or '12pt').
|
||||
#'pointsize': '10pt',
|
||||
|
||||
# Additional stuff for the LaTeX preamble.
|
||||
'preamble': r'''\setcounter{tocdepth}{2}
|
||||
# The paper size ('letterpaper' or 'a4paper').
|
||||
"papersize": "a4paper",
|
||||
# The font size ('10pt', '11pt' or '12pt').
|
||||
#'pointsize': '10pt',
|
||||
# Additional stuff for the LaTeX preamble.
|
||||
"preamble": r"""\setcounter{tocdepth}{2}
|
||||
\usepackage{enumitem}
|
||||
\setlistdepth{99}''',
|
||||
|
||||
# Latex figure (float) alignment
|
||||
#'figure_align': 'htbp',
|
||||
\setlistdepth{99}""",
|
||||
# Latex figure (float) alignment
|
||||
#'figure_align': 'htbp',
|
||||
}
|
||||
|
||||
# Grouping the document tree into LaTeX files. List of tuples
|
||||
# (source start file, target name, title,
|
||||
# author, documentclass [howto, manual, or own class]).
|
||||
latex_documents = [
|
||||
(master_doc, 'PythonTelegramBot.tex', u'Python Telegram Bot Documentation',
|
||||
author, 'manual'),
|
||||
(master_doc, "python-telegram-bot.tex", "python-telegram-bot Documentation", author, "manual"),
|
||||
]
|
||||
|
||||
# The name of an image file (relative to this directory) to place at the top of
|
||||
# the title page.
|
||||
latex_logo = 'ptb-logo_1024.png'
|
||||
|
||||
# For "manual" documents, if this is true, then toplevel headings are parts,
|
||||
# not chapters.
|
||||
#latex_use_parts = False
|
||||
|
||||
# If true, show page references after internal links.
|
||||
#latex_show_pagerefs = False
|
||||
|
||||
# If true, show URL addresses after external links.
|
||||
#latex_show_urls = False
|
||||
|
||||
# Documents to append as an appendix to all manuals.
|
||||
#latex_appendices = []
|
||||
|
||||
# If false, no module index is generated.
|
||||
#latex_domain_indices = True
|
||||
|
||||
latex_logo = "ptb-logo_1024.png"
|
||||
|
||||
# -- Options for manual page output ---------------------------------------
|
||||
|
||||
# One entry per manual page. List of tuples
|
||||
# (source start file, name, description, authors, manual section).
|
||||
man_pages = [
|
||||
(master_doc, 'pythontelegrambot', u'Python Telegram Bot Documentation',
|
||||
[author], 1)
|
||||
]
|
||||
|
||||
# If true, show URL addresses after external links.
|
||||
#man_show_urls = False
|
||||
man_pages = [(master_doc, "python-telegram-bot", "python-telegram-bot Documentation", [author], 1)]
|
||||
|
||||
|
||||
# -- Options for Texinfo output -------------------------------------------
|
||||
@@ -275,33 +264,252 @@ man_pages = [
|
||||
# (source start file, target name, title, author,
|
||||
# dir menu entry, description, category)
|
||||
texinfo_documents = [
|
||||
(master_doc, 'PythonTelegramBot', u'Python Telegram Bot Documentation',
|
||||
author, 'PythonTelegramBot', "We have made you a wrapper you can't refuse",
|
||||
'Miscellaneous'),
|
||||
(
|
||||
master_doc,
|
||||
"python-telegram-bot",
|
||||
"python-telegram-bot Documentation",
|
||||
author,
|
||||
"python-telegram-bot",
|
||||
"We have made you a wrapper you can't refuse",
|
||||
"Miscellaneous",
|
||||
),
|
||||
]
|
||||
|
||||
# Documents to append as an appendix to all manuals.
|
||||
#texinfo_appendices = []
|
||||
|
||||
# If false, no module index is generated.
|
||||
#texinfo_domain_indices = True
|
||||
|
||||
# How to display URL addresses: 'footnote', 'no', or 'inline'.
|
||||
#texinfo_show_urls = 'footnote'
|
||||
|
||||
# If true, do not generate a @detailmenu in the "Top" node's menu.
|
||||
#texinfo_no_detailmenu = False
|
||||
|
||||
# Napoleon stuff
|
||||
|
||||
napoleon_use_admonition_for_examples = True
|
||||
|
||||
# -- script stuff --------------------------------------------------------
|
||||
|
||||
# get the sphinx(!) logger
|
||||
# Makes sure logs render in red and also plays nicely with e.g. the `nitpicky` option.
|
||||
sphinx_logger = logging.getLogger(__name__)
|
||||
|
||||
CONSTANTS_ROLE = "tg-const"
|
||||
import telegram # We need this so that the `eval` below works
|
||||
|
||||
|
||||
class TGConstXRefRole(PyXRefRole):
|
||||
"""This is a bit of Sphinx magic. We add a new role type called tg-const that allows us to
|
||||
reference values from the `telegram.constants.module` while using the actual value as title
|
||||
of the link.
|
||||
|
||||
Example:
|
||||
|
||||
:tg-const:`telegram.constants.MessageLimit.TEXT_LENGTH` renders as `4096` but links to the
|
||||
constant.
|
||||
"""
|
||||
|
||||
def process_link(
|
||||
self,
|
||||
env: BuildEnvironment,
|
||||
refnode: Element,
|
||||
has_explicit_title: bool,
|
||||
title: str,
|
||||
target: str,
|
||||
) -> Tuple[str, str]:
|
||||
title, target = super().process_link(env, refnode, has_explicit_title, title, target)
|
||||
try:
|
||||
# We use `eval` to get the value of the expression. Maybe there are better ways to
|
||||
# do this via importlib or so, but it does the job for now
|
||||
value = eval(target)
|
||||
# Maybe we need a better check if the target is actually from tg.constants
|
||||
# for now checking if it's an Enum suffices since those are used nowhere else in PTB
|
||||
if isinstance(value, Enum):
|
||||
# Special casing for file size limits
|
||||
if isinstance(value, telegram.constants.FileSizeLimit):
|
||||
return f"{int(value.value / 1e6)} MB", target
|
||||
return repr(value.value), target
|
||||
# Just for (Bot API) versions number auto add in constants:
|
||||
if isinstance(value, str) and target in (
|
||||
"telegram.constants.BOT_API_VERSION",
|
||||
"telegram.__version__",
|
||||
):
|
||||
return value, target
|
||||
if isinstance(value, tuple) and target in (
|
||||
"telegram.constants.BOT_API_VERSION_INFO",
|
||||
"telegram.__version_info__",
|
||||
):
|
||||
return repr(value), target
|
||||
sphinx_logger.warning(
|
||||
f"%s:%d: WARNING: Did not convert reference %s. :{CONSTANTS_ROLE}: is not supposed"
|
||||
" to be used with this type of target.",
|
||||
refnode.source,
|
||||
refnode.line,
|
||||
refnode.rawsource,
|
||||
)
|
||||
return title, target
|
||||
except Exception as exc:
|
||||
sphinx_logger.exception(
|
||||
f"%s:%d: WARNING: Did not convert reference %s due to an exception.",
|
||||
refnode.source,
|
||||
refnode.line,
|
||||
refnode.rawsource,
|
||||
exc_info=exc,
|
||||
)
|
||||
return title, target
|
||||
|
||||
|
||||
def autodoc_skip_member(app, what, name, obj, skip, options):
|
||||
pass
|
||||
"""We use this to not document certain members like filter() or check_update() for filters.
|
||||
See https://www.sphinx-doc.org/en/master/usage/extensions/autodoc.html#skipping-members"""
|
||||
|
||||
included = {"MessageFilter", "UpdateFilter"} # filter() and check_update() only for these.
|
||||
included_in_obj = any(inc in repr(obj) for inc in included)
|
||||
|
||||
if included_in_obj: # it's difficult to see if check_update is from an inherited-member or not
|
||||
for frame in inspect.stack(): # From https://github.com/sphinx-doc/sphinx/issues/9533
|
||||
if frame.function == "filter_members":
|
||||
docobj = frame.frame.f_locals["self"].object
|
||||
if not any(inc in str(docobj) for inc in included) and name == "check_update":
|
||||
return True
|
||||
break
|
||||
|
||||
if name == "filter" and obj.__module__ == "telegram.ext.filters":
|
||||
if not included_in_obj:
|
||||
return True # return True to exclude from docs.
|
||||
|
||||
|
||||
def setup(app):
|
||||
app.connect('autodoc-skip-member', autodoc_skip_member)
|
||||
# ------------------------------------------------------------------------------------------------
|
||||
# This part is for getting the [source] links on the classes, methods etc link to the correct
|
||||
# files & lines on github. Can be simplified once https://github.com/sphinx-doc/sphinx/issues/1556
|
||||
# is closed
|
||||
|
||||
line_numbers = {}
|
||||
file_root = Path(inspect.getsourcefile(telegram)).parent.parent.resolve()
|
||||
import telegram.ext # Needed for checking if an object is a BaseFilter
|
||||
|
||||
|
||||
def autodoc_process_docstring(app: Sphinx, what, name: str, obj: object, options, lines):
|
||||
"""We misuse this autodoc hook to get the file names & line numbers because we have access
|
||||
to the actual object here.
|
||||
"""
|
||||
# Ce can't properly handle ordinary attributes.
|
||||
# In linkcode_resolve we'll resolve to the `__init__` or module instead
|
||||
if what == "attribute":
|
||||
return
|
||||
|
||||
# Special casing for properties
|
||||
if hasattr(obj, "fget"):
|
||||
obj = obj.fget
|
||||
|
||||
# Special casing for filters
|
||||
if isinstance(obj, telegram.ext.filters.BaseFilter):
|
||||
obj = obj.__class__
|
||||
|
||||
try:
|
||||
source_lines, start_line = inspect.getsourcelines(obj)
|
||||
end_line = start_line + len(source_lines)
|
||||
file = Path(inspect.getsourcefile(obj)).relative_to(file_root)
|
||||
line_numbers[name] = (file, start_line, end_line)
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
# Since we don't document the `__init__`, we call this manually to have it available for
|
||||
# attributes -- see the note above
|
||||
if what == "class":
|
||||
autodoc_process_docstring(app, "method", f"{name}.__init__", obj.__init__, options, lines)
|
||||
|
||||
|
||||
def _git_branch() -> str:
|
||||
"""Get's the current git sha if available or fall back to `master`"""
|
||||
try:
|
||||
output = subprocess.check_output( # skipcq: BAN-B607
|
||||
["git", "describe", "--tags", "--always"], stderr=subprocess.STDOUT
|
||||
)
|
||||
return output.decode().strip()
|
||||
except Exception as exc:
|
||||
sphinx_logger.exception(
|
||||
f"Failed to get a description of the current commit. Falling back to `master`.",
|
||||
exc_info=exc,
|
||||
)
|
||||
return "master"
|
||||
|
||||
|
||||
git_branch = _git_branch()
|
||||
base_url = "https://github.com/python-telegram-bot/python-telegram-bot/blob/"
|
||||
|
||||
|
||||
def linkcode_resolve(_, info):
|
||||
"""See www.sphinx-doc.org/en/master/usage/extensions/linkcode.html"""
|
||||
combined = ".".join((info["module"], info["fullname"]))
|
||||
# special casing for ExtBot which is due to the special structure of extbot.rst
|
||||
combined = combined.replace("ExtBot.ExtBot", "ExtBot")
|
||||
|
||||
line_info = line_numbers.get(combined)
|
||||
|
||||
if not line_info:
|
||||
# Try the __init__
|
||||
line_info = line_numbers.get(f"{combined.rsplit('.', 1)[0]}.__init__")
|
||||
if not line_info:
|
||||
# Try the class
|
||||
line_info = line_numbers.get(f"{combined.rsplit('.', 1)[0]}")
|
||||
if not line_info:
|
||||
# Try the module
|
||||
line_info = line_numbers.get(info["module"])
|
||||
|
||||
if not line_info:
|
||||
return
|
||||
|
||||
file, start_line, end_line = line_info
|
||||
return f"{base_url}{git_branch}/{file}#L{start_line}-L{end_line}"
|
||||
|
||||
|
||||
# End of logic for the [source] links
|
||||
# ------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
# Some base classes are implementation detail
|
||||
# We want to instead show *their* base class
|
||||
PRIVATE_BASE_CLASSES = {
|
||||
"_ChatUserBaseFilter": "MessageFilter",
|
||||
"_Dice": "MessageFilter",
|
||||
"_BaseThumbedMedium": "TelegramObject",
|
||||
"_BaseMedium": "TelegramObject",
|
||||
"_CredentialsBase": "TelegramObject",
|
||||
}
|
||||
|
||||
|
||||
def autodoc_process_bases(app, name, obj, option, bases: list):
|
||||
"""Here we fine tune how the base class's classes are displayed."""
|
||||
for idx, base in enumerate(bases):
|
||||
# let's use a string representation of the object
|
||||
base = str(base)
|
||||
|
||||
# Special case because base classes are in std lib:
|
||||
if "StringEnum" in base == "<enum 'StringEnum'>":
|
||||
bases[idx] = ":class:`enum.Enum`"
|
||||
bases.insert(0, ":class:`str`")
|
||||
continue
|
||||
|
||||
if "IntEnum" in base:
|
||||
bases[idx] = ":class:`enum.IntEnum`"
|
||||
continue
|
||||
|
||||
# Drop generics (at least for now)
|
||||
if base.endswith("]"):
|
||||
base = base.split("[", maxsplit=1)[0]
|
||||
bases[idx] = f":class:`{base}`"
|
||||
|
||||
# Now convert `telegram._message.Message` to `telegram.Message` etc
|
||||
match = re.search(pattern=r"(telegram(\.ext|))\.[_\w\.]+", string=base)
|
||||
if not match or "_utils" in base:
|
||||
continue
|
||||
|
||||
parts = match.group(0).split(".")
|
||||
|
||||
# Remove private paths
|
||||
for index, part in enumerate(parts):
|
||||
if part.startswith("_"):
|
||||
parts = parts[:index] + parts[-1:]
|
||||
break
|
||||
|
||||
# Replace private base classes with their respective parent
|
||||
parts = [PRIVATE_BASE_CLASSES.get(part, part) for part in parts]
|
||||
|
||||
base = ".".join(parts)
|
||||
|
||||
bases[idx] = f":class:`{base}`"
|
||||
|
||||
|
||||
def setup(app: Sphinx):
|
||||
app.connect("autodoc-skip-member", autodoc_skip_member)
|
||||
app.connect("autodoc-process-bases", autodoc_process_bases)
|
||||
app.connect("autodoc-process-docstring", autodoc_process_docstring)
|
||||
app.add_role_to_domain("py", CONSTANTS_ROLE, TGConstXRefRole())
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
.. include:: ../../.github/CONTRIBUTING.rst
|
||||
@@ -0,0 +1,7 @@
|
||||
``arbitrarycallbackdatabot.py``
|
||||
===============================
|
||||
|
||||
.. literalinclude:: ../../examples/arbitrarycallbackdatabot.py
|
||||
:language: python
|
||||
:linenos:
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
``chatmemberbot.py``
|
||||
====================
|
||||
|
||||
.. literalinclude:: ../../examples/chatmemberbot.py
|
||||
:language: python
|
||||
:linenos:
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
``contexttypesbot.py``
|
||||
======================
|
||||
|
||||
.. literalinclude:: ../../examples/contexttypesbot.py
|
||||
:language: python
|
||||
:linenos:
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
``conversationbot.py``
|
||||
======================
|
||||
|
||||
.. literalinclude:: ../../examples/conversationbot.py
|
||||
:language: python
|
||||
:linenos:
|
||||
|
||||
.. _conversationbot-diagram:
|
||||
|
||||
State Diagram
|
||||
-------------
|
||||
|
||||
.. mermaid:: ../../examples/conversationbot.mmd
|
||||
@@ -0,0 +1,13 @@
|
||||
``conversationbot2.py``
|
||||
=======================
|
||||
|
||||
.. literalinclude:: ../../examples/conversationbot2.py
|
||||
:language: python
|
||||
:linenos:
|
||||
|
||||
.. _conversationbot2-diagram:
|
||||
|
||||
State Diagram
|
||||
-------------
|
||||
|
||||
.. mermaid:: ../../examples/conversationbot2.mmd
|
||||
@@ -0,0 +1,7 @@
|
||||
``customwebhookbot.py``
|
||||
=======================
|
||||
|
||||
.. literalinclude:: ../../examples/customwebhookbot.py
|
||||
:language: python
|
||||
:linenos:
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
``deeplinking.py``
|
||||
==================
|
||||
|
||||
.. literalinclude:: ../../examples/deeplinking.py
|
||||
:language: python
|
||||
:linenos:
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
``echobot.py``
|
||||
==============
|
||||
|
||||
.. literalinclude:: ../../examples/echobot.py
|
||||
:language: python
|
||||
:linenos:
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
``errorhandlerbot.py``
|
||||
======================
|
||||
|
||||
.. literalinclude:: ../../examples/errorhandlerbot.py
|
||||
:language: python
|
||||
:linenos:
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
``inlinebot.py``
|
||||
================
|
||||
|
||||
.. literalinclude:: ../../examples/inlinebot.py
|
||||
:language: python
|
||||
:linenos:
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
``inlinekeyboard.py``
|
||||
=====================
|
||||
|
||||
.. literalinclude:: ../../examples/inlinekeyboard.py
|
||||
:language: python
|
||||
:linenos:
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
``inlinekeyboard2.py``
|
||||
======================
|
||||
|
||||
.. literalinclude:: ../../examples/inlinekeyboard2.py
|
||||
:language: python
|
||||
:linenos:
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
``nestedconversationbot.py``
|
||||
============================
|
||||
|
||||
.. literalinclude:: ../../examples/nestedconversationbot.py
|
||||
:language: python
|
||||
:linenos:
|
||||
|
||||
.. _nestedconversationbot-diagram:
|
||||
|
||||
State Diagram
|
||||
-------------
|
||||
|
||||
.. mermaid:: ../../examples/nestedconversationbot.mmd
|
||||
@@ -0,0 +1,16 @@
|
||||
``passportbot.py``
|
||||
==================
|
||||
|
||||
.. literalinclude:: ../../examples/passportbot.py
|
||||
:language: python
|
||||
:linenos:
|
||||
|
||||
.. _passportbot-html:
|
||||
|
||||
HTML Page
|
||||
---------
|
||||
|
||||
.. literalinclude:: ../../examples/passportbot.html
|
||||
:language: html
|
||||
:linenos:
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
``paymentbot.py``
|
||||
=================
|
||||
|
||||
.. literalinclude:: ../../examples/paymentbot.py
|
||||
:language: python
|
||||
:linenos:
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
``persistentconversationbot.py``
|
||||
================================
|
||||
|
||||
.. literalinclude:: ../../examples/persistentconversationbot.py
|
||||
:language: python
|
||||
:linenos:
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
``pollbot.py``
|
||||
==============
|
||||
|
||||
.. literalinclude:: ../../examples/pollbot.py
|
||||
:language: python
|
||||
:linenos:
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
`rawapibot.py`
|
||||
==============
|
||||
|
||||
This example uses only the pure, "bare-metal" API wrapper.
|
||||
|
||||
|
||||
|
||||
.. literalinclude:: ../../examples/rawapibot.py
|
||||
:language: python
|
||||
:linenos:
|
||||
|
||||
@@ -0,0 +1,194 @@
|
||||
Examples
|
||||
========
|
||||
|
||||
In this section we display small examples to show what a bot written with
|
||||
``python-telegram-bot`` looks like.
|
||||
Some bots focus on one specific
|
||||
aspect of the Telegram Bot API while others focus on one of the
|
||||
mechanics of this library. Except for the
|
||||
:any:`examples.rawapibot` example, they all use the high-level
|
||||
framework this library provides with the
|
||||
:any:`telegram.ext <telegram.ext>` submodule.
|
||||
|
||||
All examples are licensed under the `CC0
|
||||
License <https://github.com/python-telegram-bot/python-telegram-bot/blob/master/examples/LICENSE.txt>`__
|
||||
and are therefore fully dedicated to the public domain. You can use them
|
||||
as the base for your own bots without worrying about copyrights.
|
||||
|
||||
Do note that we ignore one pythonic convention. Best practice would
|
||||
dictate, in many handler callbacks function signatures, to replace the
|
||||
argument ``context`` with an underscore, since ``context`` is an unused
|
||||
local variable in those callbacks. However, since these are examples and
|
||||
not having a name for that argument confuses beginners, we decided to
|
||||
have it present.
|
||||
|
||||
:any:`examples.echobot`
|
||||
-----------------------
|
||||
|
||||
This is probably the base for most of the bots made with
|
||||
``python-telegram-bot``. It simply replies to each text message with a
|
||||
message that contains the same text.
|
||||
|
||||
:any:`examples.timerbot`
|
||||
------------------------
|
||||
|
||||
This bot uses the
|
||||
:class:`telegram.ext.JobQueue`
|
||||
class to send timed messages. The user sets a timer by using ``/set``
|
||||
command with a specific time, for example ``/set 30``. The bot then sets
|
||||
up a job to send a message to that user after 30 seconds. The user can
|
||||
also cancel the timer by sending ``/unset``. To learn more about the
|
||||
``JobQueue``, read `this wiki
|
||||
article <https://github.com/python-telegram-bot/python-telegram-bot/wiki/Extensions-%E2%80%93-JobQueue>`__.
|
||||
|
||||
:any:`examples.conversationbot`
|
||||
-------------------------------
|
||||
|
||||
A common task for a bot is to ask information from the user. In v5.0 of
|
||||
this library, we introduced the
|
||||
:class:`telegram.ext.ConversationHandler`
|
||||
for that exact purpose. This example uses it to retrieve
|
||||
user-information in a conversation-like style. To get a better
|
||||
understanding, take a look at the :ref:`state diagram <conversationbot-diagram>`.
|
||||
|
||||
:any:`examples.conversationbot2`
|
||||
--------------------------------
|
||||
|
||||
A more complex example of a bot that uses the ``ConversationHandler``.
|
||||
It is also more confusing. Good thing there is a :ref:`fancy state diagram <conversationbot2-diagram>`.
|
||||
for this one, too!
|
||||
|
||||
:any:`examples.nestedconversationbot`
|
||||
-------------------------------------
|
||||
|
||||
A even more complex example of a bot that uses the nested
|
||||
``ConversationHandler``\ s. While it’s certainly not that complex that
|
||||
you couldn’t built it without nested ``ConversationHanldler``\ s, it
|
||||
gives a good impression on how to work with them. Of course, there is a
|
||||
:ref:`fancy state diagram <nestedconversationbot-diagram>`
|
||||
for this example, too!
|
||||
|
||||
:any:`examples.persistentconversationbot`
|
||||
-----------------------------------------
|
||||
|
||||
A basic example of a bot store conversation state and user_data over
|
||||
multiple restarts.
|
||||
|
||||
:any:`examples.inlinekeyboard`
|
||||
------------------------------
|
||||
|
||||
This example sheds some light on inline keyboards, callback queries and
|
||||
message editing. A wiki site explaining this examples lives
|
||||
`here <https://github.com/python-telegram-bot/python-telegram-bot/wiki/InlineKeyboard-Example>`__.
|
||||
|
||||
:any:`examples.inlinekeyboard2`
|
||||
-------------------------------
|
||||
|
||||
A more complex example about inline keyboards, callback queries and
|
||||
message editing. This example showcases how an interactive menu could be
|
||||
build using inline keyboards.
|
||||
|
||||
:any:`examples.deeplinking`
|
||||
---------------------------
|
||||
|
||||
A basic example on how to use deeplinking with inline keyboards.
|
||||
|
||||
:any:`examples.inlinebot`
|
||||
-------------------------
|
||||
|
||||
A basic example of an `inline
|
||||
bot <https://core.telegram.org/bots/inline>`__. Don’t forget to enable
|
||||
inline mode with `@BotFather <https://telegram.me/BotFather>`_.
|
||||
|
||||
:any:`examples.pollbot`
|
||||
-----------------------
|
||||
|
||||
This example sheds some light on polls, poll answers and the
|
||||
corresponding handlers.
|
||||
|
||||
:any:`examples.passportbot`
|
||||
---------------------------
|
||||
|
||||
A basic example of a bot that can accept passports. Use in combination
|
||||
with the :ref:`HTML page <passportbot-html>`.
|
||||
Don’t forget to enable and configure payments with
|
||||
`@BotFather <https://telegram.me/BotFather>`_. Check out this
|
||||
`guide <https://github.com/python-telegram-bot/python-telegram-bot/wiki/Telegram-Passport>`__
|
||||
on Telegram passports in PTB.
|
||||
|
||||
:any:`examples.paymentbot`
|
||||
--------------------------
|
||||
|
||||
A basic example of a bot that can accept payments. Don’t forget to
|
||||
enable and configure payments with
|
||||
`@BotFather <https://telegram.me/BotFather>`_.
|
||||
|
||||
:any:`examples.errorhandlerbot`
|
||||
-------------------------------
|
||||
|
||||
A basic example on how to set up a custom error handler.
|
||||
|
||||
:any:`examples.chatmemberbot`
|
||||
-----------------------------
|
||||
|
||||
A basic example on how ``(my_)chat_member`` updates can be used.
|
||||
|
||||
:any:`examples.webappbot`
|
||||
-------------------------
|
||||
|
||||
A basic example of how `Telegram
|
||||
WebApps <https://core.telegram.org/bots/webapps>`__ can be used. Use in
|
||||
combination with the :ref:`HTML page <webappbot-html>`.
|
||||
For your convenience, this file is hosted by the PTB team such that you
|
||||
don’t need to host it yourself. Uses the
|
||||
`iro.js <https://iro.js.org>`__ JavaScript library to showcase a
|
||||
user interface that is hard to achieve with native Telegram
|
||||
functionality.
|
||||
|
||||
:any:`examples.contexttypesbot`
|
||||
-------------------------------
|
||||
|
||||
This example showcases how ``telegram.ext.ContextTypes`` can be used to
|
||||
customize the ``context`` argument of handler and job callbacks.
|
||||
|
||||
:any:`examples.customwebhookbot`
|
||||
--------------------------------
|
||||
|
||||
This example showcases how a custom webhook setup can be used in
|
||||
combination with ``telegram.ext.Application``.
|
||||
|
||||
:any:`examples.arbitrarycallbackdatabot`
|
||||
----------------------------------------
|
||||
|
||||
This example showcases how PTBs “arbitrary callback data” feature can be
|
||||
used.
|
||||
|
||||
Pure API
|
||||
--------
|
||||
|
||||
The :any:`examples.rawapibot` example example uses only the pure, “bare-metal” API wrapper.
|
||||
|
||||
.. toctree::
|
||||
:hidden:
|
||||
|
||||
examples.arbitrarycallbackdatabot
|
||||
examples.chatmemberbot
|
||||
examples.contexttypesbot
|
||||
examples.conversationbot
|
||||
examples.conversationbot2
|
||||
examples.customwebhookbot
|
||||
examples.deeplinking
|
||||
examples.echobot
|
||||
examples.errorhandlerbot
|
||||
examples.inlinebot
|
||||
examples.inlinekeyboard
|
||||
examples.inlinekeyboard2
|
||||
examples.nestedconversationbot
|
||||
examples.passportbot
|
||||
examples.paymentbot
|
||||
examples.persistentconversationbot
|
||||
examples.pollbot
|
||||
examples.rawapibot
|
||||
examples.timerbot
|
||||
examples.webappbot
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
``timerbot.py``
|
||||
===============
|
||||
|
||||
.. literalinclude:: ../../examples/timerbot.py
|
||||
:language: python
|
||||
:linenos:
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
``webappbot.py``
|
||||
================
|
||||
|
||||
.. literalinclude:: ../../examples/webappbot.py
|
||||
:language: python
|
||||
:linenos:
|
||||
|
||||
.. _webappbot-html:
|
||||
|
||||
HTML Page
|
||||
---------
|
||||
|
||||
.. literalinclude:: ../../examples/webappbot.html
|
||||
:language: html
|
||||
:linenos:
|
||||
|
||||
@@ -0,0 +1,318 @@
|
||||
.. raw:: html
|
||||
|
||||
<hr style="height:2px;border-width:0;color:gray;background-color:gray">
|
||||
<p>Since this class has a large number of methods and attributes, below you can find a quick overview.
|
||||
|
||||
</p>
|
||||
<details>
|
||||
<summary>Sending Messages</summary>
|
||||
|
||||
.. list-table::
|
||||
:align: left
|
||||
:widths: 1 4
|
||||
|
||||
* - :meth:`~telegram.Bot.send_animation`
|
||||
- Used for sending animations
|
||||
* - :meth:`~telegram.Bot.send_audio`
|
||||
- Used for sending audio files
|
||||
* - :meth:`~telegram.Bot.send_chat_action`
|
||||
- Used for sending chat actions
|
||||
* - :meth:`~telegram.Bot.send_contact`
|
||||
- Used for sending contacts
|
||||
* - :meth:`~telegram.Bot.send_dice`
|
||||
- Used for sending dice messages
|
||||
* - :meth:`~telegram.Bot.send_document`
|
||||
- Used for sending documents
|
||||
* - :meth:`~telegram.Bot.send_game`
|
||||
- Used for sending a game
|
||||
* - :meth:`~telegram.Bot.send_invoice`
|
||||
- Used for sending an invoice
|
||||
* - :meth:`~telegram.Bot.send_location`
|
||||
- Used for sending location
|
||||
* - :meth:`~telegram.Bot.send_media_group`
|
||||
- Used for sending media grouped together
|
||||
* - :meth:`~telegram.Bot.send_message`
|
||||
- Used for sending text messages
|
||||
* - :meth:`~telegram.Bot.send_photo`
|
||||
- Used for sending photos
|
||||
* - :meth:`~telegram.Bot.send_poll`
|
||||
- Used for sending polls
|
||||
* - :meth:`~telegram.Bot.send_sticker`
|
||||
- Used for sending stickers
|
||||
* - :meth:`~telegram.Bot.send_venue`
|
||||
- Used for sending venue locations.
|
||||
* - :meth:`~telegram.Bot.send_video`
|
||||
- Used for sending videos
|
||||
* - :meth:`~telegram.Bot.send_video_note`
|
||||
- Used for sending video notes
|
||||
* - :meth:`~telegram.Bot.send_voice`
|
||||
- Used for sending voice messages
|
||||
* - :meth:`~telegram.Bot.copy_message`
|
||||
- Used for copying the contents of an arbitrary message
|
||||
* - :meth:`~telegram.Bot.forward_message`
|
||||
- Used for forwarding messages
|
||||
|
||||
.. raw:: html
|
||||
|
||||
</details>
|
||||
<br>
|
||||
|
||||
.. raw:: html
|
||||
|
||||
<details>
|
||||
<summary>Updating Messages</summary>
|
||||
|
||||
.. list-table::
|
||||
:align: left
|
||||
:widths: 1 4
|
||||
|
||||
* - :meth:`~telegram.Bot.answer_callback_query`
|
||||
- Used for answering the callback query
|
||||
* - :meth:`~telegram.Bot.answer_inline_query`
|
||||
- Used for answering the inline query
|
||||
* - :meth:`~telegram.Bot.answer_pre_checkout_query`
|
||||
- Used for answering a pre checkout query
|
||||
* - :meth:`~telegram.Bot.answer_shipping_query`
|
||||
- Used for answering a shipping query
|
||||
* - :meth:`~telegram.Bot.answer_web_app_query`
|
||||
- Used for answering a web app query
|
||||
* - :meth:`~telegram.Bot.edit_message_caption`
|
||||
- Used for editing captions
|
||||
* - :meth:`~telegram.Bot.edit_message_media`
|
||||
- Used for editing the media on messages
|
||||
* - :meth:`~telegram.Bot.edit_message_live_location`
|
||||
- Used for editing the location in live location messages
|
||||
* - :meth:`~telegram.Bot.edit_message_reply_markup`
|
||||
- Used for editing the reply markup on messages
|
||||
* - :meth:`~telegram.Bot.edit_message_text`
|
||||
- Used for editing text messages
|
||||
* - :meth:`~telegram.Bot.stop_poll`
|
||||
- Used for stopping the running poll
|
||||
* - :meth:`~telegram.Bot.delete_message`
|
||||
- Used for deleting messages.
|
||||
|
||||
.. raw:: html
|
||||
|
||||
</details>
|
||||
<br>
|
||||
|
||||
.. raw:: html
|
||||
|
||||
<details>
|
||||
<summary>Chat Moderation and information</summary>
|
||||
|
||||
.. list-table::
|
||||
:align: left
|
||||
:widths: 1 4
|
||||
|
||||
* - :meth:`~telegram.Bot.ban_chat_member`
|
||||
- Used for banning a member from the chat
|
||||
* - :meth:`~telegram.Bot.unban_chat_member`
|
||||
- Used for unbanning a member from the chat
|
||||
* - :meth:`~telegram.Bot.ban_chat_sender_chat`
|
||||
- Used for banning a channel in a channel or supergroup
|
||||
* - :meth:`~telegram.Bot.unban_chat_sender_chat`
|
||||
- Used for unbanning a channel in a channel or supergroup
|
||||
* - :meth:`~telegram.Bot.restrict_chat_member`
|
||||
- Used for restricting a chat member
|
||||
* - :meth:`~telegram.Bot.promote_chat_member`
|
||||
- Used for promoting a chat member
|
||||
* - :meth:`~telegram.Bot.set_chat_administrator_custom_title`
|
||||
- Used for assigning a custom admin title to an admin
|
||||
* - :meth:`~telegram.Bot.set_chat_permissions`
|
||||
- Used for setting the permissions of a chat
|
||||
* - :meth:`~telegram.Bot.export_chat_invite_link`
|
||||
- Used for creating a new primary invite link for a chat
|
||||
* - :meth:`~telegram.Bot.create_chat_invite_link`
|
||||
- Used for creating an additional invite link for a chat
|
||||
* - :meth:`~telegram.Bot.edit_chat_invite_link`
|
||||
- Used for editing a non-primary invite link
|
||||
* - :meth:`~telegram.Bot.revoke_chat_invite_link`
|
||||
- Used for revoking an invite link created by the bot
|
||||
* - :meth:`~telegram.Bot.approve_chat_join_request`
|
||||
- Used for approving a chat join request
|
||||
* - :meth:`~telegram.Bot.decline_chat_join_request`
|
||||
- Used for declining a chat join request
|
||||
* - :meth:`~telegram.Bot.set_chat_photo`
|
||||
- Used for setting a photo to a chat
|
||||
* - :meth:`~telegram.Bot.delete_chat_photo`
|
||||
- Used for deleting a chat photo
|
||||
* - :meth:`~telegram.Bot.set_chat_title`
|
||||
- Used for setting a chat title
|
||||
* - :meth:`~telegram.Bot.set_chat_description`
|
||||
- Used for setting the description of a chat
|
||||
* - :meth:`~telegram.Bot.pin_chat_message`
|
||||
- Used for pinning a message
|
||||
* - :meth:`~telegram.Bot.unpin_chat_message`
|
||||
- Used for unpinning a message
|
||||
* - :meth:`~telegram.Bot.unpin_all_chat_messages`
|
||||
- Used for unpinning all pinned chat messages
|
||||
* - :meth:`~telegram.Bot.get_user_profile_photos`
|
||||
- Used for obtaining user's profile pictures
|
||||
* - :meth:`~telegram.Bot.get_chat`
|
||||
- Used for getting information about a chat
|
||||
* - :meth:`~telegram.Bot.get_chat_administrators`
|
||||
- Used for getting the list of admins in a chat
|
||||
* - :meth:`~telegram.Bot.get_chat_member_count`
|
||||
- Used for getting the number of members in a chat
|
||||
* - :meth:`~telegram.Bot.get_chat_member`
|
||||
- Used for getting a member of a chat
|
||||
* - :meth:`~telegram.Bot.set_my_commands`
|
||||
- Used for setting the list of commands
|
||||
* - :meth:`~telegram.Bot.delete_my_commands`
|
||||
- Used for deleting the list of commands
|
||||
* - :meth:`~telegram.Bot.get_my_commands`
|
||||
- Used for obtaining the list of commands
|
||||
* - :meth:`~telegram.Bot.get_my_default_administrator_rights`
|
||||
- Used for obtaining the default administrator rights for the bot
|
||||
* - :meth:`~telegram.Bot.set_my_default_administrator_rights`
|
||||
- Used for setting the default administrator rights for the bot
|
||||
* - :meth:`~telegram.Bot.get_chat_menu_button`
|
||||
- Used for obtaining the menu button of a private chat or the default menu button
|
||||
* - :meth:`~telegram.Bot.set_chat_menu_button`
|
||||
- Used for setting the menu button of a private chat or the default menu button
|
||||
* - :meth:`~telegram.Bot.leave_chat`
|
||||
- Used for leaving a chat
|
||||
|
||||
.. raw:: html
|
||||
|
||||
</details>
|
||||
<br>
|
||||
|
||||
.. raw:: html
|
||||
|
||||
<details>
|
||||
<summary>Stickerset management</summary>
|
||||
|
||||
.. list-table::
|
||||
:align: left
|
||||
:widths: 1 4
|
||||
|
||||
* - :meth:`~telegram.Bot.add_sticker_to_set`
|
||||
- Used for adding a sticker to a set
|
||||
* - :meth:`~telegram.Bot.delete_sticker_from_set`
|
||||
- Used for deleting a sticker from a set
|
||||
* - :meth:`~telegram.Bot.create_new_sticker_set`
|
||||
- Used for creating a new sticker set
|
||||
* - :meth:`~telegram.Bot.set_chat_sticker_set`
|
||||
- Used for setting a sticker set
|
||||
* - :meth:`~telegram.Bot.delete_chat_sticker_set`
|
||||
- Used for deleting the set sticker set
|
||||
* - :meth:`~telegram.Bot.set_sticker_position_in_set`
|
||||
- Used for moving a sticker's position in the set
|
||||
* - :meth:`~telegram.Bot.set_sticker_set_thumb`
|
||||
- Used for setting the thumbnail of a sticker set
|
||||
* - :meth:`~telegram.Bot.get_sticker_set`
|
||||
- Used for getting a sticker set
|
||||
* - :meth:`~telegram.Bot.upload_sticker_file`
|
||||
- Used for uploading a sticker file
|
||||
* - :meth:`~telegram.Bot.get_custom_emoji_stickers`
|
||||
- Used for getting custom emoji files based on their IDs
|
||||
|
||||
.. raw:: html
|
||||
|
||||
</details>
|
||||
<br>
|
||||
|
||||
.. raw:: html
|
||||
|
||||
<details>
|
||||
<summary>Games</summary>
|
||||
|
||||
.. list-table::
|
||||
:align: left
|
||||
:widths: 1 4
|
||||
|
||||
* - :meth:`~telegram.Bot.get_game_high_scores`
|
||||
- Used for getting the game high scores
|
||||
* - :meth:`~telegram.Bot.set_game_score`
|
||||
- Used for setting the game score
|
||||
|
||||
.. raw:: html
|
||||
|
||||
</details>
|
||||
<br>
|
||||
|
||||
.. raw:: html
|
||||
|
||||
<details>
|
||||
<summary>Getting updates</summary>
|
||||
|
||||
.. list-table::
|
||||
:align: left
|
||||
:widths: 1 4
|
||||
|
||||
* - :meth:`~telegram.Bot.get_updates`
|
||||
- Used for getting updates using long polling
|
||||
* - :meth:`~telegram.Bot.get_webhook_info`
|
||||
- Used for getting current webhook status
|
||||
* - :meth:`~telegram.Bot.set_webhook`
|
||||
- Used for setting a webhook to receive updates
|
||||
* - :meth:`~telegram.Bot.delete_webhook`
|
||||
- Used for removing webhook integration
|
||||
|
||||
.. raw:: html
|
||||
|
||||
</details>
|
||||
<br>
|
||||
|
||||
.. raw:: html
|
||||
|
||||
<details>
|
||||
<summary>Miscellaneous</summary>
|
||||
|
||||
.. list-table::
|
||||
:align: left
|
||||
:widths: 1 4
|
||||
|
||||
* - :meth:`~telegram.Bot.create_invoice_link`
|
||||
- Used to generate an HTTP link for an invoice
|
||||
* - :meth:`~telegram.Bot.close`
|
||||
- Used for closing server instance when switching to another local server
|
||||
* - :meth:`~telegram.Bot.log_out`
|
||||
- Used for logging out from cloud Bot API server
|
||||
* - :meth:`~telegram.Bot.get_file`
|
||||
- Used for getting basic info about a file
|
||||
* - :meth:`~telegram.Bot.get_me`
|
||||
- Used for getting basic information about the bot
|
||||
|
||||
.. raw:: html
|
||||
|
||||
</details>
|
||||
<br>
|
||||
|
||||
.. raw:: html
|
||||
|
||||
<details>
|
||||
<summary>Properties</summary>
|
||||
|
||||
.. list-table::
|
||||
:align: left
|
||||
:widths: 1 4
|
||||
|
||||
* - :attr:`~telegram.Bot.bot`
|
||||
- The user instance of the bot as returned by :meth:`~telegram.Bot.get_me`
|
||||
* - :attr:`~telegram.Bot.can_join_groups`
|
||||
- Whether the bot can join groups
|
||||
* - :attr:`~telegram.Bot.can_read_all_group_messages`
|
||||
- Whether the bot can read all incoming group messages
|
||||
* - :attr:`~telegram.Bot.id`
|
||||
- The user id of the bot
|
||||
* - :attr:`~telegram.Bot.name`
|
||||
- The username of the bot, with leading ``@``
|
||||
* - :attr:`~telegram.Bot.first_name`
|
||||
- The first name of the bot
|
||||
* - :attr:`~telegram.Bot.last_name`
|
||||
- The last name of the bot
|
||||
* - :attr:`~telegram.Bot.username`
|
||||
- The username of the bot, without leading ``@``
|
||||
* - :attr:`~telegram.Bot.link`
|
||||
- The t.me link of the bot
|
||||
* - :attr:`~telegram.Bot.supports_inline_queries`
|
||||
- Whether the bot supports inline queries
|
||||
|
||||
.. raw:: html
|
||||
|
||||
</details>
|
||||
<br>
|
||||
<hr style="height:2px;border-width:0;color:gray;background-color:gray">
|
||||
@@ -0,0 +1,10 @@
|
||||
.. tip::
|
||||
When making requests to the Bot API in an asynchronous fashion (e.g. via
|
||||
:attr:`block=False <telegram.ext.BaseHandler.block>`, :meth:`Application.create_task <telegram.ext.Application.create_task>`,
|
||||
:meth:`~telegram.ext.ApplicationBuilder.concurrent_updates` or the :class:`~telegram.ext.JobQueue`), it can happen that more requests
|
||||
are being made in parallel than there are connections in the pool.
|
||||
If the number of requests is much higher than the number of connections, even setting
|
||||
:meth:`~telegram.ext.ApplicationBuilder.pool_timeout` to a larger value may not always be enough to prevent pool
|
||||
timeouts.
|
||||
You should therefore set :meth:`~telegram.ext.ApplicationBuilder.concurrent_updates`, :meth:`~telegram.ext.ApplicationBuilder.connection_pool_size` and
|
||||
:meth:`~telegram.ext.ApplicationBuilder.pool_timeout` to values that make sense for your setup.
|
||||
+23
-23
@@ -3,36 +3,36 @@
|
||||
You can adapt this file completely to your liking, but it should at least
|
||||
contain the root `toctree` directive.
|
||||
|
||||
Welcome to Python Telegram Bot's documentation!
|
||||
===============================================
|
||||
.. include:: ../../README.rst
|
||||
|
||||
Guides and tutorials
|
||||
====================
|
||||
|
||||
If you're just starting out with the library, we recommend following our `"Your first Bot" <https://github.com/python-telegram-bot/python-telegram-bot/wiki/Extensions-%E2%80%93-Your-first-Bot>`_ tutorial that you can find on our `wiki <https://github.com/python-telegram-bot/python-telegram-bot/wiki>`_.
|
||||
On our wiki you will also find guides like how to use handlers, webhooks, emoji, proxies and much more.
|
||||
|
||||
Examples
|
||||
========
|
||||
|
||||
A great way to learn is by looking at examples. Ours can be found at our `github in the examples folder <https://github.com/python-telegram-bot/python-telegram-bot/tree/master/examples>`_.
|
||||
|
||||
|
||||
Reference
|
||||
=========
|
||||
|
||||
Below you can find a reference of all the classes and methods in python-telegram-bot.
|
||||
Apart from the `telegram.ext` package the objects should reflect the types defined in the `official telegram bot api documentation <https://core.telegram.org/bots/api>`_.
|
||||
.. The toctrees are hidden such that they don't render on the start page but still include the contents into the documentation.
|
||||
|
||||
.. toctree::
|
||||
:hidden:
|
||||
:caption: Reference
|
||||
|
||||
telegram
|
||||
|
||||
Changelog
|
||||
---------
|
||||
telegram.ext
|
||||
telegram_auxil
|
||||
Telegrams Bot API Docs <https://core.telegram.org/bots/api>
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 2
|
||||
:hidden:
|
||||
:caption: Resources
|
||||
|
||||
examples
|
||||
Wiki <https://github.com/python-telegram-bot/python-telegram-bot/wiki>
|
||||
|
||||
.. toctree::
|
||||
:hidden:
|
||||
:caption: Project
|
||||
|
||||
changelog
|
||||
Website <https://python-telegram-bot.org>
|
||||
GitHub Repository <https://github.com/python-telegram-bot/python-telegram-bot/>
|
||||
Telegram Channel <https://t.me/pythontelegrambotchannel/>
|
||||
Telegram User Group <https://t.me/pythontelegrambotgroup/>
|
||||
contributing
|
||||
coc
|
||||
|
||||
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 1.1 KiB |
@@ -1,6 +1,9 @@
|
||||
telegram.Animation
|
||||
==================
|
||||
|
||||
.. Also lists methods of _BaseThumbedMedium, but not the ones of TelegramObject
|
||||
|
||||
.. autoclass:: telegram.Animation
|
||||
:members:
|
||||
:show-inheritance:
|
||||
:inherited-members: TelegramObject
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
telegram.Audio
|
||||
==============
|
||||
|
||||
.. Also lists methods of _BaseThumbedMedium, but not the ones of TelegramObject
|
||||
|
||||
.. autoclass:: telegram.Audio
|
||||
:members:
|
||||
:show-inheritance:
|
||||
:inherited-members: TelegramObject
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
telegram.BotCommandScope
|
||||
========================
|
||||
|
||||
.. autoclass:: telegram.BotCommandScope
|
||||
:members:
|
||||
:show-inheritance:
|
||||
@@ -0,0 +1,6 @@
|
||||
telegram.BotCommandScopeAllChatAdministrators
|
||||
=============================================
|
||||
|
||||
.. autoclass:: telegram.BotCommandScopeAllChatAdministrators
|
||||
:members:
|
||||
:show-inheritance:
|
||||
@@ -0,0 +1,6 @@
|
||||
telegram.BotCommandScopeAllGroupChats
|
||||
=======================================
|
||||
|
||||
.. autoclass:: telegram.BotCommandScopeAllGroupChats
|
||||
:members:
|
||||
:show-inheritance:
|
||||
@@ -0,0 +1,6 @@
|
||||
telegram.BotCommandScopeAllPrivateChats
|
||||
=======================================
|
||||
|
||||
.. autoclass:: telegram.BotCommandScopeAllPrivateChats
|
||||
:members:
|
||||
:show-inheritance:
|
||||
@@ -0,0 +1,6 @@
|
||||
telegram.BotCommandScopeChat
|
||||
============================
|
||||
|
||||
.. autoclass:: telegram.BotCommandScopeChat
|
||||
:members:
|
||||
:show-inheritance:
|
||||
@@ -0,0 +1,6 @@
|
||||
telegram.BotCommandScopeChatAdministrators
|
||||
==========================================
|
||||
|
||||
.. autoclass:: telegram.BotCommandScopeChatAdministrators
|
||||
:members:
|
||||
:show-inheritance:
|
||||
@@ -0,0 +1,6 @@
|
||||
telegram.BotCommandScopeChatMember
|
||||
==================================
|
||||
|
||||
.. autoclass:: telegram.BotCommandScopeChatMember
|
||||
:members:
|
||||
:show-inheritance:
|
||||
@@ -0,0 +1,6 @@
|
||||
telegram.BotCommandScopeDefault
|
||||
===============================
|
||||
|
||||
.. autoclass:: telegram.BotCommandScopeDefault
|
||||
:members:
|
||||
:show-inheritance:
|
||||
@@ -1,6 +0,0 @@
|
||||
telegram.ChatAction
|
||||
===================
|
||||
|
||||
.. autoclass:: telegram.ChatAction
|
||||
:members:
|
||||
:show-inheritance:
|
||||
@@ -0,0 +1,8 @@
|
||||
telegram.ChatAdministratorRights
|
||||
================================
|
||||
|
||||
.. versionadded:: 20.0
|
||||
|
||||
.. autoclass:: telegram.ChatAdministratorRights
|
||||
:members:
|
||||
:show-inheritance:
|
||||
@@ -0,0 +1,6 @@
|
||||
telegram.ChatInviteLink
|
||||
=======================
|
||||
|
||||
.. autoclass:: telegram.ChatInviteLink
|
||||
:members:
|
||||
:show-inheritance:
|
||||
@@ -0,0 +1,6 @@
|
||||
telegram.ChatJoinRequest
|
||||
========================
|
||||
|
||||
.. autoclass:: telegram.ChatJoinRequest
|
||||
:members:
|
||||
:show-inheritance:
|
||||
@@ -0,0 +1,6 @@
|
||||
telegram.ChatMemberAdministrator
|
||||
================================
|
||||
|
||||
.. autoclass:: telegram.ChatMemberAdministrator
|
||||
:members:
|
||||
:show-inheritance:
|
||||
@@ -0,0 +1,6 @@
|
||||
telegram.ChatMemberBanned
|
||||
=========================
|
||||
|
||||
.. autoclass:: telegram.ChatMemberBanned
|
||||
:members:
|
||||
:show-inheritance:
|
||||
@@ -0,0 +1,6 @@
|
||||
telegram.ChatMemberLeft
|
||||
=======================
|
||||
|
||||
.. autoclass:: telegram.ChatMemberLeft
|
||||
:members:
|
||||
:show-inheritance:
|
||||
@@ -0,0 +1,6 @@
|
||||
telegram.ChatMemberMember
|
||||
=========================
|
||||
|
||||
.. autoclass:: telegram.ChatMemberMember
|
||||
:members:
|
||||
:show-inheritance:
|
||||
@@ -0,0 +1,7 @@
|
||||
telegram.ChatMemberOwner
|
||||
========================
|
||||
|
||||
.. autoclass:: telegram.ChatMemberOwner
|
||||
:members:
|
||||
:show-inheritance:
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
telegram.ChatMemberRestricted
|
||||
=============================
|
||||
|
||||
.. autoclass:: telegram.ChatMemberRestricted
|
||||
:members:
|
||||
:show-inheritance:
|
||||
@@ -0,0 +1,6 @@
|
||||
telegram.ChatMemberUpdated
|
||||
==========================
|
||||
|
||||
.. autoclass:: telegram.ChatMemberUpdated
|
||||
:members:
|
||||
:show-inheritance:
|
||||
@@ -1,6 +1,8 @@
|
||||
telegram.Document
|
||||
=================
|
||||
.. Also lists methods of _BaseThumbedMedium, but not the ones of TelegramObject
|
||||
|
||||
.. autoclass:: telegram.Document
|
||||
:members:
|
||||
:show-inheritance:
|
||||
:inherited-members: TelegramObject
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
telegram.error module
|
||||
telegram.error Module
|
||||
=====================
|
||||
|
||||
.. automodule:: telegram.error
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
Arbitrary Callback Data
|
||||
-----------------------
|
||||
|
||||
.. toctree::
|
||||
|
||||
telegram.ext.callbackdatacache
|
||||
telegram.ext.invalidcallbackdata
|
||||
@@ -0,0 +1,6 @@
|
||||
telegram.ext.AIORateLimiter
|
||||
============================
|
||||
|
||||
.. autoclass:: telegram.ext.AIORateLimiter
|
||||
:members:
|
||||
:show-inheritance:
|
||||
@@ -0,0 +1,6 @@
|
||||
telegram.ext.Application
|
||||
========================
|
||||
|
||||
.. autoclass:: telegram.ext.Application
|
||||
:members:
|
||||
:show-inheritance:
|
||||
@@ -0,0 +1,5 @@
|
||||
telegram.ext.ApplicationBuilder
|
||||
===============================
|
||||
|
||||
.. autoclass:: telegram.ext.ApplicationBuilder
|
||||
:members:
|
||||
@@ -0,0 +1,6 @@
|
||||
telegram.ext.ApplicationHandlerStop
|
||||
===================================
|
||||
|
||||
.. autoclass:: telegram.ext.ApplicationHandlerStop
|
||||
:members:
|
||||
:show-inheritance:
|
||||
@@ -0,0 +1,6 @@
|
||||
telegram.ext.BaseHandler
|
||||
========================
|
||||
|
||||
.. autoclass:: telegram.ext.BaseHandler
|
||||
:members:
|
||||
:show-inheritance:
|
||||
@@ -0,0 +1,6 @@
|
||||
telegram.ext.BaseRateLimiter
|
||||
============================
|
||||
|
||||
.. autoclass:: telegram.ext.BaseRateLimiter
|
||||
:members:
|
||||
:show-inheritance:
|
||||
@@ -0,0 +1,6 @@
|
||||
telegram.ext.CallbackDataCache
|
||||
==============================
|
||||
|
||||
.. autoclass:: telegram.ext.CallbackDataCache
|
||||
:members:
|
||||
:show-inheritance:
|
||||
@@ -0,0 +1,6 @@
|
||||
telegram.ext.ChatJoinRequestHandler
|
||||
===================================
|
||||
|
||||
.. autoclass:: telegram.ext.ChatJoinRequestHandler
|
||||
:members:
|
||||
:show-inheritance:
|
||||
@@ -0,0 +1,6 @@
|
||||
telegram.ext.ChatMemberHandler
|
||||
==============================
|
||||
|
||||
.. autoclass:: telegram.ext.ChatMemberHandler
|
||||
:members:
|
||||
:show-inheritance:
|
||||
@@ -0,0 +1,6 @@
|
||||
telegram.ext.ContextTypes
|
||||
=========================
|
||||
|
||||
.. autoclass:: telegram.ext.ContextTypes
|
||||
:members:
|
||||
:show-inheritance:
|
||||
@@ -1,7 +0,0 @@
|
||||
telegram.ext.DelayQueue
|
||||
=======================
|
||||
|
||||
.. autoclass:: telegram.ext.DelayQueue
|
||||
:members:
|
||||
:show-inheritance:
|
||||
:special-members:
|
||||
@@ -1,6 +0,0 @@
|
||||
telegram.ext.Dispatcher
|
||||
=======================
|
||||
|
||||
.. autoclass:: telegram.ext.Dispatcher
|
||||
:members:
|
||||
:show-inheritance:
|
||||
@@ -1,6 +0,0 @@
|
||||
telegram.ext.DispatcherHandlerStop
|
||||
==================================
|
||||
|
||||
.. autoclass:: telegram.ext.DispatcherHandlerStop
|
||||
:members:
|
||||
:show-inheritance:
|
||||
@@ -0,0 +1,6 @@
|
||||
telegram.ext.ExtBot
|
||||
===================
|
||||
|
||||
.. autoclass:: telegram.ext.ExtBot
|
||||
:show-inheritance:
|
||||
:members: insert_callback_data, defaults, rate_limiter, initialize, shutdown
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user