mirror of
https://github.com/python-telegram-bot/python-telegram-bot.git
synced 2026-06-19 07:35:19 +00:00
Compare commits
41 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 75e700b4f3 | |||
| 143b64581d | |||
| afb9fc4898 | |||
| 5d663af824 | |||
| 0dd6afc177 | |||
| 4c710a3455 | |||
| 0fb5678180 | |||
| ab2996713d | |||
| cc7b55d837 | |||
| 6cfed61395 | |||
| 74e1d9fb5f | |||
| 351a282fa3 | |||
| 59d2f62f81 | |||
| 1f343592de | |||
| 4ad65a3b40 | |||
| 1a83d47fb3 | |||
| 6fdab3a58d | |||
| b4067ce363 | |||
| 85294fb58d | |||
| 7db5b4314a | |||
| 6d9e17a5dc | |||
| e79716ae35 | |||
| 69af37ded9 | |||
| 818d17c44d | |||
| 80d515de39 | |||
| 229b61a3ae | |||
| f34db07d70 | |||
| d228b33916 | |||
| 170dca0ac4 | |||
| d9dbd9481f | |||
| fcceb91b1a | |||
| 875f4ab4e3 | |||
| 87ecfee99e | |||
| 98f4dae84f | |||
| 6827d3da75 | |||
| bc5f3de3c3 | |||
| 5f406fb32f | |||
| 3ef646edbf | |||
| 1e82e6260b | |||
| 26203b4474 | |||
| 73d54f4e20 |
@@ -26,6 +26,9 @@
|
||||
// Enable automerge globally:
|
||||
"automerge": true,
|
||||
|
||||
// Only upgrade packages if 7 days have passed:
|
||||
"minimumReleaseAge": "7 days",
|
||||
|
||||
// Group package updates together:
|
||||
"packageRules": [
|
||||
// Linting dependencies in pyproject.toml in sync with the pre-commit-config hooks:
|
||||
|
||||
@@ -31,10 +31,10 @@ jobs:
|
||||
persist-credentials: false
|
||||
|
||||
- name: Install uv
|
||||
uses: astral-sh/setup-uv@e06108dd0aef18192324c70427afc47652e63a82 # v7.5.0
|
||||
uses: astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78 # v7.6.0
|
||||
with:
|
||||
# Install a specific version of uv.
|
||||
version: "0.10.10"
|
||||
version: "0.11.16"
|
||||
# Install 3.13:
|
||||
python-version: 3.13
|
||||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
name: Test Admonitions Generation
|
||||
name: Test Admonitions & Attributes Generation
|
||||
on:
|
||||
pull_request:
|
||||
types: [synchronize, reopened, ready_for_review]
|
||||
paths:
|
||||
- src/telegram/**
|
||||
- docs/**
|
||||
- .github/workflows/docs-admonitions.yml
|
||||
- .github/workflows/doc-tests.yml
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
@@ -13,8 +13,8 @@ on:
|
||||
permissions: {}
|
||||
|
||||
jobs:
|
||||
test-admonitions:
|
||||
name: Test Admonitions Generation
|
||||
test-admonitions-attributes:
|
||||
name: Test Admonitions & Attributes Generation
|
||||
runs-on: ${{matrix.os}}
|
||||
permissions:
|
||||
# for uploading artifacts
|
||||
@@ -38,5 +38,5 @@ jobs:
|
||||
run: |
|
||||
python -W ignore -m pip install --upgrade pip
|
||||
python -W ignore -m pip install .[all] --group all
|
||||
- name: Test autogeneration of admonitions
|
||||
run: pytest -v --tb=short tests/docs/admonition_inserter.py
|
||||
- name: Test autogeneration of admonitions and attributes
|
||||
run: pytest -v --tb=short tests/docs/admonition_inserter.py tests/docs/attribute_inserter.py
|
||||
@@ -35,7 +35,7 @@ jobs:
|
||||
- name: Upload linkcheck output
|
||||
# Run also if the previous steps failed
|
||||
if: always()
|
||||
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
|
||||
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
|
||||
with:
|
||||
name: linkcheck-output
|
||||
path: docs/build/html/output.*
|
||||
|
||||
@@ -21,13 +21,13 @@ jobs:
|
||||
with:
|
||||
persist-credentials: false
|
||||
- name: Install the latest version of uv
|
||||
uses: astral-sh/setup-uv@e06108dd0aef18192324c70427afc47652e63a82 # v7.5.0
|
||||
uses: astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78 # v7.6.0
|
||||
- name: Run zizmor
|
||||
run: uvx zizmor --persona=pedantic --format sarif . > results.sarif
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
- name: Upload SARIF file
|
||||
uses: github/codeql-action/upload-sarif@fdbfb4d2750291e159f0156def62b853c2798ca2 # v4.31.5
|
||||
uses: github/codeql-action/upload-sarif@7211b7c8077ea37d8641b6271f6a365a22a5fbfa # v4.36.0
|
||||
with:
|
||||
sarif_file: results.sarif
|
||||
category: zizmor
|
||||
|
||||
@@ -30,7 +30,7 @@ jobs:
|
||||
- name: Build a binary wheel and a source tarball
|
||||
run: python3 -m build
|
||||
- name: Store the distribution packages
|
||||
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
|
||||
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
|
||||
with:
|
||||
name: python-package-distributions
|
||||
path: dist/
|
||||
@@ -60,7 +60,7 @@ jobs:
|
||||
name: python-package-distributions
|
||||
path: dist/
|
||||
- name: Publish to PyPI
|
||||
uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # v1.13.0
|
||||
uses: pypa/gh-action-pypi-publish@cef221092ed1bacb1cc03d23a2d87d1d172e277b # v1.14.0
|
||||
|
||||
compute-signatures:
|
||||
name: Compute SHA1 Sums and Sign with Sigstore
|
||||
@@ -92,7 +92,7 @@ jobs:
|
||||
./dist/*.tar.gz
|
||||
./dist/*.whl
|
||||
- name: Store the distribution packages and signatures
|
||||
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
|
||||
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
|
||||
with:
|
||||
name: python-package-distributions-and-signatures
|
||||
path: dist/
|
||||
|
||||
@@ -30,7 +30,7 @@ jobs:
|
||||
- name: Build a binary wheel and a source tarball
|
||||
run: python3 -m build
|
||||
- name: Store the distribution packages
|
||||
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
|
||||
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
|
||||
with:
|
||||
name: python-package-distributions
|
||||
path: dist/
|
||||
@@ -60,7 +60,7 @@ jobs:
|
||||
name: python-package-distributions
|
||||
path: dist/
|
||||
- name: Publish to Test PyPI
|
||||
uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # v1.13.0
|
||||
uses: pypa/gh-action-pypi-publish@cef221092ed1bacb1cc03d23a2d87d1d172e277b # v1.14.0
|
||||
with:
|
||||
repository-url: https://test.pypi.org/legacy/
|
||||
|
||||
@@ -94,7 +94,7 @@ jobs:
|
||||
./dist/*.tar.gz
|
||||
./dist/*.whl
|
||||
- name: Store the distribution packages and signatures
|
||||
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
|
||||
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
|
||||
with:
|
||||
name: python-package-distributions-and-signatures
|
||||
path: dist/
|
||||
|
||||
@@ -12,7 +12,7 @@ jobs:
|
||||
# For adding labels and closing
|
||||
issues: write
|
||||
steps:
|
||||
- uses: actions/stale@b5d41d4e1d5dceea10e7104786b73624c18a190f # v10.2.0
|
||||
- uses: actions/stale@eb5cf3af3ac0a1aa4c9c45633dd1ae542a27a899 # v10.3.0
|
||||
with:
|
||||
# PRs never get stale
|
||||
days-before-stale: 3
|
||||
|
||||
@@ -18,7 +18,7 @@ jobs:
|
||||
python-version: 3.12
|
||||
pyright-version: ~=1.1.367
|
||||
- name: Check Output
|
||||
uses: jannekem/run-python-script-action@bbfca66c612a28f3eeca0ae40e1f810265e2ea68 # v1.7
|
||||
uses: jannekem/run-python-script-action@9d8e2e0878d575fb6073277f38ce3f10ebf4f059 # v1.8
|
||||
env:
|
||||
TYPE_COMPLETENESS: ${{ steps.pyright-type-completeness.outputs.base-completeness-score }}
|
||||
with:
|
||||
|
||||
@@ -19,7 +19,7 @@ jobs:
|
||||
runs-on: ${{matrix.os}}
|
||||
strategy:
|
||||
matrix:
|
||||
python-version: ['3.10', '3.11', '3.12', '3.13', '3.14']
|
||||
python-version: ['3.10', '3.11', '3.12', '3.13', '3.14', '3.15.0-beta.2']
|
||||
os: [ubuntu-latest, windows-latest, macos-latest]
|
||||
include:
|
||||
- python-version: '3.14t'
|
||||
@@ -87,15 +87,16 @@ jobs:
|
||||
.test_report_optionals_junit.xml
|
||||
|
||||
- name: Submit coverage
|
||||
uses: codecov/codecov-action@671740ac38dd9b0130fbe1cec585b89eea48d3de # v5.5.2
|
||||
uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7.0.0
|
||||
with:
|
||||
env_vars: OS,PYTHON
|
||||
name: ${{ matrix.os }}-${{ matrix.python-version }}
|
||||
fail_ci_if_error: true
|
||||
token: ${{ secrets.CODECOV_TOKEN }}
|
||||
- name: Upload test results to Codecov
|
||||
uses: codecov/test-results-action@0fa95f0e1eeaafde2c782583b36b28ad0d8c77d3 # v1.2.1
|
||||
uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7.0.0
|
||||
if: ${{ !cancelled() }}
|
||||
with:
|
||||
files: .test_report_no_optionals_junit.xml,.test_report_optionals_junit.xml
|
||||
token: ${{ secrets.CODECOV_TOKEN }}
|
||||
report_type: test_results
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
repos:
|
||||
- repo: https://github.com/astral-sh/ruff-pre-commit
|
||||
rev: 'v0.15.6'
|
||||
rev: 'v0.15.15'
|
||||
hooks:
|
||||
# Run the linter:
|
||||
- id: ruff-check
|
||||
@@ -23,7 +23,7 @@ repos:
|
||||
- . # this basically does `pip install -e .`
|
||||
priority: 10
|
||||
- repo: https://github.com/pre-commit/mirrors-mypy
|
||||
rev: v1.19.1
|
||||
rev: v1.20.2
|
||||
hooks:
|
||||
- id: mypy
|
||||
name: mypy-ptb
|
||||
|
||||
@@ -75,10 +75,12 @@ The following wonderful people contributed directly or indirectly to this projec
|
||||
- `jossalgon <https://github.com/jossalgon>`_
|
||||
- `JRoot3D <https://github.com/JRoot3D>`_
|
||||
- `Juan Cuevas <https://github.com/cuevasrja>`
|
||||
- `karin0 <https://github.com/karin0>`_
|
||||
- `kenjitagawa <https://github.com/kenjitagawa>`_
|
||||
- `kennethcheo <https://github.com/kennethcheo>`_
|
||||
- `Kirill Vasin <https://github.com/vasinkd>`_
|
||||
- `Kjwon15 <https://github.com/kjwon15>`_
|
||||
- `Krishna Chaitanya Balusu <https://github.com/Krishnachaitanyakc>`_
|
||||
- `Li-aung Yip <https://github.com/LiaungYip>`_
|
||||
- `locobott <https://github.com/locobott>`_
|
||||
- `Loo Zheng Yuan <https://github.com/loozhengyuan>`_
|
||||
|
||||
+2
-2
@@ -11,7 +11,7 @@
|
||||
:target: https://pypi.org/project/python-telegram-bot/
|
||||
:alt: Supported Python versions
|
||||
|
||||
.. image:: https://img.shields.io/badge/Bot%20API-9.5-blue?logo=telegram
|
||||
.. image:: https://img.shields.io/badge/Bot%20API-10.0-blue?logo=telegram
|
||||
:target: https://core.telegram.org/bots/api-changelog
|
||||
:alt: Supported Bot API version
|
||||
|
||||
@@ -77,7 +77,7 @@ After installing_ the library, be sure to check out the section on `working with
|
||||
Telegram API support
|
||||
~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
All types and methods of the Telegram Bot API **9.5** are natively supported by this library.
|
||||
All types and methods of the Telegram Bot API **10.0** are natively supported by this library.
|
||||
In addition, Bot API functionality not yet natively included can still be used as described `in our wiki <https://github.com/python-telegram-bot/python-telegram-bot/wiki/Bot-API-Forward-Compatibility>`_.
|
||||
|
||||
Notable Features
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
bugfixes = "Fixed incorrect isinstance check in class telegram.ext.filters._MergedFilter for or_filter."
|
||||
[[pull_requests]]
|
||||
uid = "5125"
|
||||
author_uids = ["gistrec"]
|
||||
closes_threads = []
|
||||
@@ -0,0 +1,5 @@
|
||||
internal = "Update Ruff to v0.15.7"
|
||||
[[pull_requests]]
|
||||
uid = "5177"
|
||||
author_uids = ["renovate[bot]"]
|
||||
closes_threads = []
|
||||
@@ -0,0 +1,5 @@
|
||||
internal = "Migrate from deprecated test-results-action to codecov-action"
|
||||
[[pull_requests]]
|
||||
uid = "5183"
|
||||
author_uids = ["Krishnachaitanyakc"]
|
||||
closes_threads = ["5158"]
|
||||
@@ -0,0 +1,5 @@
|
||||
internal = "Update Ruff to v0.15.8"
|
||||
[[pull_requests]]
|
||||
uid = "5184"
|
||||
author_uids = ["renovate[bot]"]
|
||||
closes_threads = []
|
||||
@@ -0,0 +1,5 @@
|
||||
dependencies = "Update dependency cryptography to v46.0.6 [SECURITY]"
|
||||
[[pull_requests]]
|
||||
uid = "5185"
|
||||
author_uids = ["renovate[bot]"]
|
||||
closes_threads = []
|
||||
@@ -0,0 +1,5 @@
|
||||
other = "Update codecov/codecov-action action to v5.5.4"
|
||||
[[pull_requests]]
|
||||
uid = "5190"
|
||||
author_uids = ["renovate[bot]"]
|
||||
closes_threads = []
|
||||
@@ -0,0 +1,5 @@
|
||||
internal = "Update astral-sh/setup-uv action to v7.6.0"
|
||||
[[pull_requests]]
|
||||
uid = "5191"
|
||||
author_uids = ["renovate[bot]"]
|
||||
closes_threads = []
|
||||
@@ -0,0 +1,5 @@
|
||||
internal = "Update dependency astral-sh/uv to v0.11.2"
|
||||
[[pull_requests]]
|
||||
uid = "5192"
|
||||
author_uids = ["renovate[bot]"]
|
||||
closes_threads = []
|
||||
@@ -0,0 +1,5 @@
|
||||
internal = "Update dependency mypy to v1.20.0"
|
||||
[[pull_requests]]
|
||||
uid = "5193"
|
||||
author_uids = ["renovate[bot]"]
|
||||
closes_threads = []
|
||||
@@ -0,0 +1,5 @@
|
||||
internal = "Update github/codeql-action action to v4.35.1"
|
||||
[[pull_requests]]
|
||||
uid = "5194"
|
||||
author_uids = ["renovate[bot]"]
|
||||
closes_threads = []
|
||||
@@ -0,0 +1,24 @@
|
||||
features = """
|
||||
Full Support for Bot API 9.6
|
||||
|
||||
.. warning::
|
||||
|
||||
- Bot API 9.6 replaces the field ``correct_option_id`` of ``Poll`` with the new field ``correct_option_ids``. The field ``correct_option_id`` is still present in PTB for backward compatibility, but it will be removed in future releases.
|
||||
|
||||
- Bot API 9.6 replaces the argument ``correct_option_id`` of ``Bot.send_poll`` with the new argument ``correct_option_ids``. The argument ``correct_option_id`` is still present in PTB for backward compatibility, but it will be removed in future releases.
|
||||
|
||||
- Bot API 9.6 introduces a now required argument ``persistent_id`` to ``PollOption``. For backward compatibility, the argument is currently still marked as optional in the signature and its presence is enforced through a runtime check. In future versions, this argument will be made required in the signature as well.
|
||||
|
||||
- Bot API 9.6 introduces a now required argument ``option_persistent_ids`` to ``PollAnswer``. For backward compatibility, the argument is currently still marked as optional in the signature and its presence is enforced through a runtime check. In future versions, this argument will be made required in the signature as well.
|
||||
|
||||
- Bot API 9.6 introduces a now required argument ``allows_revoting`` to ``Poll``. For backward compatibility, the argument is currently still marked as optional in the signature and its presence is enforced through a runtime check. In future versions, this argument will be made required in the signature as well.
|
||||
|
||||
|
||||
Please make sure to update your code accordingly to avoid potential issues in the future. We recommend using keyword arguments to ensure compatibility with future updates.
|
||||
"""
|
||||
|
||||
pull_requests = [
|
||||
{ uid = "5196", author_uid = "harshil21" },
|
||||
{ uid = "5202", author_uid = "ouyooung" },
|
||||
{ uid = "5197", author_uid = "harshil21" },
|
||||
]
|
||||
@@ -0,0 +1,5 @@
|
||||
internal = "Update Ruff to v0.15.9"
|
||||
[[pull_requests]]
|
||||
uid = "5198"
|
||||
author_uids = ["renovate[bot]"]
|
||||
closes_threads = []
|
||||
@@ -0,0 +1,5 @@
|
||||
internal = "Update Mypy to v1.20.1"
|
||||
[[pull_requests]]
|
||||
uid = "5199"
|
||||
author_uids = ["renovate[bot]"]
|
||||
closes_threads = []
|
||||
@@ -0,0 +1,5 @@
|
||||
dependencies = "Update dependency cryptography to v46.0.7 [SECURITY]"
|
||||
[[pull_requests]]
|
||||
uid = "5203"
|
||||
author_uids = ["renovate[bot]"]
|
||||
closes_threads = []
|
||||
@@ -0,0 +1,5 @@
|
||||
internal = "Update Ruff to v0.15.10"
|
||||
[[pull_requests]]
|
||||
uid = "5205"
|
||||
author_uids = ["renovate[bot]"]
|
||||
closes_threads = []
|
||||
@@ -0,0 +1,5 @@
|
||||
internal = "Update dependency pytest to v9.0.3 [SECURITY]"
|
||||
[[pull_requests]]
|
||||
uid = "5206"
|
||||
author_uids = ["renovate[bot]"]
|
||||
closes_threads = []
|
||||
@@ -0,0 +1,5 @@
|
||||
internal = "Update Ruff to v0.15.11"
|
||||
[[pull_requests]]
|
||||
uid = "5209"
|
||||
author_uids = ["renovate[bot]"]
|
||||
closes_threads = []
|
||||
@@ -0,0 +1,5 @@
|
||||
internal = "Update Ruff to v0.15.12"
|
||||
[[pull_requests]]
|
||||
uid = "5217"
|
||||
author_uids = ["renovate[bot]"]
|
||||
closes_threads = []
|
||||
@@ -0,0 +1,5 @@
|
||||
internal = "Update actions/upload-artifact action to v7.0.1"
|
||||
[[pull_requests]]
|
||||
uid = "5220"
|
||||
author_uids = ["renovate[bot]"]
|
||||
closes_threads = []
|
||||
@@ -0,0 +1,5 @@
|
||||
internal = "Update dependency astral-sh/uv to v0.11.8"
|
||||
[[pull_requests]]
|
||||
uid = "5221"
|
||||
author_uids = ["renovate[bot]"]
|
||||
closes_threads = []
|
||||
@@ -0,0 +1,5 @@
|
||||
internal = "Update github/codeql-action action to v4.35.2"
|
||||
[[pull_requests]]
|
||||
uid = "5222"
|
||||
author_uids = ["renovate[bot]"]
|
||||
closes_threads = []
|
||||
@@ -0,0 +1,5 @@
|
||||
internal = "Update Mypy to v1.20.2"
|
||||
[[pull_requests]]
|
||||
uid = "5223"
|
||||
author_uids = ["renovate[bot]"]
|
||||
closes_threads = []
|
||||
@@ -0,0 +1,5 @@
|
||||
internal = "Update jannekem/run-python-script-action action to v1.8"
|
||||
[[pull_requests]]
|
||||
uid = "5224"
|
||||
author_uids = ["renovate[bot]"]
|
||||
closes_threads = []
|
||||
@@ -0,0 +1,33 @@
|
||||
features = """
|
||||
Full Support for Bot API 10.0
|
||||
|
||||
.. warning::
|
||||
|
||||
- Bot API 10.0 introduces a now required argument ``members_only`` to ``Poll``. For backward compatibility, the argument is currently still marked as optional in the signature and its presence is enforced through a runtime check. In future versions, this argument will be made required in the signature as well.
|
||||
|
||||
Please make sure to update your code accordingly to avoid potential issues in the future. We recommend using keyword arguments to ensure compatibility with future updates.
|
||||
"""
|
||||
|
||||
deprecations = """
|
||||
* Deprecated passing the ``filename`` parameter positionally to the classes:
|
||||
|
||||
* ``InputMediaAnimation``
|
||||
* ``InputMediaAudio``
|
||||
* ``InputMediaPhoto``
|
||||
* ``InputMediaDocument``
|
||||
* ``InputMediaVideo``
|
||||
|
||||
Please pass ``filename`` as a keyword argument instead, as this parameter will become keyword-only in the future.
|
||||
|
||||
* Deprecated ``InputPollOption.de_json``. The class ``InputPollOption`` is input only and its ``de_json`` method will be removed in future versions. The Bot API 10.0 ``media`` field of ``InputPollOption`` will not be included for deserialization.
|
||||
|
||||
"""
|
||||
|
||||
pull_requests = [
|
||||
{ uid = "5229", author_uid = "aelkheir", closes_threads = ["5228"] },
|
||||
{ uid = "5230", author_uid = "harshil21" },
|
||||
{ uid = "5235", author_uid = "harshil21" },
|
||||
{ uid = "5238", author_uid = "harshil21" },
|
||||
{ uid = "5232", author_uid = "aelkheir" },
|
||||
{ uid = "5232", author_uid = ["Poolitzer", "Phil9l", "harshil21", "aelkheir"] },
|
||||
]
|
||||
@@ -0,0 +1,5 @@
|
||||
internal = "Update Ruff to v0.15.13"
|
||||
[[pull_requests]]
|
||||
uid = "5233"
|
||||
author_uids = ["renovate[bot]"]
|
||||
closes_threads = []
|
||||
@@ -0,0 +1,5 @@
|
||||
bugfixes = "`Update.effective_user` now checks for `channel_post` and `edited_channel_post`"
|
||||
[[pull_requests]]
|
||||
uid = "5237"
|
||||
author_uids = ["karin0"]
|
||||
closes_threads = ["5236"]
|
||||
@@ -0,0 +1,6 @@
|
||||
documentation = "Documentation Improvements"
|
||||
|
||||
pull_requests = [
|
||||
{ uid = "5240", author_uids = ["harshil21", "Poolitzer"] },
|
||||
{ uid = "5241", author_uids = ["harshil21"] },
|
||||
]
|
||||
@@ -0,0 +1,5 @@
|
||||
internal = "Update Ruff to v0.15.14"
|
||||
[[pull_requests]]
|
||||
uid = "5245"
|
||||
author_uids = ["renovate[bot]"]
|
||||
closes_threads = []
|
||||
@@ -0,0 +1,5 @@
|
||||
security = "Disallow packages newer than last 7 days"
|
||||
[[pull_requests]]
|
||||
uid = "5247"
|
||||
author_uids = ["harshil21"]
|
||||
closes_threads = ["5195"]
|
||||
@@ -0,0 +1,5 @@
|
||||
other = "Make instantiation of ``TelegramObject``'s 15% faster"
|
||||
[[pull_requests]]
|
||||
uid = "5250"
|
||||
author_uids = ["harshil21"]
|
||||
closes_threads = []
|
||||
@@ -0,0 +1,5 @@
|
||||
internal = "Update Ruff to v0.15.15"
|
||||
[[pull_requests]]
|
||||
uid = "5252"
|
||||
author_uids = ["renovate[bot]"]
|
||||
closes_threads = []
|
||||
@@ -0,0 +1,5 @@
|
||||
internal = "Update dependency astral-sh/uv to v0.11.16"
|
||||
[[pull_requests]]
|
||||
uid = "5253"
|
||||
author_uids = ["renovate[bot]"]
|
||||
closes_threads = []
|
||||
@@ -0,0 +1,5 @@
|
||||
internal = "Update dependency sphinxcontrib-mermaid to v2.0.2"
|
||||
[[pull_requests]]
|
||||
uid = "5254"
|
||||
author_uids = ["renovate[bot]"]
|
||||
closes_threads = []
|
||||
@@ -0,0 +1,5 @@
|
||||
internal = "Update actions/stale action to v10.3.0"
|
||||
[[pull_requests]]
|
||||
uid = "5255"
|
||||
author_uids = ["renovate[bot]"]
|
||||
closes_threads = []
|
||||
@@ -0,0 +1,5 @@
|
||||
internal = "Update github/codeql-action action to v4.36.0"
|
||||
[[pull_requests]]
|
||||
uid = "5256"
|
||||
author_uids = ["renovate[bot]"]
|
||||
closes_threads = []
|
||||
@@ -0,0 +1,5 @@
|
||||
internal = "Update pypa/gh-action-pypi-publish action to v1.14.0"
|
||||
[[pull_requests]]
|
||||
uid = "5257"
|
||||
author_uids = ["renovate[bot]"]
|
||||
closes_threads = []
|
||||
@@ -0,0 +1,9 @@
|
||||
other = """Support Python 3.15 Beta
|
||||
|
||||
* Python 3.15 free threading is not fully supported yet, as the optional dependency ``cryptography`` is not yet compatible with it.
|
||||
|
||||
"""
|
||||
[[pull_requests]]
|
||||
uid = "5259"
|
||||
author_uids = ["harshil21"]
|
||||
closes_threads = ["5231"]
|
||||
@@ -0,0 +1,5 @@
|
||||
other = "Bump Version to 22.8"
|
||||
[[pull_requests]]
|
||||
uid = "5262"
|
||||
author_uids = ["Poolitzer"]
|
||||
closes_threads = []
|
||||
@@ -0,0 +1,5 @@
|
||||
documentation = "Autogenerate Attribute docstrings"
|
||||
[[pull_requests]]
|
||||
uid = "5246"
|
||||
author_uids = ["harshil21"]
|
||||
closes_threads = []
|
||||
@@ -0,0 +1,5 @@
|
||||
documentation = "Documentation Improvements"
|
||||
[[pull_requests]]
|
||||
uid = "5267"
|
||||
author_uids = ["harshil21"]
|
||||
closes_threads = []
|
||||
@@ -0,0 +1,260 @@
|
||||
# A library that provides a Python interface to the Telegram Bot API
|
||||
# Copyright (C) 2015-2026
|
||||
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Lesser Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Lesser Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser Public License
|
||||
# along with this program. If not, see [http://www.gnu.org/licenses/].
|
||||
"""Automatic generation of ``Attributes:`` section entries from ``Args:`` in class docstrings."""
|
||||
|
||||
import inspect
|
||||
import re
|
||||
import warnings
|
||||
from dataclasses import dataclass
|
||||
|
||||
from telegram import TelegramObject
|
||||
|
||||
ENTRY_PATTERN: re.Pattern[str] = re.compile(r"^ (\w+) \((.+)\):\s*(.*)")
|
||||
"""Matches a single entry like `` name (type): description`` in a docstring."""
|
||||
|
||||
|
||||
KNOWN_SECTION_TITLES: frozenset[str] = frozenset(
|
||||
{
|
||||
"Args",
|
||||
"Attributes",
|
||||
"Returns",
|
||||
"Raises",
|
||||
"Note",
|
||||
"Notes",
|
||||
"Example",
|
||||
"Examples",
|
||||
"Keyword Args",
|
||||
"Keyword Arguments",
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
def _is_section_header(line: str) -> bool:
|
||||
return line.endswith(":") and line[:-1] in KNOWN_SECTION_TITLES
|
||||
|
||||
|
||||
def _is_col0_noncontent(line: str) -> bool:
|
||||
"""Non-blank col-0 line that is not a section header (e.g. RST substitution definitions)."""
|
||||
return bool(line) and not line[0].isspace() and not _is_section_header(line)
|
||||
|
||||
|
||||
def _save_entry(
|
||||
entries: dict[str, "DocstringEntry"],
|
||||
name: str,
|
||||
raw_type: str,
|
||||
raw_lines: list[str],
|
||||
) -> None:
|
||||
lines = list(raw_lines)
|
||||
while lines and lines[-1] == "":
|
||||
lines.pop()
|
||||
|
||||
is_optional = raw_type.endswith(", optional")
|
||||
type_str = raw_type.removesuffix(", optional") if is_optional else raw_type
|
||||
|
||||
entries[name] = DocstringEntry(
|
||||
name=name,
|
||||
type_str=type_str,
|
||||
is_optional=is_optional,
|
||||
all_lines=tuple(lines),
|
||||
)
|
||||
|
||||
|
||||
@dataclass(frozen=True, slots=True)
|
||||
class DocstringEntry:
|
||||
name: str
|
||||
type_str: str
|
||||
is_optional: bool
|
||||
all_lines: tuple[str, ...]
|
||||
|
||||
def to_attribute_lines(self) -> list[str]:
|
||||
if not self.all_lines:
|
||||
warnings.warn(
|
||||
f"DocstringEntry {self.name!r} has no lines; skipping attribute generation.",
|
||||
stacklevel=2,
|
||||
)
|
||||
return []
|
||||
|
||||
m = ENTRY_PATTERN.match(self.all_lines[0])
|
||||
if m is None:
|
||||
warnings.warn(
|
||||
f"DocstringEntry {self.name!r}: first line does not match the entry pattern "
|
||||
f"({self.all_lines[0]!r}); returning raw lines unchanged.",
|
||||
stacklevel=2,
|
||||
)
|
||||
return list(self.all_lines)
|
||||
|
||||
desc: str = m.group(3)
|
||||
new_type = self.type_str.replace("Sequence[", "tuple[")
|
||||
new_desc = f"Optional. {desc}" if self.is_optional else desc
|
||||
return [f" {self.name} ({new_type}): {new_desc}", *self.all_lines[1:]]
|
||||
|
||||
|
||||
@dataclass(slots=True)
|
||||
class DocstringSection:
|
||||
title: str
|
||||
entries: dict[str, DocstringEntry]
|
||||
start_idx: int
|
||||
end_idx: int
|
||||
|
||||
|
||||
class DocstringParser:
|
||||
"""Parse a Google-style docstring (list of lines) into sections and entries."""
|
||||
|
||||
__slots__ = ("_lines", "_sections")
|
||||
|
||||
def __init__(self, lines: list[str]) -> None:
|
||||
self._lines = lines
|
||||
self._sections: dict[str, DocstringSection] | None = None
|
||||
|
||||
@property
|
||||
def sections(self) -> dict[str, DocstringSection]:
|
||||
if self._sections is None:
|
||||
self._sections = self._parse()
|
||||
return self._sections
|
||||
|
||||
def get_section(self, title: str) -> DocstringSection | None:
|
||||
return self.sections.get(title)
|
||||
|
||||
def _parse(self) -> dict[str, DocstringSection]:
|
||||
sections: dict[str, DocstringSection] = {}
|
||||
lines = self._lines
|
||||
n = len(lines)
|
||||
i = 0
|
||||
|
||||
while i < n:
|
||||
line = lines[i]
|
||||
if _is_section_header(line):
|
||||
title = line[:-1]
|
||||
start_idx = i
|
||||
i += 1
|
||||
entries, end_idx = self._parse_section_entries(i, n)
|
||||
i = end_idx
|
||||
sections[title] = DocstringSection(
|
||||
title=title,
|
||||
entries=entries,
|
||||
start_idx=start_idx,
|
||||
end_idx=end_idx,
|
||||
)
|
||||
else:
|
||||
i += 1
|
||||
|
||||
return sections
|
||||
|
||||
def _parse_section_entries(
|
||||
self,
|
||||
start: int,
|
||||
end: int,
|
||||
) -> tuple[dict[str, DocstringEntry], int]:
|
||||
entries: dict[str, DocstringEntry] = {}
|
||||
current_name: str | None = None
|
||||
current_raw_type: str = ""
|
||||
current_lines: list[str] = []
|
||||
|
||||
lines = self._lines
|
||||
i = start
|
||||
|
||||
while i < end:
|
||||
line = lines[i]
|
||||
|
||||
# RST substitution definitions and other on-section content end the section.
|
||||
if _is_section_header(line) or _is_col0_noncontent(line):
|
||||
break
|
||||
|
||||
m = ENTRY_PATTERN.match(line)
|
||||
if m:
|
||||
if current_name is not None:
|
||||
_save_entry(entries, current_name, current_raw_type, current_lines)
|
||||
current_name = m.group(1)
|
||||
current_raw_type = m.group(2)
|
||||
current_lines = [line]
|
||||
elif current_name is not None:
|
||||
current_lines.append(line)
|
||||
|
||||
i += 1
|
||||
|
||||
if current_name is not None:
|
||||
_save_entry(entries, current_name, current_raw_type, current_lines)
|
||||
|
||||
return entries, i
|
||||
|
||||
|
||||
class AttributeInserter:
|
||||
"""Inserts auto-generated ``Attributes:`` entries into class docstrings."""
|
||||
|
||||
def insert_attributes(self, obj: type, lines: list[str]) -> None:
|
||||
"""Insert missing attribute entries derived from the ``Args:`` section in-place."""
|
||||
parser = DocstringParser(lines)
|
||||
|
||||
args_section = parser.get_section("Args")
|
||||
attrs_section = parser.get_section("Attributes")
|
||||
|
||||
already_documented: set[str] = (
|
||||
set(attrs_section.entries.keys()) if attrs_section is not None else set()
|
||||
)
|
||||
args_entries: dict[str, DocstringEntry] = (
|
||||
args_section.entries if args_section is not None else {}
|
||||
)
|
||||
args_names: set[str] = set(args_entries.keys())
|
||||
|
||||
properties_on_class: set[str] = {
|
||||
name for name, _ in inspect.getmembers(obj, lambda o: isinstance(o, property))
|
||||
}
|
||||
|
||||
# Raise when own public slots have no documentation source.
|
||||
# Get slots from TGObject if it's a TGObj subclass:
|
||||
if issubclass(obj, TelegramObject):
|
||||
all_slots = {
|
||||
s
|
||||
for c in obj.__mro__[:-1]
|
||||
if issubclass(c, TelegramObject)
|
||||
for s in c.__slots__
|
||||
if not s.startswith("_")
|
||||
}
|
||||
all_slots.remove("api_kwargs")
|
||||
else:
|
||||
all_slots = (s for s in getattr(obj, "__slots__", ()) if not s.startswith("_"))
|
||||
for slot in all_slots:
|
||||
if (
|
||||
slot not in already_documented
|
||||
and slot not in args_names
|
||||
and slot not in properties_on_class
|
||||
):
|
||||
raise RuntimeError(
|
||||
f"Class {obj.__qualname__!r}: public slot {slot!r} has no documentation "
|
||||
f"source. Please add it to the 'Attributes:' section manually.",
|
||||
)
|
||||
|
||||
new_attr_lines: list[str] = []
|
||||
for name, entry in args_entries.items():
|
||||
if name in already_documented or name in properties_on_class:
|
||||
continue
|
||||
new_attr_lines.extend(entry.to_attribute_lines())
|
||||
new_attr_lines.append("")
|
||||
|
||||
if not new_attr_lines:
|
||||
return
|
||||
|
||||
if attrs_section is not None:
|
||||
insert_idx = attrs_section.end_idx
|
||||
while insert_idx > attrs_section.start_idx + 1 and lines[insert_idx - 1] == "":
|
||||
insert_idx -= 1
|
||||
lines[insert_idx:insert_idx] = new_attr_lines
|
||||
else:
|
||||
if lines and lines[-1].strip():
|
||||
lines.append("")
|
||||
lines.append("Attributes:")
|
||||
lines.extend(new_attr_lines)
|
||||
@@ -83,16 +83,22 @@ get_updates_read_timeout_addition = [
|
||||
" ``2``.",
|
||||
]
|
||||
|
||||
|
||||
def find_insert_pos_for_kwargs(lines: list[str]) -> int:
|
||||
"""Finds the correct position to insert the keyword arguments and returns the index."""
|
||||
for idx, value in reversed(list(enumerate(lines))): # reversed since :returns: is at the end
|
||||
if value.startswith("Returns"):
|
||||
return idx
|
||||
return False
|
||||
RAISES_BLOCK = [
|
||||
"Raises:",
|
||||
"",
|
||||
" :class:`telegram.error.TelegramError`",
|
||||
"",
|
||||
]
|
||||
|
||||
|
||||
def check_timeout_and_api_kwargs_presence(obj: object) -> int:
|
||||
def find_insert_pos_for_raises(lines: list[str]) -> int:
|
||||
"""Finds the correct position to insert the Raises block and returns the index."""
|
||||
if "Raises:" in lines:
|
||||
return -1 # Don't insert if there's already a Raises block
|
||||
return len(lines) # Insert at the end if there's no Raises block
|
||||
|
||||
|
||||
def check_timeout_and_api_kwargs_presence(obj: object) -> bool:
|
||||
"""Checks if the method has timeout and api_kwargs keyword only parameters."""
|
||||
sig = inspect.signature(obj)
|
||||
params_to_check = (
|
||||
+32
-11
@@ -27,9 +27,10 @@ from sphinx.application import Sphinx
|
||||
import telegram
|
||||
import telegram.ext
|
||||
from docs.auxil.admonition_inserter import AdmonitionInserter
|
||||
from docs.auxil.kwargs_insertion import (
|
||||
from docs.auxil.attribute_inserter import AttributeInserter, DocstringParser
|
||||
from docs.auxil.bot_insertion import (
|
||||
RAISES_BLOCK,
|
||||
check_timeout_and_api_kwargs_presence,
|
||||
find_insert_pos_for_kwargs,
|
||||
get_updates_read_timeout_addition,
|
||||
keyword_args,
|
||||
media_write_timeout_change,
|
||||
@@ -42,6 +43,7 @@ if TYPE_CHECKING:
|
||||
|
||||
|
||||
ADMONITION_INSERTER = AdmonitionInserter()
|
||||
ATTRIBUTE_INSERTER = AttributeInserter()
|
||||
|
||||
# Some base classes are implementation detail
|
||||
# We want to instead show *their* base class
|
||||
@@ -52,6 +54,7 @@ PRIVATE_BASE_CLASSES = {
|
||||
"_BaseMedium": "TelegramObject",
|
||||
"_CredentialsBase": "TelegramObject",
|
||||
"_ChatBase": "TelegramObject",
|
||||
"_BaseInputMedia": "TelegramObject",
|
||||
}
|
||||
|
||||
|
||||
@@ -84,14 +87,15 @@ def autodoc_process_docstring(
|
||||
app: Sphinx, what, name: str, obj: object, options, lines: list[str]
|
||||
):
|
||||
"""We do the following things:
|
||||
1) Use this method to automatically insert the Keyword Args and "Shortcuts" admonitions
|
||||
for the Bot methods.
|
||||
1) Use this method to automatically insert the Keyword Args, "Shortcuts" admonitions,
|
||||
and the Raises block, wherever applicable, for the Bot methods.
|
||||
|
||||
2) Use this method to automatically insert "Returned in" admonition into classes
|
||||
that are returned from the Bot methods
|
||||
|
||||
3) Use this method to automatically insert "Available in" admonition into classes
|
||||
whose instances are available as attributes of other classes
|
||||
3) Use this method to automatically insert the Attributes block, wherever applicable,
|
||||
for Telegram objects. The "Available in" admonition is then also inserted. These are
|
||||
instances of a class which are available as attributes of other classes.
|
||||
|
||||
4) Use this method to automatically insert "Use in" admonition into classes
|
||||
whose instances can be used as arguments of the Bot methods
|
||||
@@ -100,19 +104,23 @@ def autodoc_process_docstring(
|
||||
to the actual object here.
|
||||
"""
|
||||
|
||||
# 1) Insert the Keyword Args and "Shortcuts" admonitions for the Bot methods
|
||||
method_name = name.rsplit(".", maxsplit=1)[0]
|
||||
# 1) Insert the Keyword Args, "Shortcuts" admonitions, and "Raises" block for the Bot methods
|
||||
method_name = name.rsplit(".", maxsplit=1)[-1]
|
||||
if (
|
||||
name.startswith("telegram.Bot.")
|
||||
and what == "method"
|
||||
and method_name.islower()
|
||||
and check_timeout_and_api_kwargs_presence(obj)
|
||||
):
|
||||
insert_index = find_insert_pos_for_kwargs(lines)
|
||||
if not insert_index:
|
||||
parser = DocstringParser(lines)
|
||||
# Logic for inserting keyword args into docstrings:
|
||||
# -------------------------------------------------
|
||||
returns_section = parser.get_section("Returns")
|
||||
if not returns_section:
|
||||
raise ValueError(
|
||||
f"Couldn't find the correct position to insert the keyword args for {obj}."
|
||||
)
|
||||
insert_index = returns_section.start_idx
|
||||
|
||||
get_updates: bool = method_name == "get_updates"
|
||||
# The below can be done in 1 line with itertools.chain, but this must be modified in-place
|
||||
@@ -133,6 +141,14 @@ def autodoc_process_docstring(
|
||||
lines[insert_idx:insert_idx] = effective_insert
|
||||
insert_idx += len(effective_insert)
|
||||
|
||||
# Logic for inserting Raises:
|
||||
# -------------------------------------------------
|
||||
# We will only insert the Raises block if there isn't already one.
|
||||
if parser.get_section("Raises") is None:
|
||||
lines.extend(RAISES_BLOCK)
|
||||
|
||||
# Logic for inserting "Shortcuts" admonition:
|
||||
# -------------------------------------------
|
||||
ADMONITION_INSERTER.insert_admonitions(
|
||||
obj=typing.cast("collections.abc.Callable", obj),
|
||||
docstring_lines=lines,
|
||||
@@ -140,7 +156,12 @@ def autodoc_process_docstring(
|
||||
|
||||
# 2-4) Insert "Returned in", "Available in", "Use in" admonitions into classes
|
||||
# (where applicable)
|
||||
if what == "class":
|
||||
if what in ("class", "exception"):
|
||||
# Auto-generate Attributes section entries from Args before admonitions are inserted
|
||||
ATTRIBUTE_INSERTER.insert_attributes(
|
||||
obj=typing.cast("type", obj),
|
||||
lines=lines,
|
||||
)
|
||||
ADMONITION_INSERTER.insert_admonitions(
|
||||
obj=typing.cast("type", obj), # since "what" == class, we know it's not just object
|
||||
docstring_lines=lines,
|
||||
|
||||
@@ -41,6 +41,8 @@
|
||||
- Used for sending paid media to channels
|
||||
* - :meth:`~telegram.Bot.send_photo`
|
||||
- Used for sending photos
|
||||
* - :meth:`~telegram.Bot.send_live_photo`
|
||||
- Used for sending live photos
|
||||
* - :meth:`~telegram.Bot.send_poll`
|
||||
- Used for sending polls
|
||||
* - :meth:`~telegram.Bot.send_sticker`
|
||||
@@ -80,6 +82,8 @@
|
||||
- Used for answering the callback query
|
||||
* - :meth:`~telegram.Bot.answer_inline_query`
|
||||
- Used for answering the inline query
|
||||
* - :meth:`~telegram.Bot.answer_guest_query`
|
||||
- Used for replying to a received guest message
|
||||
* - :meth:`~telegram.Bot.answer_pre_checkout_query`
|
||||
- Used for answering a pre checkout query
|
||||
* - :meth:`~telegram.Bot.answer_shipping_query`
|
||||
@@ -104,6 +108,10 @@
|
||||
- Used for stopping the running poll
|
||||
* - :meth:`~telegram.Bot.set_message_reaction`
|
||||
- Used for setting reactions on messages
|
||||
* - :meth:`~telegram.Bot.delete_message_reaction`
|
||||
- Used for deleting reactions on messages
|
||||
* - :meth:`~telegram.Bot.delete_all_message_reactions`
|
||||
- Used for deleting all reactions by a chat or user
|
||||
|
||||
.. raw:: html
|
||||
|
||||
@@ -167,6 +175,8 @@
|
||||
- Used for unpinning a message
|
||||
* - :meth:`~telegram.Bot.unpin_all_chat_messages`
|
||||
- Used for unpinning all pinned chat messages
|
||||
* - :meth:`~telegram.Bot.get_user_personal_chat_messages`
|
||||
- Used for obtaining the personal chat messages of a user
|
||||
* - :meth:`~telegram.Bot.get_user_profile_audios`
|
||||
- Used for obtaining user's profile audios
|
||||
* - :meth:`~telegram.Bot.get_user_profile_photos`
|
||||
@@ -237,6 +247,10 @@
|
||||
- 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.set_managed_bot_access_settings`
|
||||
- Used for changing the access settings of a managed bot
|
||||
* - :meth:`~telegram.Bot.get_managed_bot_access_settings`
|
||||
- Used for obtaining the access settings of a managed bot
|
||||
* - :meth:`~telegram.Bot.set_my_description`
|
||||
- Used for setting the description of the bot
|
||||
* - :meth:`~telegram.Bot.get_my_description`
|
||||
@@ -496,12 +510,19 @@
|
||||
- Used for getting information about gifts available for sending
|
||||
* - :meth:`~telegram.Bot.get_chat_gifts`
|
||||
- Used for getting information about gifts owned and hosted by a chat
|
||||
* - :meth:`~telegram.Bot.get_managed_bot_token`
|
||||
- Used for getting the token of a managed bot
|
||||
* - :meth:`~telegram.Bot.replace_managed_bot_token`
|
||||
- Used for replacing the token of a managed bot
|
||||
* - :meth:`~telegram.Bot.get_me`
|
||||
- Used for getting basic information about the bot
|
||||
* - :meth:`~telegram.Bot.get_user_gifts`
|
||||
- Used for getting information about gifts owned and hosted by a user
|
||||
* - :meth:`~telegram.Bot.save_prepared_inline_message`
|
||||
- Used for storing a message to be sent by a user of a Mini App
|
||||
* - :meth:`~telegram.Bot.save_prepared_keyboard_button`
|
||||
- Used for saving a keyboard button to be used in a Mini App
|
||||
|
||||
|
||||
.. raw:: html
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ Available Types
|
||||
telegram.animation
|
||||
telegram.audio
|
||||
telegram.birthdate
|
||||
telegram.botaccesssettings
|
||||
telegram.botcommand
|
||||
telegram.botcommandscope
|
||||
telegram.botcommandscopeallchatadministrators
|
||||
@@ -101,26 +102,37 @@ Available Types
|
||||
telegram.inputmediaanimation
|
||||
telegram.inputmediaaudio
|
||||
telegram.inputmediadocument
|
||||
telegram.inputmedialivephoto
|
||||
telegram.inputmedialocation
|
||||
telegram.inputmediaphoto
|
||||
telegram.inputmediasticker
|
||||
telegram.inputmediavenue
|
||||
telegram.inputmediavideo
|
||||
telegram.inputpaidmedia
|
||||
telegram.inputpaidmedialivephoto
|
||||
telegram.inputpaidmediaphoto
|
||||
telegram.inputpaidmediavideo
|
||||
telegram.inputpollmedia
|
||||
telegram.inputprofilephoto
|
||||
telegram.inputprofilephotoanimated
|
||||
telegram.inputprofilephotostatic
|
||||
telegram.inputpolloption
|
||||
telegram.inputpolloptionmedia
|
||||
telegram.inputstorycontent
|
||||
telegram.inputstorycontentphoto
|
||||
telegram.inputstorycontentvideo
|
||||
telegram.keyboardbutton
|
||||
telegram.keyboardbuttonpolltype
|
||||
telegram.keyboardbuttonrequestchat
|
||||
telegram.keyboardbuttonrequestmanagedbot
|
||||
telegram.keyboardbuttonrequestusers
|
||||
telegram.linkpreviewoptions
|
||||
telegram.livephoto
|
||||
telegram.location
|
||||
telegram.locationaddress
|
||||
telegram.loginurl
|
||||
telegram.managedbotcreated
|
||||
telegram.managedbotupdated
|
||||
telegram.maybeinaccessiblemessage
|
||||
telegram.menubutton
|
||||
telegram.menubuttoncommands
|
||||
@@ -143,6 +155,7 @@ Available Types
|
||||
telegram.ownedgiftunique
|
||||
telegram.paidmedia
|
||||
telegram.paidmediainfo
|
||||
telegram.paidmedialivephoto
|
||||
telegram.paidmediaphoto
|
||||
telegram.paidmediapreview
|
||||
telegram.paidmediapurchased
|
||||
@@ -151,7 +164,11 @@ Available Types
|
||||
telegram.photosize
|
||||
telegram.poll
|
||||
telegram.pollanswer
|
||||
telegram.pollmedia
|
||||
telegram.polloption
|
||||
telegram.polloptionadded
|
||||
telegram.polloptiondeleted
|
||||
telegram.preparedkeyboardbutton
|
||||
telegram.proximityalerttriggered
|
||||
telegram.reactioncount
|
||||
telegram.reactiontype
|
||||
@@ -161,6 +178,7 @@ Available Types
|
||||
telegram.replykeyboardmarkup
|
||||
telegram.replykeyboardremove
|
||||
telegram.replyparameters
|
||||
telegram.sentguestmessage
|
||||
telegram.sentwebappmessage
|
||||
telegram.shareduser
|
||||
telegram.story
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
BotAccessSettings
|
||||
=================
|
||||
|
||||
.. autoclass:: telegram.BotAccessSettings
|
||||
:members:
|
||||
:show-inheritance:
|
||||
@@ -16,6 +16,7 @@ Handlers
|
||||
telegram.ext.conversationhandler
|
||||
telegram.ext.filters
|
||||
telegram.ext.inlinequeryhandler
|
||||
telegram.ext.managedbotupdatedhandler
|
||||
telegram.ext.messagehandler
|
||||
telegram.ext.messagereactionhandler
|
||||
telegram.ext.paidmediapurchasedhandler
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
ManagedBotUpdatedHandler
|
||||
========================
|
||||
|
||||
.. autoclass:: telegram.ext.ManagedBotUpdatedHandler
|
||||
:members:
|
||||
:show-inheritance:
|
||||
@@ -0,0 +1,6 @@
|
||||
InputMediaLivePhoto
|
||||
===================
|
||||
|
||||
.. autoclass:: telegram.InputMediaLivePhoto
|
||||
:members:
|
||||
:show-inheritance:
|
||||
@@ -0,0 +1,6 @@
|
||||
InputMediaLocation
|
||||
==================
|
||||
|
||||
.. autoclass:: telegram.InputMediaLocation
|
||||
:members:
|
||||
:show-inheritance:
|
||||
@@ -0,0 +1,6 @@
|
||||
InputMediaSticker
|
||||
=================
|
||||
|
||||
.. autoclass:: telegram.InputMediaSticker
|
||||
:members:
|
||||
:show-inheritance:
|
||||
@@ -0,0 +1,6 @@
|
||||
InputMediaVenue
|
||||
===============
|
||||
|
||||
.. autoclass:: telegram.InputMediaVenue
|
||||
:members:
|
||||
:show-inheritance:
|
||||
@@ -0,0 +1,6 @@
|
||||
InputPaidMediaLivePhoto
|
||||
======================
|
||||
|
||||
.. autoclass:: telegram.InputPaidMediaLivePhoto
|
||||
:members:
|
||||
:show-inheritance:
|
||||
@@ -0,0 +1,6 @@
|
||||
InputPollMedia
|
||||
==============
|
||||
|
||||
.. versionadded:: NEXT.VERSION
|
||||
|
||||
.. autoclass:: telegram.InputPollMedia
|
||||
@@ -0,0 +1,6 @@
|
||||
InputPollOptionMedia
|
||||
====================
|
||||
|
||||
.. versionadded:: NEXT.VERSION
|
||||
|
||||
.. autoclass:: telegram.InputPollOptionMedia
|
||||
@@ -0,0 +1,6 @@
|
||||
KeyboardButtonRequestManagedBot
|
||||
===============================
|
||||
|
||||
.. autoclass:: telegram.KeyboardButtonRequestManagedBot
|
||||
:members:
|
||||
:show-inheritance:
|
||||
@@ -0,0 +1,6 @@
|
||||
LivePhoto
|
||||
=========
|
||||
|
||||
.. autoclass:: telegram.LivePhoto
|
||||
:members:
|
||||
:show-inheritance:
|
||||
@@ -0,0 +1,6 @@
|
||||
ManagedBotCreated
|
||||
=================
|
||||
|
||||
.. autoclass:: telegram.ManagedBotCreated
|
||||
:members:
|
||||
:show-inheritance:
|
||||
@@ -0,0 +1,6 @@
|
||||
ManagedBotUpdated
|
||||
=================
|
||||
|
||||
.. autoclass:: telegram.ManagedBotUpdated
|
||||
:members:
|
||||
:show-inheritance:
|
||||
@@ -0,0 +1,6 @@
|
||||
PaidMediaLivePhoto
|
||||
==================
|
||||
|
||||
.. autoclass:: telegram.PaidMediaLivePhoto
|
||||
:members:
|
||||
:show-inheritance:
|
||||
@@ -0,0 +1,6 @@
|
||||
PollMedia
|
||||
=========
|
||||
|
||||
.. autoclass:: telegram.PollMedia
|
||||
:members:
|
||||
:show-inheritance:
|
||||
@@ -0,0 +1,6 @@
|
||||
PollOptionAdded
|
||||
===============
|
||||
|
||||
.. autoclass:: telegram.PollOptionAdded
|
||||
:members:
|
||||
:show-inheritance:
|
||||
@@ -0,0 +1,6 @@
|
||||
PollOptionDeleted
|
||||
=================
|
||||
|
||||
.. autoclass:: telegram.PollOptionDeleted
|
||||
:members:
|
||||
:show-inheritance:
|
||||
@@ -0,0 +1,6 @@
|
||||
PreparedKeyboardButton
|
||||
======================
|
||||
|
||||
.. autoclass:: telegram.PreparedKeyboardButton
|
||||
:members:
|
||||
:show-inheritance:
|
||||
@@ -0,0 +1,6 @@
|
||||
SentGuestMessage
|
||||
================
|
||||
|
||||
.. autoclass:: telegram.SentGuestMessage
|
||||
:members:
|
||||
:show-inheritance:
|
||||
+9
-4
@@ -36,6 +36,7 @@ classifiers = [
|
||||
"Programming Language :: Python :: 3.12",
|
||||
"Programming Language :: Python :: 3.13",
|
||||
"Programming Language :: Python :: 3.14",
|
||||
"Programming Language :: Python :: 3.15",
|
||||
]
|
||||
dependencies = [
|
||||
"httpx >=0.27,<0.29",
|
||||
@@ -98,7 +99,7 @@ tests = [
|
||||
# required for building the wheels for releases
|
||||
"build",
|
||||
# For the test suite
|
||||
"pytest==9.0.2",
|
||||
"pytest==9.0.3",
|
||||
# needed because pytest doesn't come with native support for coroutines as tests
|
||||
"pytest-asyncio==0.21.2",
|
||||
# xdist runs tests in parallel
|
||||
@@ -120,7 +121,7 @@ docs = [
|
||||
"sphinx==9.1.0; python_version >= '3.12'",
|
||||
"furo==2025.12.19",
|
||||
"sphinx-paramlinks==0.6.0",
|
||||
"sphinxcontrib-mermaid==2.0.1",
|
||||
"sphinxcontrib-mermaid==2.0.2",
|
||||
"sphinx-copybutton==0.5.2",
|
||||
"sphinx-inline-tabs==2025.12.21.14",
|
||||
# Temporary. See #4387
|
||||
@@ -133,8 +134,8 @@ docs = [
|
||||
]
|
||||
linting = [
|
||||
"prek",
|
||||
"ruff==0.15.6",
|
||||
"mypy==1.19.1",
|
||||
"ruff==0.15.15",
|
||||
"mypy==1.20.2",
|
||||
"pylint==4.0.5"
|
||||
]
|
||||
all = [{ include-group = "tests" }, { include-group = "docs" }, { include-group = "linting"}]
|
||||
@@ -153,6 +154,10 @@ exclude = [".venv*", "venv*", ".github", "uv.lock"]
|
||||
[tool.hatch.build.targets.wheel]
|
||||
packages = ["src/telegram"]
|
||||
|
||||
# uv
|
||||
[tool.uv]
|
||||
exclude-newer = "7 days"
|
||||
|
||||
# CHANGO
|
||||
[tool.chango]
|
||||
sys_path = "changes"
|
||||
|
||||
+64
-20
@@ -35,6 +35,7 @@ __all__ = (
|
||||
"BackgroundTypeWallpaper",
|
||||
"Birthdate",
|
||||
"Bot",
|
||||
"BotAccessSettings",
|
||||
"BotCommand",
|
||||
"BotCommandScope",
|
||||
"BotCommandScopeAllChatAdministrators",
|
||||
@@ -157,13 +158,20 @@ __all__ = (
|
||||
"InputMediaAnimation",
|
||||
"InputMediaAudio",
|
||||
"InputMediaDocument",
|
||||
"InputMediaLivePhoto",
|
||||
"InputMediaLocation",
|
||||
"InputMediaPhoto",
|
||||
"InputMediaSticker",
|
||||
"InputMediaVenue",
|
||||
"InputMediaVideo",
|
||||
"InputMessageContent",
|
||||
"InputPaidMedia",
|
||||
"InputPaidMediaLivePhoto",
|
||||
"InputPaidMediaPhoto",
|
||||
"InputPaidMediaVideo",
|
||||
"InputPollMedia",
|
||||
"InputPollOption",
|
||||
"InputPollOptionMedia",
|
||||
"InputProfilePhoto",
|
||||
"InputProfilePhotoAnimated",
|
||||
"InputProfilePhotoStatic",
|
||||
@@ -177,12 +185,16 @@ __all__ = (
|
||||
"KeyboardButton",
|
||||
"KeyboardButtonPollType",
|
||||
"KeyboardButtonRequestChat",
|
||||
"KeyboardButtonRequestManagedBot",
|
||||
"KeyboardButtonRequestUsers",
|
||||
"LabeledPrice",
|
||||
"LinkPreviewOptions",
|
||||
"LivePhoto",
|
||||
"Location",
|
||||
"LocationAddress",
|
||||
"LoginUrl",
|
||||
"ManagedBotCreated",
|
||||
"ManagedBotUpdated",
|
||||
"MaskPosition",
|
||||
"MaybeInaccessibleMessage",
|
||||
"MenuButton",
|
||||
@@ -207,6 +219,7 @@ __all__ = (
|
||||
"OwnedGifts",
|
||||
"PaidMedia",
|
||||
"PaidMediaInfo",
|
||||
"PaidMediaLivePhoto",
|
||||
"PaidMediaPhoto",
|
||||
"PaidMediaPreview",
|
||||
"PaidMediaPurchased",
|
||||
@@ -228,9 +241,13 @@ __all__ = (
|
||||
"PhotoSize",
|
||||
"Poll",
|
||||
"PollAnswer",
|
||||
"PollMedia",
|
||||
"PollOption",
|
||||
"PollOptionAdded",
|
||||
"PollOptionDeleted",
|
||||
"PreCheckoutQuery",
|
||||
"PreparedInlineMessage",
|
||||
"PreparedKeyboardButton",
|
||||
"ProximityAlertTriggered",
|
||||
"ReactionCount",
|
||||
"ReactionType",
|
||||
@@ -248,6 +265,7 @@ __all__ = (
|
||||
"RevenueWithdrawalStateSucceeded",
|
||||
"SecureData",
|
||||
"SecureValue",
|
||||
"SentGuestMessage",
|
||||
"SentWebAppMessage",
|
||||
"SharedUser",
|
||||
"ShippingAddress",
|
||||
@@ -325,23 +343,12 @@ __all__ = (
|
||||
"warnings",
|
||||
)
|
||||
|
||||
from telegram._inputchecklist import InputChecklist, InputChecklistTask
|
||||
from telegram._payment.stars.staramount import StarAmount
|
||||
from telegram._payment.stars.startransactions import StarTransaction, StarTransactions
|
||||
from telegram._payment.stars.transactionpartner import (
|
||||
TransactionPartner,
|
||||
TransactionPartnerAffiliateProgram,
|
||||
TransactionPartnerChat,
|
||||
TransactionPartnerFragment,
|
||||
TransactionPartnerOther,
|
||||
TransactionPartnerTelegramAds,
|
||||
TransactionPartnerTelegramApi,
|
||||
TransactionPartnerUser,
|
||||
)
|
||||
__lazy_modules__: list[str] = ["constants", "error", "helpers", "request", "warnings"]
|
||||
|
||||
from . import _version, constants, error, helpers, request, warnings
|
||||
from ._birthdate import Birthdate
|
||||
from ._bot import Bot
|
||||
from ._botaccesssettings import BotAccessSettings
|
||||
from ._botcommand import BotCommand
|
||||
from ._botcommandscope import (
|
||||
BotCommandScope,
|
||||
@@ -412,11 +419,6 @@ from ._copytextbutton import CopyTextButton
|
||||
from ._dice import Dice
|
||||
from ._directmessagepricechanged import DirectMessagePriceChanged
|
||||
from ._directmessagestopic import DirectMessagesTopic
|
||||
from ._files._inputstorycontent import (
|
||||
InputStoryContent,
|
||||
InputStoryContentPhoto,
|
||||
InputStoryContentVideo,
|
||||
)
|
||||
from ._files.animation import Animation
|
||||
from ._files.audio import Audio
|
||||
from ._files.chatphoto import ChatPhoto
|
||||
@@ -429,11 +431,18 @@ from ._files.inputmedia import (
|
||||
InputMediaAnimation,
|
||||
InputMediaAudio,
|
||||
InputMediaDocument,
|
||||
InputMediaLivePhoto,
|
||||
InputMediaLocation,
|
||||
InputMediaPhoto,
|
||||
InputMediaSticker,
|
||||
InputMediaVenue,
|
||||
InputMediaVideo,
|
||||
InputPaidMedia,
|
||||
InputPaidMediaLivePhoto,
|
||||
InputPaidMediaPhoto,
|
||||
InputPaidMediaVideo,
|
||||
InputPollMedia,
|
||||
InputPollOptionMedia,
|
||||
)
|
||||
from ._files.inputprofilephoto import (
|
||||
InputProfilePhoto,
|
||||
@@ -441,6 +450,12 @@ from ._files.inputprofilephoto import (
|
||||
InputProfilePhotoStatic,
|
||||
)
|
||||
from ._files.inputsticker import InputSticker
|
||||
from ._files.inputstorycontent import (
|
||||
InputStoryContent,
|
||||
InputStoryContentPhoto,
|
||||
InputStoryContentVideo,
|
||||
)
|
||||
from ._files.livephoto import LivePhoto
|
||||
from ._files.location import Location
|
||||
from ._files.photosize import PhotoSize
|
||||
from ._files.sticker import MaskPosition, Sticker, StickerSet
|
||||
@@ -496,11 +511,17 @@ from ._inline.inputmessagecontent import InputMessageContent
|
||||
from ._inline.inputtextmessagecontent import InputTextMessageContent
|
||||
from ._inline.inputvenuemessagecontent import InputVenueMessageContent
|
||||
from ._inline.preparedinlinemessage import PreparedInlineMessage
|
||||
from ._inputchecklist import InputChecklist, InputChecklistTask
|
||||
from ._keyboardbutton import KeyboardButton
|
||||
from ._keyboardbuttonpolltype import KeyboardButtonPollType
|
||||
from ._keyboardbuttonrequest import KeyboardButtonRequestChat, KeyboardButtonRequestUsers
|
||||
from ._keyboardbuttonrequest import (
|
||||
KeyboardButtonRequestChat,
|
||||
KeyboardButtonRequestManagedBot,
|
||||
KeyboardButtonRequestUsers,
|
||||
)
|
||||
from ._linkpreviewoptions import LinkPreviewOptions
|
||||
from ._loginurl import LoginUrl
|
||||
from ._managedbot import ManagedBotCreated, ManagedBotUpdated
|
||||
from ._menubutton import MenuButton, MenuButtonCommands, MenuButtonDefault, MenuButtonWebApp
|
||||
from ._message import InaccessibleMessage, MaybeInaccessibleMessage, Message
|
||||
from ._messageautodeletetimerchanged import MessageAutoDeleteTimerChanged
|
||||
@@ -518,6 +539,7 @@ from ._ownedgift import OwnedGift, OwnedGiftRegular, OwnedGifts, OwnedGiftUnique
|
||||
from ._paidmedia import (
|
||||
PaidMedia,
|
||||
PaidMediaInfo,
|
||||
PaidMediaLivePhoto,
|
||||
PaidMediaPhoto,
|
||||
PaidMediaPreview,
|
||||
PaidMediaPurchased,
|
||||
@@ -563,8 +585,29 @@ from ._payment.stars.revenuewithdrawalstate import (
|
||||
RevenueWithdrawalStatePending,
|
||||
RevenueWithdrawalStateSucceeded,
|
||||
)
|
||||
from ._payment.stars.staramount import StarAmount
|
||||
from ._payment.stars.startransactions import StarTransaction, StarTransactions
|
||||
from ._payment.stars.transactionpartner import (
|
||||
TransactionPartner,
|
||||
TransactionPartnerAffiliateProgram,
|
||||
TransactionPartnerChat,
|
||||
TransactionPartnerFragment,
|
||||
TransactionPartnerOther,
|
||||
TransactionPartnerTelegramAds,
|
||||
TransactionPartnerTelegramApi,
|
||||
TransactionPartnerUser,
|
||||
)
|
||||
from ._payment.successfulpayment import SuccessfulPayment
|
||||
from ._poll import InputPollOption, Poll, PollAnswer, PollOption
|
||||
from ._poll import (
|
||||
InputPollOption,
|
||||
Poll,
|
||||
PollAnswer,
|
||||
PollMedia,
|
||||
PollOption,
|
||||
PollOptionAdded,
|
||||
PollOptionDeleted,
|
||||
)
|
||||
from ._preparedkeyboardbutton import PreparedKeyboardButton
|
||||
from ._proximityalerttriggered import ProximityAlertTriggered
|
||||
from ._reaction import (
|
||||
ReactionCount,
|
||||
@@ -576,6 +619,7 @@ from ._reaction import (
|
||||
from ._reply import ExternalReplyInfo, ReplyParameters, TextQuote
|
||||
from ._replykeyboardmarkup import ReplyKeyboardMarkup
|
||||
from ._replykeyboardremove import ReplyKeyboardRemove
|
||||
from ._sentguestmessage import SentGuestMessage
|
||||
from ._sentwebappmessage import SentWebAppMessage
|
||||
from ._shared import ChatShared, SharedUser, UsersShared
|
||||
from ._story import Story
|
||||
|
||||
@@ -37,12 +37,6 @@ class Birthdate(TelegramObject):
|
||||
day (:obj:`int`): Day of the user's birth; 1-31.
|
||||
month (:obj:`int`): Month of the user's birth; 1-12.
|
||||
year (:obj:`int`, optional): Year of the user's birth.
|
||||
|
||||
Attributes:
|
||||
day (:obj:`int`): Day of the user's birth; 1-31.
|
||||
month (:obj:`int`): Month of the user's birth; 1-12.
|
||||
year (:obj:`int`): Optional. Year of the user's birth.
|
||||
|
||||
"""
|
||||
|
||||
__slots__ = ("day", "month", "year")
|
||||
|
||||
+720
-620
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,77 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# A library that provides a Python interface to the Telegram Bot API
|
||||
# Copyright (C) 2015-2026
|
||||
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Lesser Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Lesser Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser Public License
|
||||
# along with this program. If not, see [http://www.gnu.org/licenses/].
|
||||
"""This module contains an object that represents a Telegram Bot Access Settings."""
|
||||
|
||||
from collections.abc import Sequence
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
from telegram._telegramobject import TelegramObject
|
||||
from telegram._user import User
|
||||
from telegram._utils.argumentparsing import de_list_optional, parse_sequence_arg
|
||||
from telegram._utils.types import JSONDict
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from telegram import Bot
|
||||
|
||||
|
||||
class BotAccessSettings(TelegramObject):
|
||||
"""
|
||||
This object describes the access settings of a bot.
|
||||
|
||||
Objects of this class are comparable in terms of equality. Two objects of this class are
|
||||
considered equal, if their :attr:`is_access_restricted` and :attr:`added_users` are equal.
|
||||
|
||||
.. versionadded:: 22.8
|
||||
|
||||
Args:
|
||||
is_access_restricted (:obj:`bool`): :obj:`True`, if only selected users can access the bot.
|
||||
The bot's owner can always access it.
|
||||
added_users (Sequence[:class:`telegram.User`], optional): The list of other users who
|
||||
have access to the bot if the access is restricted.
|
||||
|
||||
Attributes:
|
||||
is_access_restricted (:obj:`bool`): :obj:`True`, if only selected users can access the bot.
|
||||
The bot's owner can always access it.
|
||||
added_users (Sequence[:class:`telegram.User`]): Optional. The list of other users who
|
||||
have access to the bot if the access is restricted.
|
||||
"""
|
||||
|
||||
__slots__ = ("added_users", "is_access_restricted")
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
is_access_restricted: bool,
|
||||
added_users: Sequence[User] | None = None,
|
||||
*,
|
||||
api_kwargs: JSONDict | None = None,
|
||||
):
|
||||
super().__init__(api_kwargs=api_kwargs)
|
||||
self.is_access_restricted: bool = is_access_restricted
|
||||
self.added_users: tuple[User, ...] = parse_sequence_arg(added_users)
|
||||
|
||||
self._id_attrs = (self.is_access_restricted, self.added_users)
|
||||
self._freeze()
|
||||
|
||||
@classmethod
|
||||
def de_json(cls, data: JSONDict, bot: "Bot | None" = None) -> "BotAccessSettings":
|
||||
"""See :meth:`telegram.TelegramObject.de_json`."""
|
||||
data = cls._parse_data(data)
|
||||
data["added_users"] = de_list_optional(data.get("added_users"), User, bot)
|
||||
|
||||
return super().de_json(data=data, bot=bot)
|
||||
@@ -39,15 +39,6 @@ class BotCommand(TelegramObject):
|
||||
description (:obj:`str`): Description of the command;
|
||||
:tg-const:`telegram.BotCommand.MIN_DESCRIPTION`-
|
||||
:tg-const:`telegram.BotCommand.MAX_DESCRIPTION` characters.
|
||||
|
||||
Attributes:
|
||||
command (:obj:`str`): Text of the command; :tg-const:`telegram.BotCommand.MIN_COMMAND`-
|
||||
:tg-const:`telegram.BotCommand.MAX_COMMAND` characters. Can contain only lowercase
|
||||
English letters, digits and underscores.
|
||||
description (:obj:`str`): Description of the command;
|
||||
:tg-const:`telegram.BotCommand.MIN_DESCRIPTION`-
|
||||
:tg-const:`telegram.BotCommand.MAX_DESCRIPTION` characters.
|
||||
|
||||
"""
|
||||
|
||||
__slots__ = ("command", "description")
|
||||
|
||||
@@ -55,9 +55,6 @@ class BotCommandScope(TelegramObject):
|
||||
|
||||
Args:
|
||||
type (:obj:`str`): Scope type.
|
||||
|
||||
Attributes:
|
||||
type (:obj:`str`): Scope type.
|
||||
"""
|
||||
|
||||
__slots__ = ("type",)
|
||||
@@ -195,7 +192,6 @@ class BotCommandScopeChat(BotCommandScope):
|
||||
|
||||
Attributes:
|
||||
type (:obj:`str`): Scope type :tg-const:`telegram.BotCommandScope.CHAT`.
|
||||
chat_id (:obj:`str` | :obj:`int`): |chat_id_group|
|
||||
"""
|
||||
|
||||
__slots__ = ("chat_id",)
|
||||
@@ -222,7 +218,6 @@ class BotCommandScopeChatAdministrators(BotCommandScope):
|
||||
chat_id (:obj:`str` | :obj:`int`): |chat_id_group|
|
||||
Attributes:
|
||||
type (:obj:`str`): Scope type :tg-const:`telegram.BotCommandScope.CHAT_ADMINISTRATORS`.
|
||||
chat_id (:obj:`str` | :obj:`int`): |chat_id_group|
|
||||
"""
|
||||
|
||||
__slots__ = ("chat_id",)
|
||||
@@ -251,8 +246,6 @@ class BotCommandScopeChatMember(BotCommandScope):
|
||||
|
||||
Attributes:
|
||||
type (:obj:`str`): Scope type :tg-const:`telegram.BotCommandScope.CHAT_MEMBER`.
|
||||
chat_id (:obj:`str` | :obj:`int`): |chat_id_group|
|
||||
user_id (:obj:`int`): Unique identifier of the target user.
|
||||
"""
|
||||
|
||||
__slots__ = ("chat_id", "user_id")
|
||||
|
||||
@@ -32,10 +32,6 @@ class BotDescription(TelegramObject):
|
||||
|
||||
Args:
|
||||
description (:obj:`str`): The bot's description.
|
||||
|
||||
Attributes:
|
||||
description (:obj:`str`): The bot's description.
|
||||
|
||||
"""
|
||||
|
||||
__slots__ = ("description",)
|
||||
@@ -59,10 +55,6 @@ class BotShortDescription(TelegramObject):
|
||||
|
||||
Args:
|
||||
short_description (:obj:`str`): The bot's short description.
|
||||
|
||||
Attributes:
|
||||
short_description (:obj:`str`): The bot's short description.
|
||||
|
||||
"""
|
||||
|
||||
__slots__ = ("short_description",)
|
||||
|
||||
@@ -35,10 +35,6 @@ class BotName(TelegramObject):
|
||||
|
||||
Args:
|
||||
name (:obj:`str`): The bot's name.
|
||||
|
||||
Attributes:
|
||||
name (:obj:`str`): The bot's name.
|
||||
|
||||
"""
|
||||
|
||||
__slots__ = ("name",)
|
||||
|
||||
@@ -84,37 +84,6 @@ class BusinessBotRights(TelegramObject):
|
||||
transfer gifts.
|
||||
can_manage_stories (:obj:`bool`, optional): True, if the bot can post, edit and delete
|
||||
stories on behalf of the business account.
|
||||
|
||||
Attributes:
|
||||
can_reply (:obj:`bool`): Optional. True, if the bot can send and edit messages in the
|
||||
private chats that had incoming messages in the last 24 hours.
|
||||
can_read_messages (:obj:`bool`): Optional. True, if the bot can mark incoming private
|
||||
messages as read.
|
||||
can_delete_sent_messages (:obj:`bool`): Optional. True, if the bot can delete messages
|
||||
sent by the bot.
|
||||
can_delete_all_messages (:obj:`bool`): Optional. True, if the bot can delete all private
|
||||
messages in managed chats.
|
||||
can_edit_name (:obj:`bool`): Optional. True, if the bot can edit the first and last name
|
||||
of the business account.
|
||||
can_edit_bio (:obj:`bool`): Optional. True, if the bot can edit the bio of the
|
||||
business account.
|
||||
can_edit_profile_photo (:obj:`bool`): Optional. True, if the bot can edit the profile
|
||||
photo of the business account.
|
||||
can_edit_username (:obj:`bool`): Optional. True, if the bot can edit the username of the
|
||||
business account.
|
||||
can_change_gift_settings (:obj:`bool`): Optional. True, if the bot can change the privacy
|
||||
settings pertaining to gifts for the business account.
|
||||
can_view_gifts_and_stars (:obj:`bool`): Optional. True, if the bot can view gifts and the
|
||||
amount of Telegram Stars owned by the business account.
|
||||
can_convert_gifts_to_stars (:obj:`bool`): Optional. True, if the bot can convert regular
|
||||
gifts owned by the business account to Telegram Stars.
|
||||
can_transfer_and_upgrade_gifts (:obj:`bool`): Optional. True, if the bot can transfer and
|
||||
upgrade gifts owned by the business account.
|
||||
can_transfer_stars (:obj:`bool`): Optional. True, if the bot can transfer Telegram Stars
|
||||
received by the business account to its own account, or use them to upgrade and
|
||||
transfer gifts.
|
||||
can_manage_stories (:obj:`bool`): Optional. True, if the bot can post, edit and delete
|
||||
stories on behalf of the business account.
|
||||
"""
|
||||
|
||||
__slots__ = (
|
||||
@@ -214,17 +183,6 @@ class BusinessConnection(TelegramObject):
|
||||
rights (:class:`BusinessBotRights`, optional): Rights of the business bot.
|
||||
|
||||
.. versionadded:: 22.1
|
||||
|
||||
Attributes:
|
||||
id (:obj:`str`): Unique identifier of the business connection.
|
||||
user (:class:`telegram.User`): Business account user that created the business connection.
|
||||
user_chat_id (:obj:`int`): Identifier of a private chat with the user who created the
|
||||
business connection.
|
||||
date (:obj:`datetime.datetime`): Date the connection was established in Unix time.
|
||||
is_enabled (:obj:`bool`): True, if the connection is active.
|
||||
rights (:class:`BusinessBotRights`): Optional. Rights of the business bot.
|
||||
|
||||
.. versionadded:: 22.1
|
||||
"""
|
||||
|
||||
__slots__ = (
|
||||
@@ -297,13 +255,6 @@ class BusinessMessagesDeleted(TelegramObject):
|
||||
may not have access to the chat or the corresponding user.
|
||||
message_ids (Sequence[:obj:`int`]): A list of identifiers of the deleted messages in the
|
||||
chat of the business account.
|
||||
|
||||
Attributes:
|
||||
business_connection_id (:obj:`str`): Unique identifier of the business connection.
|
||||
chat (:class:`telegram.Chat`): Information about a chat in the business account. The bot
|
||||
may not have access to the chat or the corresponding user.
|
||||
message_ids (tuple[:obj:`int`]): A list of identifiers of the deleted messages in the
|
||||
chat of the business account.
|
||||
"""
|
||||
|
||||
__slots__ = (
|
||||
@@ -357,11 +308,6 @@ class BusinessIntro(TelegramObject):
|
||||
title (:obj:`str`, optional): Title text of the business intro.
|
||||
message (:obj:`str`, optional): Message text of the business intro.
|
||||
sticker (:class:`telegram.Sticker`, optional): Sticker of the business intro.
|
||||
|
||||
Attributes:
|
||||
title (:obj:`str`): Optional. Title text of the business intro.
|
||||
message (:obj:`str`): Optional. Message text of the business intro.
|
||||
sticker (:class:`telegram.Sticker`): Optional. Sticker of the business intro.
|
||||
"""
|
||||
|
||||
__slots__ = (
|
||||
@@ -410,10 +356,6 @@ class BusinessLocation(TelegramObject):
|
||||
Args:
|
||||
address (:obj:`str`): Address of the business.
|
||||
location (:class:`telegram.Location`, optional): Location of the business.
|
||||
|
||||
Attributes:
|
||||
address (:obj:`str`): Address of the business.
|
||||
location (:class:`telegram.Location`): Optional. Location of the business.
|
||||
"""
|
||||
|
||||
__slots__ = (
|
||||
@@ -478,14 +420,6 @@ class BusinessOpeningHoursInterval(TelegramObject):
|
||||
closing_minute (:obj:`int`): The minute's
|
||||
sequence number in a week, starting on Monday, marking the end of the time interval
|
||||
during which the business is open; 0 - 8 * 24 * 60
|
||||
|
||||
Attributes:
|
||||
opening_minute (:obj:`int`): The minute's sequence number in a week, starting on Monday,
|
||||
marking the start of the time interval during which the business is open;
|
||||
0 - 7 * 24 * 60.
|
||||
closing_minute (:obj:`int`): The minute's
|
||||
sequence number in a week, starting on Monday, marking the end of the time interval
|
||||
during which the business is open; 0 - 8 * 24 * 60
|
||||
"""
|
||||
|
||||
__slots__ = ("_closing_time", "_opening_time", "closing_minute", "opening_minute")
|
||||
@@ -553,12 +487,6 @@ class BusinessOpeningHours(TelegramObject):
|
||||
hours are defined.
|
||||
opening_hours (Sequence[:class:`telegram.BusinessOpeningHoursInterval`]): List of
|
||||
time intervals describing business opening hours.
|
||||
|
||||
Attributes:
|
||||
time_zone_name (:obj:`str`): Unique name of the time zone for which the opening
|
||||
hours are defined.
|
||||
opening_hours (Sequence[:class:`telegram.BusinessOpeningHoursInterval`]): List of
|
||||
time intervals describing business opening hours.
|
||||
"""
|
||||
|
||||
__slots__ = ("_cached_zone_info", "opening_hours", "time_zone_name")
|
||||
@@ -572,7 +500,7 @@ class BusinessOpeningHours(TelegramObject):
|
||||
):
|
||||
super().__init__(api_kwargs=api_kwargs)
|
||||
self.time_zone_name: str = time_zone_name
|
||||
self.opening_hours: Sequence[BusinessOpeningHoursInterval] = parse_sequence_arg(
|
||||
self.opening_hours: tuple[BusinessOpeningHoursInterval, ...] = parse_sequence_arg(
|
||||
opening_hours
|
||||
)
|
||||
|
||||
|
||||
@@ -91,16 +91,6 @@ class CallbackQuery(TelegramObject):
|
||||
the unique identifier for the game.
|
||||
|
||||
Attributes:
|
||||
id (:obj:`str`): Unique identifier for this query.
|
||||
from_user (:class:`telegram.User`): Sender.
|
||||
chat_instance (:obj:`str`): Global identifier, uniquely corresponding to the chat to which
|
||||
the message with the callback button was sent. Useful for high scores in games.
|
||||
message (:class:`telegram.MaybeInaccessibleMessage`): Optional. Message sent by the bot
|
||||
with the callback button that originated the query.
|
||||
|
||||
.. versionchanged:: 20.8
|
||||
Objects may be of type :class:`telegram.MaybeInaccessibleMessage` since Bot API
|
||||
7.0.
|
||||
data (:obj:`str` | :obj:`object`): Optional. Data associated with the callback button.
|
||||
Be aware that the message, which originated the query, can contain no callback buttons
|
||||
with this data.
|
||||
@@ -108,12 +98,6 @@ class CallbackQuery(TelegramObject):
|
||||
Tip:
|
||||
The value here is the same as the value passed in
|
||||
:paramref:`telegram.InlineKeyboardButton.callback_data`.
|
||||
inline_message_id (:obj:`str`): Optional. Identifier of the message sent via the bot in
|
||||
inline mode, that originated the query.
|
||||
game_short_name (:obj:`str`): Optional. Short name of a Game to be returned, serves as
|
||||
the unique identifier for the game.
|
||||
|
||||
|
||||
"""
|
||||
|
||||
__slots__ = (
|
||||
|
||||
+181
-20
@@ -34,6 +34,7 @@ from telegram._utils import enum
|
||||
from telegram._utils.defaultvalue import DEFAULT_NONE
|
||||
from telegram._utils.types import (
|
||||
CorrectOptionID,
|
||||
CorrectOptionIds,
|
||||
FileInput,
|
||||
JSONDict,
|
||||
ODVInput,
|
||||
@@ -57,12 +58,15 @@ if TYPE_CHECKING:
|
||||
InputChecklist,
|
||||
InputMediaAudio,
|
||||
InputMediaDocument,
|
||||
InputMediaLivePhoto,
|
||||
InputMediaPhoto,
|
||||
InputMediaVideo,
|
||||
InputPaidMedia,
|
||||
InputPollMedia,
|
||||
InputPollOption,
|
||||
LabeledPrice,
|
||||
LinkPreviewOptions,
|
||||
LivePhoto,
|
||||
Location,
|
||||
Message,
|
||||
MessageEntity,
|
||||
@@ -310,6 +314,7 @@ class _ChatBase(TelegramObject):
|
||||
|
||||
async def get_administrators(
|
||||
self,
|
||||
return_bots: bool | None = None,
|
||||
*,
|
||||
read_timeout: ODVInput[float] = DEFAULT_NONE,
|
||||
write_timeout: ODVInput[float] = DEFAULT_NONE,
|
||||
@@ -333,6 +338,7 @@ class _ChatBase(TelegramObject):
|
||||
"""
|
||||
return await self.get_bot().get_chat_administrators(
|
||||
chat_id=self.id,
|
||||
return_bots=return_bots,
|
||||
read_timeout=read_timeout,
|
||||
write_timeout=write_timeout,
|
||||
connect_timeout=connect_timeout,
|
||||
@@ -1087,7 +1093,7 @@ class _ChatBase(TelegramObject):
|
||||
async def send_message_draft(
|
||||
self,
|
||||
draft_id: int,
|
||||
text: str,
|
||||
text: str | None = None,
|
||||
message_thread_id: int | None = None,
|
||||
parse_mode: ODVInput[str] = DEFAULT_NONE,
|
||||
entities: Sequence["MessageEntity"] | None = None,
|
||||
@@ -1104,6 +1110,9 @@ class _ChatBase(TelegramObject):
|
||||
|
||||
For the documentation of the arguments, please see :meth:`telegram.Bot.send_message_draft`.
|
||||
|
||||
.. versionchanged:: 22.8
|
||||
Bot API 10.0 makes the ``text`` argument optional.
|
||||
|
||||
Returns:
|
||||
:obj:`bool`: On success, :obj:`True` is returned.
|
||||
|
||||
@@ -1189,7 +1198,7 @@ class _ChatBase(TelegramObject):
|
||||
async def send_media_group(
|
||||
self,
|
||||
media: Sequence[
|
||||
"InputMediaAudio | InputMediaDocument | InputMediaPhoto | InputMediaVideo"
|
||||
"InputMediaAudio | InputMediaDocument | InputMediaPhoto | InputMediaVideo | InputMediaLivePhoto" # noqa: E501 # pylint: disable=line-too-long
|
||||
],
|
||||
disable_notification: ODVInput[bool] = DEFAULT_NONE,
|
||||
protect_content: ODVInput[bool] = DEFAULT_NONE,
|
||||
@@ -1348,6 +1357,76 @@ class _ChatBase(TelegramObject):
|
||||
suggested_post_parameters=suggested_post_parameters,
|
||||
)
|
||||
|
||||
async def send_live_photo(
|
||||
self,
|
||||
live_photo: "FileInput | LivePhoto",
|
||||
photo: "FileInput | PhotoSize",
|
||||
business_connection_id: str | None = None,
|
||||
message_thread_id: int | None = None,
|
||||
direct_messages_topic_id: int | None = None,
|
||||
caption: str | None = None,
|
||||
parse_mode: ODVInput[str] = DEFAULT_NONE,
|
||||
caption_entities: Sequence["MessageEntity"] | None = None,
|
||||
show_caption_above_media: bool | None = None,
|
||||
has_spoiler: bool | None = None,
|
||||
disable_notification: ODVInput[bool] = DEFAULT_NONE,
|
||||
protect_content: ODVInput[bool] = DEFAULT_NONE,
|
||||
allow_paid_broadcast: bool | None = None,
|
||||
message_effect_id: str | None = None,
|
||||
suggested_post_parameters: "SuggestedPostParameters | None" = None,
|
||||
reply_parameters: "ReplyParameters | None" = None,
|
||||
reply_markup: "ReplyMarkup | None" = None,
|
||||
*,
|
||||
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
|
||||
reply_to_message_id: int | None = None,
|
||||
filename: str | None = None,
|
||||
read_timeout: ODVInput[float] = DEFAULT_NONE,
|
||||
write_timeout: ODVInput[float] = DEFAULT_NONE,
|
||||
connect_timeout: ODVInput[float] = DEFAULT_NONE,
|
||||
pool_timeout: ODVInput[float] = DEFAULT_NONE,
|
||||
api_kwargs: JSONDict | None = None,
|
||||
) -> "Message":
|
||||
"""Shortcut for::
|
||||
|
||||
await bot.send_live_photo(update.effective_chat.id, *args, **kwargs)
|
||||
|
||||
For the documentation of the arguments, please see :meth:`telegram.Bot.send_live_photo`.
|
||||
|
||||
.. versionadded:: 22.8
|
||||
|
||||
Returns:
|
||||
:class:`telegram.Message`: On success, instance representing the message posted.
|
||||
|
||||
"""
|
||||
return await self.get_bot().send_live_photo(
|
||||
chat_id=self.id,
|
||||
live_photo=live_photo,
|
||||
photo=photo,
|
||||
business_connection_id=business_connection_id,
|
||||
message_thread_id=message_thread_id,
|
||||
direct_messages_topic_id=direct_messages_topic_id,
|
||||
caption=caption,
|
||||
parse_mode=parse_mode,
|
||||
caption_entities=caption_entities,
|
||||
show_caption_above_media=show_caption_above_media,
|
||||
has_spoiler=has_spoiler,
|
||||
disable_notification=disable_notification,
|
||||
protect_content=protect_content,
|
||||
allow_paid_broadcast=allow_paid_broadcast,
|
||||
message_effect_id=message_effect_id,
|
||||
suggested_post_parameters=suggested_post_parameters,
|
||||
reply_parameters=reply_parameters,
|
||||
reply_markup=reply_markup,
|
||||
allow_sending_without_reply=allow_sending_without_reply,
|
||||
reply_to_message_id=reply_to_message_id,
|
||||
filename=filename,
|
||||
read_timeout=read_timeout,
|
||||
write_timeout=write_timeout,
|
||||
connect_timeout=connect_timeout,
|
||||
pool_timeout=pool_timeout,
|
||||
api_kwargs=api_kwargs,
|
||||
)
|
||||
|
||||
async def send_contact(
|
||||
self,
|
||||
phone_number: str | None = None,
|
||||
@@ -2296,6 +2375,18 @@ class _ChatBase(TelegramObject):
|
||||
question_entities: Sequence["MessageEntity"] | None = None,
|
||||
message_effect_id: str | None = None,
|
||||
allow_paid_broadcast: bool | None = None,
|
||||
shuffle_options: bool | None = None,
|
||||
allows_revoting: bool | None = None,
|
||||
correct_option_ids: CorrectOptionIds | None = None,
|
||||
allow_adding_options: bool | None = None,
|
||||
hide_results_until_closes: bool | None = None,
|
||||
description: str | None = None,
|
||||
description_parse_mode: ODVInput[str] | None = None,
|
||||
description_entities: Sequence["MessageEntity"] | None = None,
|
||||
members_only: bool | None = None,
|
||||
country_codes: Sequence[str] | None = None,
|
||||
explanation_media: "InputPollMedia | None" = None,
|
||||
media: "InputPollMedia | None" = None,
|
||||
*,
|
||||
reply_to_message_id: int | None = None,
|
||||
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
|
||||
@@ -2323,6 +2414,9 @@ class _ChatBase(TelegramObject):
|
||||
type=type, # pylint=pylint,
|
||||
allows_multiple_answers=allows_multiple_answers,
|
||||
correct_option_id=correct_option_id,
|
||||
allows_revoting=allows_revoting,
|
||||
shuffle_options=shuffle_options,
|
||||
correct_option_ids=correct_option_ids,
|
||||
is_closed=is_closed,
|
||||
disable_notification=disable_notification,
|
||||
reply_to_message_id=reply_to_message_id,
|
||||
@@ -2346,6 +2440,15 @@ class _ChatBase(TelegramObject):
|
||||
business_connection_id=business_connection_id,
|
||||
question_parse_mode=question_parse_mode,
|
||||
question_entities=question_entities,
|
||||
description=description,
|
||||
description_parse_mode=description_parse_mode,
|
||||
description_entities=description_entities,
|
||||
hide_results_until_closes=hide_results_until_closes,
|
||||
allow_adding_options=allow_adding_options,
|
||||
members_only=members_only,
|
||||
country_codes=country_codes,
|
||||
explanation_media=explanation_media,
|
||||
media=media,
|
||||
)
|
||||
|
||||
async def send_copy(
|
||||
@@ -4032,6 +4135,82 @@ class _ChatBase(TelegramObject):
|
||||
api_kwargs=api_kwargs,
|
||||
)
|
||||
|
||||
async def delete_reaction(
|
||||
self,
|
||||
message_id: int,
|
||||
user_id: int | None = None,
|
||||
actor_chat_id: int | None = None,
|
||||
*,
|
||||
read_timeout: ODVInput[float] = DEFAULT_NONE,
|
||||
write_timeout: ODVInput[float] = DEFAULT_NONE,
|
||||
connect_timeout: ODVInput[float] = DEFAULT_NONE,
|
||||
pool_timeout: ODVInput[float] = DEFAULT_NONE,
|
||||
api_kwargs: JSONDict | None = None,
|
||||
) -> bool:
|
||||
"""
|
||||
Shortcut for::
|
||||
|
||||
await bot.delete_message_reaction(chat_id=update.effective_chat.id, *args, **kwargs)
|
||||
|
||||
For the documentation of the arguments, please see
|
||||
:meth:`telegram.Bot.delete_message_reaction`.
|
||||
|
||||
.. versionadded:: 22.8
|
||||
|
||||
Returns:
|
||||
:obj:`bool`: On success, :obj:`True` is returned.
|
||||
"""
|
||||
return await self.get_bot().delete_message_reaction(
|
||||
chat_id=self.id,
|
||||
message_id=message_id,
|
||||
user_id=user_id,
|
||||
actor_chat_id=actor_chat_id,
|
||||
read_timeout=read_timeout,
|
||||
write_timeout=write_timeout,
|
||||
connect_timeout=connect_timeout,
|
||||
pool_timeout=pool_timeout,
|
||||
api_kwargs=api_kwargs,
|
||||
)
|
||||
|
||||
async def delete_all_reactions(
|
||||
self,
|
||||
user_id: int | None = None,
|
||||
actor_chat_id: int | None = None,
|
||||
*,
|
||||
read_timeout: ODVInput[float] = DEFAULT_NONE,
|
||||
write_timeout: ODVInput[float] = DEFAULT_NONE,
|
||||
connect_timeout: ODVInput[float] = DEFAULT_NONE,
|
||||
pool_timeout: ODVInput[float] = DEFAULT_NONE,
|
||||
api_kwargs: JSONDict | None = None,
|
||||
) -> bool:
|
||||
"""
|
||||
Shortcut for::
|
||||
|
||||
await bot.delete_all_message_reactions(
|
||||
chat_id=update.effective_chat.id,
|
||||
*args,
|
||||
**kwargs
|
||||
)
|
||||
|
||||
For the documentation of the arguments, please see
|
||||
:meth:`telegram.Bot.delete_all_message_reactions`.
|
||||
|
||||
.. versionadded:: 22.8
|
||||
|
||||
Returns:
|
||||
:obj:`bool`: On success, :obj:`True` is returned.
|
||||
"""
|
||||
return await self.get_bot().delete_all_message_reactions(
|
||||
chat_id=self.id,
|
||||
user_id=user_id,
|
||||
actor_chat_id=actor_chat_id,
|
||||
read_timeout=read_timeout,
|
||||
write_timeout=write_timeout,
|
||||
connect_timeout=connect_timeout,
|
||||
pool_timeout=pool_timeout,
|
||||
api_kwargs=api_kwargs,
|
||||
)
|
||||
|
||||
|
||||
class Chat(_ChatBase):
|
||||
"""This object represents a chat.
|
||||
@@ -4074,24 +4253,6 @@ class Chat(_ChatBase):
|
||||
|
||||
.. versionadded:: 22.4
|
||||
|
||||
Attributes:
|
||||
id (:obj:`int`): Unique identifier for this chat.
|
||||
type (:obj:`str`): Type of chat, can be either :attr:`PRIVATE`, :attr:`GROUP`,
|
||||
:attr:`SUPERGROUP` or :attr:`CHANNEL`.
|
||||
title (:obj:`str`): Optional. Title, for supergroups, channels and group chats.
|
||||
username (:obj:`str`): Optional. Username, for private chats, supergroups and channels if
|
||||
available.
|
||||
first_name (:obj:`str`): Optional. First name of the other party in a private chat.
|
||||
last_name (:obj:`str`): Optional. Last name of the other party in a private chat.
|
||||
is_forum (:obj:`bool`): Optional. :obj:`True`, if the supergroup chat is a forum
|
||||
(has topics_ enabled).
|
||||
|
||||
.. versionadded:: 20.0
|
||||
is_direct_messages (:obj:`bool`): Optional. :obj:`True`, if the chat is the direct messages
|
||||
chat of a channel.
|
||||
|
||||
.. versionadded:: 22.4
|
||||
|
||||
.. _topics: https://telegram.org/blog/topics-in-groups-collectible-usernames#topics-in-groups
|
||||
"""
|
||||
|
||||
|
||||
@@ -113,64 +113,6 @@ class ChatAdministratorRights(TelegramObject):
|
||||
tags of regular members; for groups and supergroups only. If omitted defaults to the
|
||||
value of :attr:`can_pin_messages`.
|
||||
|
||||
.. versionadded:: 22.7
|
||||
|
||||
Attributes:
|
||||
is_anonymous (:obj:`bool`): :obj:`True`, if the user's presence in the chat is hidden.
|
||||
can_manage_chat (:obj:`bool`): :obj:`True`, if the administrator can access the chat event
|
||||
log, get boost list, see hidden supergroup and channel members, report spam messages
|
||||
and ignore slow mode. Implied by any other administrator privilege.
|
||||
can_delete_messages (:obj:`bool`): :obj:`True`, if the administrator can delete messages of
|
||||
other users.
|
||||
can_manage_video_chats (:obj:`bool`): :obj:`True`, if the administrator can manage video
|
||||
chats.
|
||||
can_restrict_members (:obj:`bool`): :obj:`True`, if the administrator can restrict, ban or
|
||||
unban chat members, or access supergroup statistics.
|
||||
can_promote_members (:obj:`bool`): :obj:`True`, if the administrator can add new
|
||||
administrators with a subset of their own privileges or demote administrators that he
|
||||
has promoted, directly or indirectly (promoted by administrators that were appointed by
|
||||
the user.)
|
||||
can_change_info (:obj:`bool`): :obj:`True`, if the user is allowed to change the chat title
|
||||
,photo and other settings.
|
||||
can_invite_users (:obj:`bool`): :obj:`True`, if the user is allowed to invite new users to
|
||||
the chat.
|
||||
can_post_messages (:obj:`bool`): Optional. :obj:`True`, if the administrator can post
|
||||
messages in the channel, or access channel statistics; for channels only.
|
||||
can_edit_messages (:obj:`bool`): Optional. :obj:`True`, if the administrator can edit
|
||||
messages of other users and can pin messages; for channels only.
|
||||
can_pin_messages (:obj:`bool`): Optional. :obj:`True`, if the user is allowed to pin
|
||||
messages; for groups and supergroups only.
|
||||
can_post_stories (:obj:`bool`): :obj:`True`, if the administrator can post
|
||||
stories to the chat.
|
||||
|
||||
.. versionadded:: 20.6
|
||||
.. versionchanged:: 21.0
|
||||
|non_optional_story_argument|
|
||||
can_edit_stories (:obj:`bool`): :obj:`True`, if the administrator can edit stories posted
|
||||
by other users, post stories to the chat page, pin chat stories, and access the chat's
|
||||
story archive
|
||||
|
||||
.. versionadded:: 20.6
|
||||
.. versionchanged:: 21.0
|
||||
|non_optional_story_argument|
|
||||
can_delete_stories (:obj:`bool`): :obj:`True`, if the administrator can delete
|
||||
stories posted by other users.
|
||||
|
||||
.. versionadded:: 20.6
|
||||
.. versionchanged:: 21.0
|
||||
|non_optional_story_argument|
|
||||
can_manage_topics (:obj:`bool`): Optional. :obj:`True`, if the user is allowed
|
||||
to create, rename, close, and reopen forum topics; for supergroups only.
|
||||
|
||||
.. versionadded:: 20.0
|
||||
can_manage_direct_messages (:obj:`bool`): Optional. :obj:`True`, if the administrator can
|
||||
manage direct messages of the channel and decline suggested posts; for channels only.
|
||||
|
||||
.. versionadded:: 22.4
|
||||
can_manage_tags (:obj:`bool`): Optional. :obj:`True`, if the administrator can edit the
|
||||
tags of regular members; for groups and supergroups only. If omitted defaults to the
|
||||
value of :attr:`can_pin_messages`.
|
||||
|
||||
.. versionadded:: 22.7
|
||||
"""
|
||||
|
||||
|
||||
@@ -48,11 +48,6 @@ class BackgroundFill(TelegramObject):
|
||||
type (:obj:`str`): Type of the background fill. Can be one of:
|
||||
:attr:`~telegram.BackgroundFill.SOLID`, :attr:`~telegram.BackgroundFill.GRADIENT`
|
||||
or :attr:`~telegram.BackgroundFill.FREEFORM_GRADIENT`.
|
||||
|
||||
Attributes:
|
||||
type (:obj:`str`): Type of the background fill. Can be one of:
|
||||
:attr:`~telegram.BackgroundFill.SOLID`, :attr:`~telegram.BackgroundFill.GRADIENT`
|
||||
or :attr:`~telegram.BackgroundFill.FREEFORM_GRADIENT`.
|
||||
"""
|
||||
|
||||
__slots__ = ("type",)
|
||||
@@ -111,7 +106,6 @@ class BackgroundFillSolid(BackgroundFill):
|
||||
Attributes:
|
||||
type (:obj:`str`): Type of the background fill. Always
|
||||
:attr:`~telegram.BackgroundFill.SOLID`.
|
||||
color (:obj:`int`): The color of the background fill in the `RGB24` format.
|
||||
"""
|
||||
|
||||
__slots__ = ("color",)
|
||||
@@ -151,11 +145,6 @@ class BackgroundFillGradient(BackgroundFill):
|
||||
Attributes:
|
||||
type (:obj:`str`): Type of the background fill. Always
|
||||
:attr:`~telegram.BackgroundFill.GRADIENT`.
|
||||
top_color (:obj:`int`): Top color of the gradient in the `RGB24` format.
|
||||
bottom_color (:obj:`int`): Bottom color of the gradient in the `RGB24` format.
|
||||
rotation_angle (:obj:`int`): Clockwise rotation angle of the background
|
||||
fill in degrees;
|
||||
0-:tg-const:`telegram.constants.BackgroundFillLimit.MAX_ROTATION_ANGLE`.
|
||||
"""
|
||||
|
||||
__slots__ = ("bottom_color", "rotation_angle", "top_color")
|
||||
@@ -194,8 +183,6 @@ class BackgroundFillFreeformGradient(BackgroundFill):
|
||||
Attributes:
|
||||
type (:obj:`str`): Type of the background fill. Always
|
||||
:attr:`~telegram.BackgroundFill.FREEFORM_GRADIENT`.
|
||||
colors (Sequence[:obj:`int`]): A list of the 3 or 4 base colors that are used to
|
||||
generate the freeform gradient in the `RGB24` format
|
||||
"""
|
||||
|
||||
__slots__ = ("colors",)
|
||||
@@ -232,13 +219,6 @@ class BackgroundType(TelegramObject):
|
||||
:attr:`~telegram.BackgroundType.FILL`, :attr:`~telegram.BackgroundType.WALLPAPER`
|
||||
:attr:`~telegram.BackgroundType.PATTERN` or
|
||||
:attr:`~telegram.BackgroundType.CHAT_THEME`.
|
||||
|
||||
Attributes:
|
||||
type (:obj:`str`): Type of the background. Can be one of:
|
||||
:attr:`~telegram.BackgroundType.FILL`, :attr:`~telegram.BackgroundType.WALLPAPER`
|
||||
:attr:`~telegram.BackgroundType.PATTERN` or
|
||||
:attr:`~telegram.BackgroundType.CHAT_THEME`.
|
||||
|
||||
"""
|
||||
|
||||
__slots__ = ("type",)
|
||||
@@ -307,10 +287,6 @@ class BackgroundTypeFill(BackgroundType):
|
||||
Attributes:
|
||||
type (:obj:`str`): Type of the background. Always
|
||||
:attr:`~telegram.BackgroundType.FILL`.
|
||||
fill (:class:`telegram.BackgroundFill`): The background fill.
|
||||
dark_theme_dimming (:obj:`int`): Dimming of the background in dark themes, as a
|
||||
percentage;
|
||||
0-:tg-const:`telegram.constants.BackgroundTypeLimit.MAX_DIMMING`.
|
||||
"""
|
||||
|
||||
__slots__ = ("dark_theme_dimming", "fill")
|
||||
@@ -353,14 +329,6 @@ class BackgroundTypeWallpaper(BackgroundType):
|
||||
Attributes:
|
||||
type (:obj:`str`): Type of the background. Always
|
||||
:attr:`~telegram.BackgroundType.WALLPAPER`.
|
||||
document (:class:`telegram.Document`): Document with the wallpaper
|
||||
dark_theme_dimming (:obj:`int`): Dimming of the background in dark themes, as a
|
||||
percentage;
|
||||
0-:tg-const:`telegram.constants.BackgroundTypeLimit.MAX_DIMMING`.
|
||||
is_blurred (:obj:`bool`): Optional. :obj:`True`, if the wallpaper is downscaled to fit
|
||||
in a 450x450 square and then box-blurred with radius 12
|
||||
is_moving (:obj:`bool`): Optional. :obj:`True`, if the background moves slightly
|
||||
when the device is tilted
|
||||
"""
|
||||
|
||||
__slots__ = ("dark_theme_dimming", "document", "is_blurred", "is_moving")
|
||||
@@ -414,17 +382,6 @@ class BackgroundTypePattern(BackgroundType):
|
||||
Attributes:
|
||||
type (:obj:`str`): Type of the background. Always
|
||||
:attr:`~telegram.BackgroundType.PATTERN`.
|
||||
document (:class:`telegram.Document`): Document with the pattern.
|
||||
fill (:class:`telegram.BackgroundFill`): The background fill that is combined with
|
||||
the pattern.
|
||||
intensity (:obj:`int`): Intensity of the pattern when it is shown above the filled
|
||||
background;
|
||||
0-:tg-const:`telegram.constants.BackgroundTypeLimit.MAX_INTENSITY`.
|
||||
is_inverted (:obj:`int`): Optional. :obj:`True`, if the background fill must be applied
|
||||
only to the pattern itself. All other pixels are black in this case. For dark
|
||||
themes only.
|
||||
is_moving (:obj:`bool`): Optional. :obj:`True`, if the background moves slightly
|
||||
when the device is tilted.
|
||||
"""
|
||||
|
||||
__slots__ = (
|
||||
@@ -474,7 +431,6 @@ class BackgroundTypeChatTheme(BackgroundType):
|
||||
Attributes:
|
||||
type (:obj:`str`): Type of the background. Always
|
||||
:attr:`~telegram.BackgroundType.CHAT_THEME`.
|
||||
theme_name (:obj:`str`): Name of the chat theme, which is usually an emoji.
|
||||
"""
|
||||
|
||||
__slots__ = ("theme_name",)
|
||||
@@ -504,9 +460,6 @@ class ChatBackground(TelegramObject):
|
||||
|
||||
Args:
|
||||
type (:class:`telegram.BackgroundType`): Type of the background.
|
||||
|
||||
Attributes:
|
||||
type (:class:`telegram.BackgroundType`): Type of the background.
|
||||
"""
|
||||
|
||||
__slots__ = ("type",)
|
||||
|
||||
@@ -47,10 +47,6 @@ class ChatBoostAdded(TelegramObject):
|
||||
|
||||
Args:
|
||||
boost_count (:obj:`int`): Number of boosts added by the user.
|
||||
|
||||
Attributes:
|
||||
boost_count (:obj:`int`): Number of boosts added by the user.
|
||||
|
||||
"""
|
||||
|
||||
__slots__ = ("boost_count",)
|
||||
@@ -85,11 +81,6 @@ class ChatBoostSource(TelegramObject):
|
||||
source (:obj:`str`): The source of the chat boost. Can be one of:
|
||||
:attr:`~telegram.ChatBoostSource.PREMIUM`, :attr:`~telegram.ChatBoostSource.GIFT_CODE`,
|
||||
or :attr:`~telegram.ChatBoostSource.GIVEAWAY`.
|
||||
|
||||
Attributes:
|
||||
source (:obj:`str`): The source of the chat boost. Can be one of:
|
||||
:attr:`~telegram.ChatBoostSource.PREMIUM`, :attr:`~telegram.ChatBoostSource.GIFT_CODE`,
|
||||
or :attr:`~telegram.ChatBoostSource.GIVEAWAY`.
|
||||
"""
|
||||
|
||||
__slots__ = ("source",)
|
||||
@@ -143,7 +134,6 @@ class ChatBoostSourcePremium(ChatBoostSource):
|
||||
Attributes:
|
||||
source (:obj:`str`): The source of the chat boost. Always
|
||||
:attr:`~telegram.ChatBoostSource.PREMIUM`.
|
||||
user (:class:`telegram.User`): User that boosted the chat.
|
||||
"""
|
||||
|
||||
__slots__ = ("user",)
|
||||
@@ -169,7 +159,6 @@ class ChatBoostSourceGiftCode(ChatBoostSource):
|
||||
Attributes:
|
||||
source (:obj:`str`): The source of the chat boost. Always
|
||||
:attr:`~telegram.ChatBoostSource.GIFT_CODE`.
|
||||
user (:class:`telegram.User`): User for which the gift code was created.
|
||||
"""
|
||||
|
||||
__slots__ = ("user",)
|
||||
@@ -205,15 +194,6 @@ class ChatBoostSourceGiveaway(ChatBoostSource):
|
||||
Attributes:
|
||||
source (:obj:`str`): Source of the boost. Always
|
||||
:attr:`~telegram.ChatBoostSource.GIVEAWAY`.
|
||||
giveaway_message_id (:obj:`int`): Identifier of a message in the chat with the giveaway;
|
||||
the message could have been deleted already. May be 0 if the message isn't sent yet.
|
||||
user (:class:`telegram.User`): Optional. User that won the prize in the giveaway if any.
|
||||
prize_star_count (:obj:`int`): Optional. The number of Telegram Stars to be split between
|
||||
giveaway winners; for Telegram Star giveaways only.
|
||||
|
||||
.. versionadded:: 21.6
|
||||
is_unclaimed (:obj:`bool`): Optional. :obj:`True`, if the giveaway was completed, but
|
||||
there was no user to win the prize.
|
||||
"""
|
||||
|
||||
__slots__ = ("giveaway_message_id", "is_unclaimed", "prize_star_count", "user")
|
||||
@@ -247,14 +227,6 @@ class ChatBoost(TelegramObject):
|
||||
.. versionadded:: 20.8
|
||||
|
||||
Args:
|
||||
boost_id (:obj:`str`): Unique identifier of the boost.
|
||||
add_date (:obj:`datetime.datetime`): Point in time when the chat was boosted.
|
||||
expiration_date (:obj:`datetime.datetime`): Point in time when the boost
|
||||
will automatically expire, unless the booster's Telegram Premium subscription is
|
||||
prolonged.
|
||||
source (:class:`telegram.ChatBoostSource`): Source of the added boost.
|
||||
|
||||
Attributes:
|
||||
boost_id (:obj:`str`): Unique identifier of the boost.
|
||||
add_date (:obj:`datetime.datetime`): Point in time when the chat was boosted.
|
||||
|datetime_localization|
|
||||
@@ -309,10 +281,6 @@ class ChatBoostUpdated(TelegramObject):
|
||||
Args:
|
||||
chat (:class:`telegram.Chat`): Chat which was boosted.
|
||||
boost (:class:`telegram.ChatBoost`): Information about the chat boost.
|
||||
|
||||
Attributes:
|
||||
chat (:class:`telegram.Chat`): Chat which was boosted.
|
||||
boost (:class:`telegram.ChatBoost`): Information about the chat boost.
|
||||
"""
|
||||
|
||||
__slots__ = ("boost", "chat")
|
||||
@@ -352,12 +320,6 @@ class ChatBoostRemoved(TelegramObject):
|
||||
:attr:`source` are equal.
|
||||
|
||||
Args:
|
||||
chat (:class:`telegram.Chat`): Chat which was boosted.
|
||||
boost_id (:obj:`str`): Unique identifier of the boost.
|
||||
remove_date (:obj:`datetime.datetime`): Point in time when the boost was removed.
|
||||
source (:class:`telegram.ChatBoostSource`): Source of the removed boost.
|
||||
|
||||
Attributes:
|
||||
chat (:class:`telegram.Chat`): Chat which was boosted.
|
||||
boost_id (:obj:`str`): Unique identifier of the boost.
|
||||
remove_date (:obj:`datetime.datetime`): Point in time when the boost was removed.
|
||||
@@ -410,9 +372,6 @@ class UserChatBoosts(TelegramObject):
|
||||
Args:
|
||||
boosts (Sequence[:class:`telegram.ChatBoost`]): List of boosts added to the chat by the
|
||||
user.
|
||||
|
||||
Attributes:
|
||||
boosts (tuple[:class:`telegram.ChatBoost`]): List of boosts added to the chat by the user.
|
||||
"""
|
||||
|
||||
__slots__ = ("boosts",)
|
||||
|
||||
@@ -245,7 +245,7 @@ class ChatFullInfo(_ChatBase):
|
||||
|
||||
.. versionadded:: 22.6
|
||||
paid_message_star_count (:obj:`int`, optional): The number of Telegram Stars a general user
|
||||
have to pay to send a message to the chat
|
||||
has to pay to send a message to the chat
|
||||
|
||||
.. versionadded:: 22.6
|
||||
first_profile_audio (:obj:`telegram.Audio`, optional): For private chats, the first audio
|
||||
@@ -253,129 +253,12 @@ class ChatFullInfo(_ChatBase):
|
||||
|
||||
.. versionadded:: 22.7
|
||||
|
||||
|
||||
Attributes:
|
||||
id (:obj:`int`): Unique identifier for this chat.
|
||||
type (:obj:`str`): Type of chat, can be either :attr:`PRIVATE`, :attr:`GROUP`,
|
||||
:attr:`SUPERGROUP` or :attr:`CHANNEL`.
|
||||
accent_color_id (:obj:`int`): Optional. Identifier of the
|
||||
:class:`accent color <telegram.constants.AccentColor>` for the chat name and
|
||||
backgrounds of the chat photo, reply header, and link preview. See `accent colors`_
|
||||
for more details.
|
||||
|
||||
.. versionadded:: 20.8
|
||||
max_reaction_count (:obj:`int`): The maximum number of reactions that can be set on a
|
||||
message in the chat.
|
||||
|
||||
.. versionadded:: 21.2
|
||||
accepted_gift_types (:class:`telegram.AcceptedGiftTypes`): Information about types of
|
||||
gifts that are accepted by the chat or by the corresponding user for private chats.
|
||||
|
||||
.. versionadded:: 22.1
|
||||
title (:obj:`str`, optional): Title, for supergroups, channels and group chats.
|
||||
username (:obj:`str`, optional): Username, for private chats, supergroups and channels if
|
||||
available.
|
||||
first_name (:obj:`str`, optional): First name of the other party in a private chat.
|
||||
last_name (:obj:`str`, optional): Last name of the other party in a private chat.
|
||||
is_forum (:obj:`bool`, optional): :obj:`True`, if the supergroup chat is a forum
|
||||
(has topics_ enabled).
|
||||
|
||||
.. versionadded:: 20.0
|
||||
photo (:class:`telegram.ChatPhoto`): Optional. Chat photo.
|
||||
active_usernames (tuple[:obj:`str`]): Optional. If set, the list of all `active chat
|
||||
usernames <https://telegram.org/blog/topics-in-groups-collectible-usernames\
|
||||
#collectible-usernames>`_; for private chats, supergroups and channels.
|
||||
|
||||
This list is empty if the chat has no active usernames or this chat instance was not
|
||||
obtained via :meth:`~telegram.Bot.get_chat`.
|
||||
|
||||
.. versionadded:: 20.0
|
||||
birthdate (:class:`telegram.Birthdate`): Optional. For private chats,
|
||||
the date of birth of the user.
|
||||
|
||||
.. versionadded:: 21.1
|
||||
business_intro (:class:`telegram.BusinessIntro`): Optional. For private chats with
|
||||
business accounts, the intro of the business.
|
||||
|
||||
.. versionadded:: 21.1
|
||||
business_location (:class:`telegram.BusinessLocation`): Optional. For private chats with
|
||||
business accounts, the location of the business.
|
||||
|
||||
.. versionadded:: 21.1
|
||||
business_opening_hours (:class:`telegram.BusinessOpeningHours`): Optional. For private
|
||||
chats with business accounts, the opening hours of the business.
|
||||
|
||||
.. versionadded:: 21.1
|
||||
personal_chat (:class:`telegram.Chat`): Optional. For private chats, the personal channel
|
||||
of the user.
|
||||
|
||||
.. versionadded:: 21.1
|
||||
available_reactions (tuple[:class:`telegram.ReactionType`]): Optional. List of available
|
||||
reactions allowed in the chat. If omitted, then all of
|
||||
:const:`telegram.constants.ReactionEmoji` are allowed.
|
||||
|
||||
.. versionadded:: 20.8
|
||||
background_custom_emoji_id (:obj:`str`): Optional. Custom emoji identifier of emoji chosen
|
||||
by the chat for the reply header and link preview background.
|
||||
|
||||
.. versionadded:: 20.8
|
||||
profile_accent_color_id (:obj:`int`): Optional. Identifier of the
|
||||
:class:`accent color <telegram.constants.ProfileAccentColor>` for the chat's profile
|
||||
background. See profile `accent colors`_ for more details.
|
||||
|
||||
.. versionadded:: 20.8
|
||||
profile_background_custom_emoji_id (:obj:`str`): Optional. Custom emoji identifier of
|
||||
the emoji chosen by the chat for its profile background.
|
||||
|
||||
.. versionadded:: 20.8
|
||||
emoji_status_custom_emoji_id (:obj:`str`): Optional. Custom emoji identifier of emoji
|
||||
status of the chat or the other party in a private chat.
|
||||
|
||||
.. versionadded:: 20.0
|
||||
emoji_status_expiration_date (:class:`datetime.datetime`): Optional. Expiration date of
|
||||
emoji status of the chat or the other party in a private chat, as a datetime object,
|
||||
if any.
|
||||
|
||||
|datetime_localization|
|
||||
|
||||
.. versionadded:: 20.5
|
||||
bio (:obj:`str`): Optional. Bio of the other party in a private chat.
|
||||
has_private_forwards (:obj:`bool`): Optional. :obj:`True`, if privacy settings of the other
|
||||
party in the private chat allows to use ``tg://user?id=<user_id>`` links only in chats
|
||||
with the user.
|
||||
|
||||
.. versionadded:: 13.9
|
||||
has_restricted_voice_and_video_messages (:obj:`bool`): Optional. :obj:`True`, if the
|
||||
privacy settings of the other party restrict sending voice and video note messages
|
||||
in the private chat.
|
||||
|
||||
.. versionadded:: 20.0
|
||||
join_to_send_messages (:obj:`bool`): Optional. :obj:`True`, if users need to join
|
||||
the supergroup before they can send messages.
|
||||
|
||||
.. versionadded:: 20.0
|
||||
join_by_request (:obj:`bool`): Optional. :obj:`True`, if all users directly joining the
|
||||
supergroup without using an invite link need to be approved by supergroup
|
||||
administrators.
|
||||
|
||||
.. versionadded:: 20.0
|
||||
description (:obj:`str`): Optional. Description, for groups, supergroups and channel chats.
|
||||
invite_link (:obj:`str`): Optional. Primary invite link, for groups, supergroups and
|
||||
channel.
|
||||
pinned_message (:class:`telegram.Message`): Optional. The most recent pinned message
|
||||
(by sending date).
|
||||
permissions (:class:`telegram.ChatPermissions`): Optional. Default chat member permissions,
|
||||
for groups and supergroups.
|
||||
slow_mode_delay (:obj:`int` | :class:`datetime.timedelta`): Optional. For supergroups,
|
||||
the minimum allowed delay between consecutive messages sent by each unprivileged user.
|
||||
|
||||
.. deprecated:: v22.2
|
||||
|time-period-int-deprecated|
|
||||
unrestrict_boost_count (:obj:`int`): Optional. For supergroups, the minimum number of
|
||||
boosts that a non-administrator user needs to add in order to ignore slow mode and chat
|
||||
permissions.
|
||||
|
||||
.. versionadded:: 21.0
|
||||
message_auto_delete_time (:obj:`int` | :class:`datetime.timedelta`): Optional. The time
|
||||
after which all messages sent to the chat will be automatically deleted; in seconds.
|
||||
|
||||
@@ -383,65 +266,6 @@ class ChatFullInfo(_ChatBase):
|
||||
|
||||
.. deprecated:: v22.2
|
||||
|time-period-int-deprecated|
|
||||
has_aggressive_anti_spam_enabled (:obj:`bool`): Optional. :obj:`True`, if aggressive
|
||||
anti-spam checks are enabled in the supergroup. The field is only available to chat
|
||||
administrators.
|
||||
|
||||
.. versionadded:: 20.0
|
||||
has_hidden_members (:obj:`bool`): Optional. :obj:`True`, if non-administrators can only
|
||||
get the list of bots and administrators in the chat.
|
||||
|
||||
.. versionadded:: 20.0
|
||||
has_protected_content (:obj:`bool`): Optional. :obj:`True`, if messages from the chat can't
|
||||
be forwarded to other chats.
|
||||
|
||||
.. versionadded:: 13.9
|
||||
has_visible_history (:obj:`bool`): Optional. :obj:`True`, if new chat members will have
|
||||
access to old messages; available only to chat administrators.
|
||||
|
||||
.. versionadded:: 20.8
|
||||
sticker_set_name (:obj:`str`): Optional. For supergroups, name of Group sticker set.
|
||||
can_set_sticker_set (:obj:`bool`): Optional. :obj:`True`, if the bot can change group the
|
||||
sticker set.
|
||||
custom_emoji_sticker_set_name (:obj:`str`): Optional. For supergroups, the name of the
|
||||
group's custom emoji sticker set. Custom emoji from this set can be used by all users
|
||||
and bots in the group.
|
||||
|
||||
.. versionadded:: 21.0
|
||||
linked_chat_id (:obj:`int`): Optional. Unique identifier for the linked chat, i.e. the
|
||||
discussion group identifier for a channel and vice versa; for supergroups and channel
|
||||
chats.
|
||||
location (:class:`telegram.ChatLocation`): Optional. For supergroups, the location to which
|
||||
the supergroup is connected.
|
||||
can_send_paid_media (:obj:`bool`): Optional. :obj:`True`, if paid media messages can be
|
||||
sent or forwarded to the channel chat. The field is available only for channel chats.
|
||||
|
||||
.. versionadded:: 21.4
|
||||
is_direct_messages (:obj:`bool`): Optional. :obj:`True`, if the chat is the direct messages
|
||||
chat of a channel.
|
||||
|
||||
.. versionadded:: 22.4
|
||||
parent_chat (:obj:`telegram.Chat`): Optional. Information about the corresponding channel
|
||||
chat; for direct messages chats only.
|
||||
|
||||
.. versionadded:: 22.4
|
||||
rating (:class:`telegram.UserRating`): Optional. For private chats, the rating of the user
|
||||
if any.
|
||||
|
||||
.. versionadded:: 22.6
|
||||
unique_gift_colors (:class:`telegram.UniqueGiftColors`): Optional. The color scheme based
|
||||
on a unique gift that must be used for the chat's name, message replies and link
|
||||
previews
|
||||
|
||||
.. versionadded:: 22.6
|
||||
paid_message_star_count (:obj:`int`): Optional. The number of Telegram Stars a general user
|
||||
have to pay to send a message to the chat
|
||||
|
||||
.. versionadded:: 22.6
|
||||
first_profile_audio (:obj:`telegram.Audio`): Optional. For private chats, the first audio
|
||||
added to the profile of the user.
|
||||
|
||||
.. versionadded:: 22.7
|
||||
|
||||
.. _accent colors: https://core.telegram.org/bots/api#accent-colors
|
||||
.. _topics: https://telegram.org/blog/topics-in-groups-collectible-usernames#topics-in-groups
|
||||
|
||||
@@ -89,32 +89,6 @@ class ChatInviteLink(TelegramObject):
|
||||
.. versionadded:: 21.5
|
||||
|
||||
Attributes:
|
||||
invite_link (:obj:`str`): The invite link. If the link was created by another chat
|
||||
administrator, then the second part of the link will be replaced with ``'…'``.
|
||||
creator (:class:`telegram.User`): Creator of the link.
|
||||
creates_join_request (:obj:`bool`): :obj:`True`, if users joining the chat via
|
||||
the link need to be approved by chat administrators.
|
||||
|
||||
.. versionadded:: 13.8
|
||||
is_primary (:obj:`bool`): :obj:`True`, if the link is primary.
|
||||
is_revoked (:obj:`bool`): :obj:`True`, if the link is revoked.
|
||||
expire_date (:class:`datetime.datetime`): Optional. Date when the link will expire or
|
||||
has been expired.
|
||||
|
||||
.. versionchanged:: 20.3
|
||||
|datetime_localization|
|
||||
member_limit (:obj:`int`): Optional. Maximum number of users that can be members
|
||||
of the chat simultaneously after joining the chat via this invite link;
|
||||
:tg-const:`telegram.constants.ChatInviteLinkLimit.MIN_MEMBER_LIMIT`-
|
||||
:tg-const:`telegram.constants.ChatInviteLinkLimit.MAX_MEMBER_LIMIT`.
|
||||
name (:obj:`str`): Optional. Invite link name.
|
||||
0-:tg-const:`telegram.constants.ChatInviteLinkLimit.NAME_LENGTH` characters.
|
||||
|
||||
.. versionadded:: 13.8
|
||||
pending_join_request_count (:obj:`int`): Optional. Number of pending join requests
|
||||
created using this link.
|
||||
|
||||
.. versionadded:: 13.8
|
||||
subscription_period (:obj:`int` | :class:`datetime.timedelta`): Optional. The number of
|
||||
seconds the subscription will be active for before the next payment.
|
||||
|
||||
@@ -122,12 +96,6 @@ class ChatInviteLink(TelegramObject):
|
||||
|
||||
.. deprecated:: v22.2
|
||||
|time-period-int-deprecated|
|
||||
subscription_price (:obj:`int`): Optional. The amount of Telegram Stars a user must pay
|
||||
initially and after each subsequent subscription period to be a member of the chat
|
||||
using the link.
|
||||
|
||||
.. versionadded:: 21.5
|
||||
|
||||
"""
|
||||
|
||||
__slots__ = (
|
||||
|
||||
@@ -62,10 +62,7 @@ class ChatJoinRequest(TelegramObject):
|
||||
.. versionchanged:: 20.3
|
||||
|datetime_localization|
|
||||
user_chat_id (:obj:`int`): Identifier of a private chat with the user who sent the join
|
||||
request. This number may have more than 32 significant bits and some programming
|
||||
languages may have difficulty/silent defects in interpreting it. But it has at most 52
|
||||
significant bits, so a 64-bit integer or double-precision float type are safe for
|
||||
storing this identifier. The bot can use this identifier for 5 minutes to send messages
|
||||
request. The bot can use this identifier for 5 minutes to send messages
|
||||
until the join request is processed, assuming no other administrator contacted the
|
||||
user.
|
||||
|
||||
@@ -75,28 +72,12 @@ class ChatJoinRequest(TelegramObject):
|
||||
by the user to send the join request.
|
||||
|
||||
Attributes:
|
||||
chat (:class:`telegram.Chat`): Chat to which the request was sent.
|
||||
from_user (:class:`telegram.User`): User that sent the join request.
|
||||
date (:class:`datetime.datetime`): Date the request was sent.
|
||||
|
||||
.. versionchanged:: 20.3
|
||||
|datetime_localization|
|
||||
user_chat_id (:obj:`int`): Identifier of a private chat with the user who sent the join
|
||||
request. This number may have more than 32 significant bits and some programming
|
||||
languages may have difficulty/silent defects in interpreting it. But it has at most 52
|
||||
significant bits, so a 64-bit integer or double-precision float type are safe for
|
||||
storing this identifier. The bot can use this identifier for 5 minutes to send messages
|
||||
until the join request is processed, assuming no other administrator contacted the
|
||||
user.
|
||||
|
||||
.. versionadded:: 20.1
|
||||
bio (:obj:`str`): Optional. Bio of the user.
|
||||
invite_link (:class:`telegram.ChatInviteLink`): Optional. Chat invite link that was used
|
||||
by the user to send the join request.
|
||||
|
||||
Note:
|
||||
When a user joins a *public* group via an invite link, this attribute may not
|
||||
be present. However, this behavior is undocument and may be subject to change.
|
||||
be present. However, this behavior is undocumented and may be subject to change.
|
||||
See `this GitHub thread <https://github.com/tdlib/telegram-bot-api/issues/428>`_
|
||||
for some discussion.
|
||||
|
||||
|
||||
@@ -42,13 +42,6 @@ class ChatLocation(TelegramObject):
|
||||
address (:obj:`str`): Location address;
|
||||
:tg-const:`telegram.ChatLocation.MIN_ADDRESS`-
|
||||
:tg-const:`telegram.ChatLocation.MAX_ADDRESS` characters, as defined by the chat owner.
|
||||
Attributes:
|
||||
location (:class:`telegram.Location`): The location to which the supergroup is connected.
|
||||
Can't be a live location.
|
||||
address (:obj:`str`): Location address;
|
||||
:tg-const:`telegram.ChatLocation.MIN_ADDRESS`-
|
||||
:tg-const:`telegram.ChatLocation.MAX_ADDRESS` characters, as defined by the chat owner.
|
||||
|
||||
"""
|
||||
|
||||
__slots__ = ("address", "location")
|
||||
|
||||
+14
-148
@@ -65,14 +65,6 @@ class ChatMember(TelegramObject):
|
||||
:attr:`~telegram.ChatMember.ADMINISTRATOR`, :attr:`~telegram.ChatMember.OWNER`,
|
||||
:attr:`~telegram.ChatMember.BANNED`, :attr:`~telegram.ChatMember.LEFT`,
|
||||
:attr:`~telegram.ChatMember.MEMBER` or :attr:`~telegram.ChatMember.RESTRICTED`.
|
||||
|
||||
Attributes:
|
||||
user (:class:`telegram.User`): Information about the user.
|
||||
status (:obj:`str`): The member's status in the chat. Can be
|
||||
:attr:`~telegram.ChatMember.ADMINISTRATOR`, :attr:`~telegram.ChatMember.OWNER`,
|
||||
:attr:`~telegram.ChatMember.BANNED`, :attr:`~telegram.ChatMember.LEFT`,
|
||||
:attr:`~telegram.ChatMember.MEMBER` or :attr:`~telegram.ChatMember.RESTRICTED`.
|
||||
|
||||
"""
|
||||
|
||||
__slots__ = ("status", "user")
|
||||
@@ -155,11 +147,6 @@ class ChatMemberOwner(ChatMember):
|
||||
Attributes:
|
||||
status (:obj:`str`): The member's status in the chat,
|
||||
always :tg-const:`telegram.ChatMember.OWNER`.
|
||||
user (:class:`telegram.User`): Information about the user.
|
||||
is_anonymous (:obj:`bool`): :obj:`True`, if the user's
|
||||
presence in the chat is hidden.
|
||||
custom_title (:obj:`str`): Optional. Custom title for
|
||||
this user.
|
||||
"""
|
||||
|
||||
__slots__ = ("custom_title", "is_anonymous")
|
||||
@@ -266,71 +253,6 @@ class ChatMemberAdministrator(ChatMember):
|
||||
Attributes:
|
||||
status (:obj:`str`): The member's status in the chat,
|
||||
always :tg-const:`telegram.ChatMember.ADMINISTRATOR`.
|
||||
user (:class:`telegram.User`): Information about the user.
|
||||
can_be_edited (:obj:`bool`): :obj:`True`, if the bot
|
||||
is allowed to edit administrator privileges of that user.
|
||||
is_anonymous (:obj:`bool`): :obj:`True`, if the user's
|
||||
presence in the chat is hidden.
|
||||
can_manage_chat (:obj:`bool`): :obj:`True`, if the administrator can access the chat event
|
||||
log, get boost list, see hidden supergroup and channel members, report spam messages
|
||||
and ignore slow mode. Implied by any other administrator privilege.
|
||||
can_delete_messages (:obj:`bool`): :obj:`True`, if the
|
||||
administrator can delete messages of other users.
|
||||
can_manage_video_chats (:obj:`bool`): :obj:`True`, if the
|
||||
administrator can manage video chats.
|
||||
|
||||
.. versionadded:: 20.0
|
||||
can_restrict_members (:obj:`bool`): :obj:`True`, if the
|
||||
administrator can restrict, ban or unban chat members, or access supergroup statistics.
|
||||
can_promote_members (:obj:`bool`): :obj:`True`, if the administrator can add new
|
||||
administrators with a subset of their own privileges or demote administrators
|
||||
that they have promoted, directly or indirectly (promoted by administrators that
|
||||
were appointed by the user).
|
||||
can_change_info (:obj:`bool`): :obj:`True`, if the user can change
|
||||
the chat title, photo and other settings.
|
||||
can_invite_users (:obj:`bool`): :obj:`True`, if the user can invite
|
||||
new users to the chat.
|
||||
can_post_messages (:obj:`bool`): Optional. :obj:`True`, if the
|
||||
administrator can post messages in the channel or access channel statistics;
|
||||
for channels only.
|
||||
can_edit_messages (:obj:`bool`): Optional. :obj:`True`, if the
|
||||
administrator can edit messages of other users and can pin
|
||||
messages; for channels only.
|
||||
can_pin_messages (:obj:`bool`): Optional. :obj:`True`, if the user is allowed
|
||||
to pin messages; for groups and supergroups only.
|
||||
can_post_stories (:obj:`bool`): :obj:`True`, if the administrator can post
|
||||
stories to the chat.
|
||||
|
||||
.. versionadded:: 20.6
|
||||
.. versionchanged:: 21.0
|
||||
|non_optional_story_argument|
|
||||
can_edit_stories (:obj:`bool`): :obj:`True`, if the administrator can edit stories posted
|
||||
by other users, post stories to the chat page, pin chat stories, and access the chat's
|
||||
story archive
|
||||
|
||||
.. versionadded:: 20.6
|
||||
.. versionchanged:: 21.0
|
||||
|non_optional_story_argument|
|
||||
can_delete_stories (:obj:`bool`): :obj:`True`, if the administrator can delete
|
||||
stories posted by other users.
|
||||
|
||||
.. versionadded:: 20.6
|
||||
.. versionchanged:: 21.0
|
||||
|non_optional_story_argument|
|
||||
can_manage_topics (:obj:`bool`): Optional. :obj:`True`, if the user is allowed
|
||||
to create, rename, close, and reopen forum topics; for supergroups only
|
||||
|
||||
.. versionadded:: 20.0
|
||||
custom_title (:obj:`str`): Optional. Custom title for this user.
|
||||
can_manage_direct_messages (:obj:`bool`): Optional. :obj:`True`, if the administrator can
|
||||
manage direct messages of the channel and decline suggested posts; for channels only.
|
||||
|
||||
.. versionadded:: 22.4
|
||||
can_manage_tags (:obj:`bool`): Optional. :obj:`True`, if the administrator can edit the
|
||||
tags of regular members; for groups and supergroups only. If omitted defaults to the
|
||||
value of :attr:`can_pin_messages`.
|
||||
|
||||
.. versionadded:: 22.7
|
||||
"""
|
||||
|
||||
__slots__ = (
|
||||
@@ -424,15 +346,6 @@ class ChatMemberMember(ChatMember):
|
||||
Attributes:
|
||||
status (:obj:`str`): The member's status in the chat,
|
||||
always :tg-const:`telegram.ChatMember.MEMBER`.
|
||||
user (:class:`telegram.User`): Information about the user.
|
||||
until_date (:class:`datetime.datetime`): Optional. Date when the user's subscription will
|
||||
expire.
|
||||
|
||||
.. versionadded:: 21.5
|
||||
tag (:obj:`str`): Optional. Tag of the member.
|
||||
|
||||
.. versionadded:: 22.7
|
||||
|
||||
"""
|
||||
|
||||
__slots__ = (
|
||||
@@ -515,8 +428,13 @@ class ChatMemberRestricted(ChatMember):
|
||||
|
||||
.. versionadded:: 20.1
|
||||
can_edit_tag (:obj:`bool`): :obj:`True`, if the user is allowed to edit their own tag.
|
||||
If omitted, defaults to the value of :attr:`can_pin_messages`.
|
||||
|
||||
.. versionadded:: 22.7
|
||||
can_react_to_messages (:obj:`bool`): :obj:`True`, if the user is allowed to react to
|
||||
messages.
|
||||
|
||||
.. versionadded:: 22.8
|
||||
tag (:obj:`str`, optional): Tag of the member.
|
||||
|
||||
.. versionadded:: 22.7
|
||||
@@ -524,59 +442,6 @@ class ChatMemberRestricted(ChatMember):
|
||||
Attributes:
|
||||
status (:obj:`str`): The member's status in the chat,
|
||||
always :tg-const:`telegram.ChatMember.RESTRICTED`.
|
||||
user (:class:`telegram.User`): Information about the user.
|
||||
is_member (:obj:`bool`): :obj:`True`, if the user is a
|
||||
member of the chat at the moment of the request.
|
||||
can_change_info (:obj:`bool`): :obj:`True`, if the user can change
|
||||
the chat title, photo and other settings.
|
||||
can_invite_users (:obj:`bool`): :obj:`True`, if the user can invite
|
||||
new users to the chat.
|
||||
can_pin_messages (:obj:`bool`): :obj:`True`, if the user is allowed
|
||||
to pin messages; groups and supergroups only.
|
||||
can_send_messages (:obj:`bool`): :obj:`True`, if the user is allowed
|
||||
to send text messages, contacts, locations and venues.
|
||||
can_send_polls (:obj:`bool`): :obj:`True`, if the user is allowed
|
||||
to send polls.
|
||||
can_send_other_messages (:obj:`bool`): :obj:`True`, if the user is allowed
|
||||
to send animations, games, stickers and use inline bots.
|
||||
can_add_web_page_previews (:obj:`bool`): :obj:`True`, if the user is
|
||||
allowed to add web page previews to their messages.
|
||||
can_manage_topics (:obj:`bool`): :obj:`True`, if the user is allowed to create
|
||||
forum topics.
|
||||
|
||||
.. versionadded:: 20.0
|
||||
until_date (:class:`datetime.datetime`): Date when restrictions
|
||||
will be lifted for this user.
|
||||
|
||||
.. versionchanged:: 20.3
|
||||
|datetime_localization|
|
||||
can_send_audios (:obj:`bool`): :obj:`True`, if the user is allowed to send audios.
|
||||
|
||||
.. versionadded:: 20.1
|
||||
can_send_documents (:obj:`bool`): :obj:`True`, if the user is allowed to send documents.
|
||||
|
||||
.. versionadded:: 20.1
|
||||
can_send_photos (:obj:`bool`): :obj:`True`, if the user is allowed to send photos.
|
||||
|
||||
.. versionadded:: 20.1
|
||||
can_send_videos (:obj:`bool`): :obj:`True`, if the user is allowed to send videos.
|
||||
|
||||
.. versionadded:: 20.1
|
||||
can_send_video_notes (:obj:`bool`): :obj:`True`, if the user is allowed to send video
|
||||
notes.
|
||||
|
||||
.. versionadded:: 20.1
|
||||
can_send_voice_notes (:obj:`bool`): :obj:`True`, if the user is allowed to send voice
|
||||
notes.
|
||||
|
||||
.. versionadded:: 20.1
|
||||
can_edit_tag (:obj:`bool`): :obj:`True`, if the user is allowed to edit their own tag.
|
||||
|
||||
.. versionadded:: 22.7
|
||||
tag (:obj:`str`): Optional. Tag of the member.
|
||||
|
||||
.. versionadded:: 22.7
|
||||
|
||||
"""
|
||||
|
||||
__slots__ = (
|
||||
@@ -586,6 +451,7 @@ class ChatMemberRestricted(ChatMember):
|
||||
"can_invite_users",
|
||||
"can_manage_topics",
|
||||
"can_pin_messages",
|
||||
"can_react_to_messages",
|
||||
"can_send_audios",
|
||||
"can_send_documents",
|
||||
"can_send_messages",
|
||||
@@ -621,10 +487,17 @@ class ChatMemberRestricted(ChatMember):
|
||||
can_send_voice_notes: bool,
|
||||
can_edit_tag: bool,
|
||||
tag: str | None = None,
|
||||
# tags: 22.8
|
||||
# temporarily optional to make it not breaking
|
||||
can_react_to_messages: bool | None = None,
|
||||
*,
|
||||
api_kwargs: JSONDict | None = None,
|
||||
):
|
||||
super().__init__(status=ChatMember.RESTRICTED, user=user, api_kwargs=api_kwargs)
|
||||
|
||||
if can_react_to_messages is None:
|
||||
raise TypeError("`can_react_to_messages` is required and cannot be None")
|
||||
|
||||
with self._unfrozen():
|
||||
self.is_member: bool = is_member
|
||||
self.can_change_info: bool = can_change_info
|
||||
@@ -643,6 +516,7 @@ class ChatMemberRestricted(ChatMember):
|
||||
self.can_send_video_notes: bool = can_send_video_notes
|
||||
self.can_send_voice_notes: bool = can_send_voice_notes
|
||||
self.can_edit_tag: bool = can_edit_tag
|
||||
self.can_react_to_messages: bool = can_react_to_messages
|
||||
self.tag: str | None = tag
|
||||
|
||||
|
||||
@@ -659,7 +533,6 @@ class ChatMemberLeft(ChatMember):
|
||||
Attributes:
|
||||
status (:obj:`str`): The member's status in the chat,
|
||||
always :tg-const:`telegram.ChatMember.LEFT`.
|
||||
user (:class:`telegram.User`): Information about the user.
|
||||
"""
|
||||
|
||||
__slots__ = ()
|
||||
@@ -692,13 +565,6 @@ class ChatMemberBanned(ChatMember):
|
||||
Attributes:
|
||||
status (:obj:`str`): The member's status in the chat,
|
||||
always :tg-const:`telegram.ChatMember.BANNED`.
|
||||
user (:class:`telegram.User`): Information about the user.
|
||||
until_date (:class:`datetime.datetime`): Date when restrictions
|
||||
will be lifted for this user.
|
||||
|
||||
.. versionchanged:: 20.3
|
||||
|datetime_localization|
|
||||
|
||||
"""
|
||||
|
||||
__slots__ = ("until_date",)
|
||||
|
||||
@@ -70,29 +70,6 @@ class ChatMemberUpdated(TelegramObject):
|
||||
an administrator
|
||||
|
||||
.. versionadded:: 21.2
|
||||
|
||||
Attributes:
|
||||
chat (:class:`telegram.Chat`): Chat the user belongs to.
|
||||
from_user (:class:`telegram.User`): Performer of the action, which resulted in the change.
|
||||
date (:class:`datetime.datetime`): Date the change was done in Unix time. Converted to
|
||||
:class:`datetime.datetime`.
|
||||
|
||||
.. versionchanged:: 20.3
|
||||
|datetime_localization|
|
||||
old_chat_member (:class:`telegram.ChatMember`): Previous information about the chat member.
|
||||
new_chat_member (:class:`telegram.ChatMember`): New information about the chat member.
|
||||
invite_link (:class:`telegram.ChatInviteLink`): Optional. Chat invite link, which was used
|
||||
by the user to join the chat. For joining by invite link events only.
|
||||
via_chat_folder_invite_link (:obj:`bool`): Optional. :obj:`True`, if the user joined the
|
||||
chat via a chat folder invite link
|
||||
|
||||
.. versionadded:: 20.3
|
||||
via_join_request (:obj:`bool`): Optional. :obj:`True`, if the user joined the chat after
|
||||
sending a direct join request without using an invite link and being approved
|
||||
by an administrator
|
||||
|
||||
.. versionadded:: 21.2
|
||||
|
||||
"""
|
||||
|
||||
__slots__ = (
|
||||
|
||||
@@ -39,10 +39,6 @@ class ChatOwnerChanged(TelegramObject):
|
||||
|
||||
Args:
|
||||
new_owner (:class:`telegram.User`): The new owner of the chat
|
||||
|
||||
Attributes:
|
||||
new_owner (:class:`telegram.User`): The new owner of the chat
|
||||
|
||||
"""
|
||||
|
||||
__slots__ = ("new_owner",)
|
||||
@@ -79,13 +75,8 @@ class ChatOwnerLeft(TelegramObject):
|
||||
.. versionadded:: 22.7
|
||||
|
||||
Args:
|
||||
new_owner (:class:`telegram.User`, optional): The user which will be the new owner of the
|
||||
new_owner (:class:`telegram.User`, optional): The user who will become the new owner of the
|
||||
chat if the previous owner does not return to the chat
|
||||
|
||||
Attributes:
|
||||
new_owner (:class:`telegram.User`): Optional. The user which will be the new owner of the
|
||||
chat if the previous owner does not return to the chat
|
||||
|
||||
"""
|
||||
|
||||
__slots__ = ("new_owner",)
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user