mirror of
https://github.com/python-telegram-bot/python-telegram-bot.git
synced 2026-06-19 23:55:29 +00:00
Compare commits
18 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 132a3b203d | |||
| debe86aea2 | |||
| 7a7465e8e2 | |||
| 977c54e693 | |||
| a769861b32 | |||
| 0a00a821cb | |||
| ef2a0527fe | |||
| 92cb6f3ae8 | |||
| a35ecf4065 | |||
| ade1529986 | |||
| e6d9f3d057 | |||
| 98bf378c6e | |||
| c4b413ef9e | |||
| a9dd2b1746 | |||
| cb95868c4a | |||
| 2f6c4075c8 | |||
| c53dc7dae4 | |||
| 8b3ea5ce56 |
@@ -9,9 +9,9 @@ body:
|
||||
value: |
|
||||
Hey there, you have a question? We are happy to answer. Please make sure no similar question was opened already.
|
||||
|
||||
To make it easier for us to help you, please read this [article](https://git.io/JURJO).
|
||||
To make it easier for us to help you, please read this [article](https://github.com/python-telegram-bot/python-telegram-bot/wiki/Ask-Right).
|
||||
|
||||
Please mind that there is also a users' [Telegram group](https://t.me/pythontelegrambotgroup) for questions about the library. Questions asked there might be answered quicker than here. Moreover, [GitHub Discussions](https://git.io/JG3rk) offer a slightly better format to discuss usage questions.
|
||||
Please mind that there is also a users' [Telegram group](https://t.me/pythontelegrambotgroup) for questions about the library. Questions asked there might be answered quicker than here. Moreover, [GitHub Discussions](https://github.com/python-telegram-bot/python-telegram-bot/discussions) offer a slightly better format to discuss usage questions.
|
||||
|
||||
- type: textarea
|
||||
id: issue-faced
|
||||
|
||||
@@ -7,6 +7,7 @@ Hey! You're PRing? Cool! Please have a look at the below checklist. It's here to
|
||||
- [ ] Added `.. versionadded:: version`, `.. versionchanged:: version` or `.. deprecated:: version` to the docstrings for user facing changes (for methods/class descriptions, arguments and attributes)
|
||||
- [ ] Created new or adapted existing unit tests
|
||||
- [ ] Added myself alphabetically to `AUTHORS.rst` (optional)
|
||||
- [ ] Added new classes & modules to the docs
|
||||
|
||||
|
||||
### If the PR contains API changes (otherwise, you can delete this passage)
|
||||
|
||||
@@ -12,7 +12,7 @@ jobs:
|
||||
- uses: dessant/lock-threads@v2.0.1
|
||||
with:
|
||||
github-token: ${{ github.token }}
|
||||
issue-lock-inactive-days: '1'
|
||||
issue-lock-inactive-days: '7'
|
||||
issue-lock-reason: ''
|
||||
pr-lock-inactive-days: '1'
|
||||
pr-lock-inactive-days: '7'
|
||||
pr-lock-reason: ''
|
||||
|
||||
@@ -3,9 +3,11 @@ on:
|
||||
pull_request:
|
||||
branches:
|
||||
- master
|
||||
- v13.x
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
- v13.x
|
||||
|
||||
jobs:
|
||||
pytest:
|
||||
@@ -13,7 +15,7 @@ jobs:
|
||||
runs-on: ${{matrix.os}}
|
||||
strategy:
|
||||
matrix:
|
||||
python-version: [3.6, 3.7, 3.8, 3.9]
|
||||
python-version: [3.7, 3.8, 3.9]
|
||||
os: [ubuntu-latest, windows-latest, macos-latest]
|
||||
fail-fast: False
|
||||
steps:
|
||||
@@ -94,27 +96,3 @@ jobs:
|
||||
env:
|
||||
TEST_OFFICIAL: "true"
|
||||
shell: bash --noprofile --norc {0}
|
||||
test_pre_commit:
|
||||
name: test-pre-commit
|
||||
runs-on: ${{matrix.os}}
|
||||
strategy:
|
||||
matrix:
|
||||
python-version: [3.7]
|
||||
os: [ubuntu-latest]
|
||||
fail-fast: False
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Initialize vendored libs
|
||||
run:
|
||||
git submodule update --init --recursive
|
||||
- name: Set up Python ${{ matrix.python-version }}
|
||||
uses: actions/setup-python@v2
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
python -W ignore -m pip install --upgrade pip
|
||||
python -W ignore -m pip install -r requirements.txt
|
||||
python -W ignore -m pip install -r requirements-dev.txt
|
||||
- name: Run pre-commit tests
|
||||
run: pre-commit run --all-files
|
||||
|
||||
@@ -1,9 +1,14 @@
|
||||
# Make sure that
|
||||
# * the revs specified here match requirements-dev.txt
|
||||
# * the additional_dependencies here match requirements.txt
|
||||
|
||||
ci:
|
||||
# We currently only need this behavior on the v13.x branch were we have the vendored urllib
|
||||
submodules: true
|
||||
|
||||
repos:
|
||||
- repo: https://github.com/psf/black
|
||||
rev: 20.8b1
|
||||
rev: 22.3.0
|
||||
hooks:
|
||||
- id: black
|
||||
args:
|
||||
|
||||
+95
-2
@@ -2,6 +2,99 @@
|
||||
Changelog
|
||||
=========
|
||||
|
||||
Version 13.13
|
||||
=============
|
||||
*Released 2022-06-28*
|
||||
|
||||
This is the technical changelog for version 13.13. More elaborate release notes can be found in the news channel `@pythontelegrambotchannel <https://t.me/pythontelegrambotchannel>`_.
|
||||
|
||||
**Major Changes:**
|
||||
|
||||
- Full Support for API 6.1 (`#3117`_)
|
||||
|
||||
.. _`#3117`: https://github.com/python-telegram-bot/python-telegram-bot/pull/3117
|
||||
|
||||
Version 13.12
|
||||
=============
|
||||
*Released 2022-05-26*
|
||||
|
||||
This is the technical changelog for version 13.12. More elaborate release notes can be found in the news channel `@pythontelegrambotchannel <https://t.me/pythontelegrambotchannel>`_.
|
||||
|
||||
**Breaking changes:**
|
||||
|
||||
- Drop support for python 3.6
|
||||
|
||||
**Major Changes:**
|
||||
|
||||
- Full Support for API 6.0 (`#3027`_)
|
||||
|
||||
**Minor Changes:**
|
||||
|
||||
- Documentation Improvements (`#3029`_)
|
||||
|
||||
.. _`#3027`: https://github.com/python-telegram-bot/python-telegram-bot/pull/3027
|
||||
.. _`#3029`: https://github.com/python-telegram-bot/python-telegram-bot/pull/3029
|
||||
|
||||
Version 13.11
|
||||
=============
|
||||
*Released 2022-02-02*
|
||||
|
||||
This is the technical changelog for version 13.11. More elaborate release notes can be found in the news channel `@pythontelegrambotchannel <https://t.me/pythontelegrambotchannel>`_.
|
||||
|
||||
**Major Changes:**
|
||||
|
||||
- Full Support for Bot API 5.7 (`#2881`_)
|
||||
|
||||
.. _`#2881`: https://github.com/python-telegram-bot/python-telegram-bot/pull/2881
|
||||
|
||||
Version 13.10
|
||||
=============
|
||||
*Released 2022-01-03*
|
||||
|
||||
This is the technical changelog for version 13.10. More elaborate release notes can be found in the news channel `@pythontelegrambotchannel <https://t.me/pythontelegrambotchannel>`_.
|
||||
|
||||
**Major Changes:**
|
||||
|
||||
- Full Support for API 5.6 (`#2835`_)
|
||||
|
||||
**Minor Changes & Doc fixes:**
|
||||
|
||||
- Update Copyright to 2022 (`#2836`_)
|
||||
- Update Documentation of ``BotCommand`` (`#2820`_)
|
||||
|
||||
.. _`#2835`: https://github.com/python-telegram-bot/python-telegram-bot/pull/2835
|
||||
.. _`#2836`: https://github.com/python-telegram-bot/python-telegram-bot/pull/2836
|
||||
.. _`#2820`: https://github.com/python-telegram-bot/python-telegram-bot/pull/2820
|
||||
|
||||
Version 13.9
|
||||
============
|
||||
*Released 2021-12-11*
|
||||
|
||||
This is the technical changelog for version 13.9. More elaborate release notes can be found in the news channel `@pythontelegrambotchannel <https://t.me/pythontelegrambotchannel>`_.
|
||||
|
||||
**Major Changes:**
|
||||
|
||||
- Full Support for Api 5.5 (`#2809`_)
|
||||
|
||||
**Minor Changes**
|
||||
|
||||
- Adjust Automated Locking of Inactive Issues (`#2775`_)
|
||||
|
||||
.. _`#2809`: https://github.com/python-telegram-bot/python-telegram-bot/pull/2809
|
||||
.. _`#2775`: https://github.com/python-telegram-bot/python-telegram-bot/pull/2775
|
||||
|
||||
Version 13.8.1
|
||||
==============
|
||||
*Released 2021-11-08*
|
||||
|
||||
This is the technical changelog for version 13.8.1. More elaborate release notes can be found in the news channel `@pythontelegrambotchannel <https://t.me/pythontelegrambotchannel>`_.
|
||||
|
||||
**Doc fixes:**
|
||||
|
||||
- Add ``ChatJoinRequest(Handler)`` to Docs (`#2771`_)
|
||||
|
||||
.. _`#2771`: https://github.com/python-telegram-bot/python-telegram-bot/pull/2771
|
||||
|
||||
Version 13.8
|
||||
============
|
||||
*Released 2021-11-08*
|
||||
@@ -835,7 +928,7 @@ Expect minor releases soon (mainly complete Bot API 4.4 support)
|
||||
- Error Handler now handles all types of exceptions (`#1485`_)
|
||||
- Return UTC from from_timestamp() (`#1485`_)
|
||||
|
||||
**See the wiki page at https://git.io/fxJuV for a detailed guide on how to migrate from version 11 to version 12.**
|
||||
**See the wiki page at https://github.com/python-telegram-bot/python-telegram-bot/wiki/Transition-guide-to-Version-12.0 for a detailed guide on how to migrate from version 11 to version 12.**
|
||||
|
||||
Context based callbacks (`#1100`_)
|
||||
----------------------------------
|
||||
@@ -1040,7 +1133,7 @@ Non Bot API 4.0 changes:
|
||||
.. _`#1172`: https://github.com/python-telegram-bot/python-telegram-bot/pull/1172
|
||||
.. _`#1179`: https://github.com/python-telegram-bot/python-telegram-bot/pull/1179
|
||||
.. _`#1184`: https://github.com/python-telegram-bot/python-telegram-bot/pull/1184
|
||||
.. _`our telegram passport wiki page`: https://git.io/fAvYd
|
||||
.. _`our telegram passport wiki page`: https://github.com/python-telegram-bot/python-telegram-bot/wiki/Telegram-Passport
|
||||
|
||||
Version 10.1.0
|
||||
==============
|
||||
|
||||
+8
-7
@@ -1,5 +1,5 @@
|
||||
..
|
||||
Make user to apply any changes to this file to README_RAW.rst as well!
|
||||
Make sure to apply any changes to this file to README_RAW.rst as well!
|
||||
|
||||
.. image:: https://github.com/python-telegram-bot/logos/blob/master/logo-text/png/ptb-logo-text_768.png?raw=true
|
||||
:align: center
|
||||
@@ -20,7 +20,7 @@ We have a vibrant community of developers helping each other in our `Telegram gr
|
||||
:target: https://pypi.org/project/python-telegram-bot/
|
||||
:alt: Supported Python versions
|
||||
|
||||
.. image:: https://img.shields.io/badge/Bot%20API-5.4-blue?logo=telegram
|
||||
.. image:: https://img.shields.io/badge/Bot%20API-6.1-blue?logo=telegram
|
||||
:target: https://core.telegram.org/bots/api-changelog
|
||||
:alt: Supported Bot API versions
|
||||
|
||||
@@ -87,19 +87,20 @@ Table of contents
|
||||
|
||||
- `License`_
|
||||
|
||||
|
||||
============
|
||||
Introduction
|
||||
============
|
||||
|
||||
This library provides a pure Python interface for the
|
||||
`Telegram Bot API <https://core.telegram.org/bots/api>`_.
|
||||
It's compatible with Python versions 3.6.8+. PTB might also work on `PyPy <http://pypy.org/>`_, though there have been a lot of issues before. Hence, PyPy is not officially supported.
|
||||
It's compatible with Python versions 3.7+. PTB might also work on `PyPy <http://pypy.org/>`_, though there have been a lot of issues before. Hence, PyPy is not officially supported.
|
||||
|
||||
In addition to the pure API implementation, this library features a number of high-level classes to
|
||||
make the development of bots easy and straightforward. These classes are contained in the
|
||||
``telegram.ext`` submodule.
|
||||
|
||||
A pure API implementation *without* ``telegram.ext`` is available as the standalone package ``python-telegram-bot-raw``. `See here for details. <https://github.com/python-telegram-bot/python-telegram-bot/blob/master/README_RAW.rst>`_
|
||||
A pure API implementation *without* ``telegram.ext`` is available as the standalone package ``python-telegram-bot-raw``. `See here for details. <https://github.com/python-telegram-bot/python-telegram-bot/blob/v13.x/README_RAW.rst>`_
|
||||
|
||||
----
|
||||
Note
|
||||
@@ -111,7 +112,7 @@ Installing both ``python-telegram-bot`` and ``python-telegram-bot-raw`` in conju
|
||||
Telegram API support
|
||||
====================
|
||||
|
||||
All types and methods of the Telegram Bot API **5.4** are supported.
|
||||
All types and methods of the Telegram Bot API **6.1** are supported.
|
||||
|
||||
==========
|
||||
Installing
|
||||
@@ -171,7 +172,7 @@ look at ``echobot.py``, it is the de facto base for most of the bots out there.
|
||||
the code for these examples are released to the public domain, so you can start by grabbing the
|
||||
code and building on top of it.
|
||||
|
||||
Visit `this page <https://github.com/python-telegram-bot/python-telegram-bot/blob/master/examples/README.md>`_ to discover the official examples or look at the examples on the `wiki <https://github.com/python-telegram-bot/python-telegram-bot/wiki/Examples>`_ to see other bots the community has built.
|
||||
Visit `this page <https://github.com/python-telegram-bot/python-telegram-bot/blob/v13.x/examples/README.md>`_ to discover the official examples or look at the examples on the `wiki <https://github.com/python-telegram-bot/python-telegram-bot/wiki/Examples>`_ to see other bots the community has built.
|
||||
|
||||
-------
|
||||
Logging
|
||||
@@ -226,7 +227,7 @@ You can get help in several ways:
|
||||
Contributing
|
||||
============
|
||||
|
||||
Contributions of all sizes are welcome. Please review our `contribution guidelines <https://github.com/python-telegram-bot/python-telegram-bot/blob/master/.github/CONTRIBUTING.rst>`_ to get started. You can also help by `reporting bugs <https://github.com/python-telegram-bot/python-telegram-bot/issues/new>`_.
|
||||
Contributions of all sizes are welcome. Please review our `contribution guidelines <https://github.com/python-telegram-bot/python-telegram-bot/blob/v13.x/.github/CONTRIBUTING.rst>`_ to get started. You can also help by `reporting bugs <https://github.com/python-telegram-bot/python-telegram-bot/issues/new>`_.
|
||||
|
||||
========
|
||||
Donating
|
||||
|
||||
+5
-5
@@ -1,5 +1,5 @@
|
||||
..
|
||||
Make user to apply any changes to this file to README.rst as well!
|
||||
Make sure to apply any changes to this file to README.rst as well!
|
||||
|
||||
.. image:: https://github.com/python-telegram-bot/logos/blob/master/logo-text/png/ptb-raw-logo-text_768.png?raw=true
|
||||
:align: center
|
||||
@@ -20,7 +20,7 @@ We have a vibrant community of developers helping each other in our `Telegram gr
|
||||
:target: https://pypi.org/project/python-telegram-bot-raw/
|
||||
:alt: Supported Python versions
|
||||
|
||||
.. image:: https://img.shields.io/badge/Bot%20API-5.4-blue?logo=telegram
|
||||
.. image:: https://img.shields.io/badge/Bot%20API-6.1-blue?logo=telegram
|
||||
:target: https://core.telegram.org/bots/api-changelog
|
||||
:alt: Supported Bot API versions
|
||||
|
||||
@@ -91,7 +91,7 @@ Introduction
|
||||
|
||||
This library provides a pure Python, lightweight interface for the
|
||||
`Telegram Bot API <https://core.telegram.org/bots/api>`_.
|
||||
It's compatible with Python versions 3.6.8+. PTB-Raw might also work on `PyPy <http://pypy.org/>`_, though there have been a lot of issues before. Hence, PyPy is not officially supported.
|
||||
It's compatible with Python versions 3.7+. PTB-Raw might also work on `PyPy <http://pypy.org/>`_, though there have been a lot of issues before. Hence, PyPy is not officially supported.
|
||||
|
||||
``python-telegram-bot-raw`` is part of the `python-telegram-bot <https://python-telegram-bot.org>`_ ecosystem and provides the pure API functionality extracted from PTB. It therefore does *not* have independent release schedules, changelogs or documentation. Please consult the PTB resources.
|
||||
|
||||
@@ -105,7 +105,7 @@ Installing both ``python-telegram-bot`` and ``python-telegram-bot-raw`` in conju
|
||||
Telegram API support
|
||||
====================
|
||||
|
||||
All types and methods of the Telegram Bot API **5.4** are supported.
|
||||
All types and methods of the Telegram Bot API **6.1** are supported.
|
||||
|
||||
==========
|
||||
Installing
|
||||
@@ -208,7 +208,7 @@ You can get help in several ways:
|
||||
Contributing
|
||||
============
|
||||
|
||||
Contributions of all sizes are welcome. Please review our `contribution guidelines <https://github.com/python-telegram-bot/python-telegram-bot/blob/master/.github/CONTRIBUTING.rst>`_ to get started. You can also help by `reporting bugs <https://github.com/python-telegram-bot/python-telegram-bot/issues/new>`_.
|
||||
Contributions of all sizes are welcome. Please review our `contribution guidelines <https://github.com/python-telegram-bot/python-telegram-bot/blob/v13.x/.github/CONTRIBUTING.rst>`_ to get started. You can also help by `reporting bugs <https://github.com/python-telegram-bot/python-telegram-bot/issues/new>`_.
|
||||
|
||||
========
|
||||
Donating
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/*
|
||||
Generated by https://darkreader.org
|
||||
Instructions: Install the extension on a Chromium-based browser
|
||||
Then do this to export the CSS: https://git.io/JOM6t and drop it here
|
||||
Then do this to export the CSS: https://github.com/darkreader/darkreader/issues/604#issuecomment-661107893 and drop it here
|
||||
Some color values where manually changed - just search for "/*" in this file and insert them in the new css
|
||||
*/
|
||||
/* User-Agent Style */
|
||||
|
||||
+2
-2
@@ -60,9 +60,9 @@ author = u'Leandro Toledo'
|
||||
# built documents.
|
||||
#
|
||||
# The short X.Y version.
|
||||
version = '13.8' # telegram.__version__[:3]
|
||||
version = '13.13' # telegram.__version__[:3]
|
||||
# The full version, including alpha/beta/rc tags.
|
||||
release = '13.8' # telegram.__version__
|
||||
release = '13.13' # telegram.__version__
|
||||
|
||||
# The language for content autogenerated by Sphinx. Refer to documentation
|
||||
# for a list of supported languages.
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
:github_url: https://github.com/python-telegram-bot/python-telegram-bot/blob/master/telegram/chatadministratorrights.py
|
||||
|
||||
telegram.ChatAdministratorRights
|
||||
================================
|
||||
|
||||
.. autoclass:: telegram.ChatAdministratorRights
|
||||
:members:
|
||||
:show-inheritance:
|
||||
@@ -0,0 +1,8 @@
|
||||
:github_url: https://github.com/python-telegram-bot/python-telegram-bot/blob/master/telegram/chatjoinrequest.py
|
||||
|
||||
telegram.ChatJoinRequest
|
||||
========================
|
||||
|
||||
.. autoclass:: telegram.ChatJoinRequest
|
||||
:members:
|
||||
:show-inheritance:
|
||||
@@ -0,0 +1,8 @@
|
||||
:github_url: https://github.com/python-telegram-bot/python-telegram-bot/blob/master/telegram/ext/chatjoinrequesthandler.py
|
||||
|
||||
telegram.ext.ChatJoinRequestHandler
|
||||
===================================
|
||||
|
||||
.. autoclass:: telegram.ext.ChatJoinRequestHandler
|
||||
:members:
|
||||
:show-inheritance:
|
||||
@@ -22,8 +22,9 @@ Handlers
|
||||
|
||||
telegram.ext.handler
|
||||
telegram.ext.callbackqueryhandler
|
||||
telegram.ext.choseninlineresulthandler
|
||||
telegram.ext.chatjoinrequesthandler
|
||||
telegram.ext.chatmemberhandler
|
||||
telegram.ext.choseninlineresulthandler
|
||||
telegram.ext.commandhandler
|
||||
telegram.ext.conversationhandler
|
||||
telegram.ext.inlinequeryhandler
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
:github_url: https://github.com/python-telegram-bot/python-telegram-bot/blob/master/telegram/menubutton.py
|
||||
|
||||
telegram.MenuButton
|
||||
===================
|
||||
|
||||
.. autoclass:: telegram.MenuButton
|
||||
:members:
|
||||
:show-inheritance:
|
||||
@@ -0,0 +1,8 @@
|
||||
:github_url: https://github.com/python-telegram-bot/python-telegram-bot/blob/master/telegram/menubutton.py
|
||||
|
||||
telegram.MenuButtonCommands
|
||||
===========================
|
||||
|
||||
.. autoclass:: telegram.MenuButtonCommands
|
||||
:members:
|
||||
:show-inheritance:
|
||||
@@ -0,0 +1,8 @@
|
||||
:github_url: https://github.com/python-telegram-bot/python-telegram-bot/blob/master/telegram/menubutton.py
|
||||
|
||||
telegram.MenuButtonDefault
|
||||
==========================
|
||||
|
||||
.. autoclass:: telegram.MenuButtonDefault
|
||||
:members:
|
||||
:show-inheritance:
|
||||
@@ -0,0 +1,8 @@
|
||||
:github_url: https://github.com/python-telegram-bot/python-telegram-bot/blob/master/telegram/menubutton.py
|
||||
|
||||
telegram.MenuButtonWebApp
|
||||
=========================
|
||||
|
||||
.. autoclass:: telegram.MenuButtonWebApp
|
||||
:members:
|
||||
:show-inheritance:
|
||||
@@ -17,8 +17,10 @@ telegram package
|
||||
telegram.botcommandscopechatmember
|
||||
telegram.callbackquery
|
||||
telegram.chat
|
||||
telegram.chatadministratorrights
|
||||
telegram.chataction
|
||||
telegram.chatinvitelink
|
||||
telegram.chatjoinrequest
|
||||
telegram.chatlocation
|
||||
telegram.chatmember
|
||||
telegram.chatmemberowner
|
||||
@@ -50,6 +52,10 @@ telegram package
|
||||
telegram.keyboardbuttonpolltype
|
||||
telegram.location
|
||||
telegram.loginurl
|
||||
telegram.menubutton
|
||||
telegram.menubuttoncommands
|
||||
telegram.menubuttondefault
|
||||
telegram.menubuttonwebapp
|
||||
telegram.message
|
||||
telegram.messageautodeletetimerchanged
|
||||
telegram.messageid
|
||||
@@ -63,18 +69,25 @@ telegram package
|
||||
telegram.replykeyboardremove
|
||||
telegram.replykeyboardmarkup
|
||||
telegram.replymarkup
|
||||
telegram.sentwebappmessage
|
||||
telegram.telegramobject
|
||||
telegram.update
|
||||
telegram.user
|
||||
telegram.userprofilephotos
|
||||
telegram.venue
|
||||
telegram.video
|
||||
telegram.videochatended
|
||||
telegram.videochatparticipantsinvited
|
||||
telegram.videochatscheduled
|
||||
telegram.videochatstarted
|
||||
telegram.videonote
|
||||
telegram.voice
|
||||
telegram.voicechatstarted
|
||||
telegram.voicechatended
|
||||
telegram.voicechatscheduled
|
||||
telegram.voicechatparticipantsinvited
|
||||
telegram.webappdata
|
||||
telegram.webappinfo
|
||||
telegram.webhookinfo
|
||||
|
||||
Stickers
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
:github_url: https://github.com/python-telegram-bot/python-telegram-bot/blob/master/telegram/sentwebappmessage.py
|
||||
|
||||
telegram.SentWebAppMessage
|
||||
==========================
|
||||
|
||||
.. autoclass:: telegram.SentWebAppMessage
|
||||
:members:
|
||||
:show-inheritance:
|
||||
@@ -0,0 +1,9 @@
|
||||
:github_url: https://github.com/python-telegram-bot/python-telegram-bot/blob/master/telegram/videochatended.py
|
||||
|
||||
telegram.VideoChatEnded
|
||||
=======================
|
||||
|
||||
.. autoclass:: telegram.VideoChatEnded
|
||||
:members:
|
||||
:show-inheritance:
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
:github_url: https://github.com/python-telegram-bot/python-telegram-bot/blob/master/telegram/videochatparticipantsinvited.py
|
||||
|
||||
telegram.VideoChatParticipantsInvited
|
||||
=====================================
|
||||
|
||||
.. autoclass:: telegram.VideoChatParticipantsInvited
|
||||
:members:
|
||||
:show-inheritance:
|
||||
@@ -0,0 +1,8 @@
|
||||
:github_url: https://github.com/python-telegram-bot/python-telegram-bot/blob/master/telegram/videochatscheduled.py
|
||||
|
||||
telegram.VideoChatScheduled
|
||||
===========================
|
||||
|
||||
.. autoclass:: telegram.VideoChatScheduled
|
||||
:members:
|
||||
:show-inheritance:
|
||||
@@ -0,0 +1,8 @@
|
||||
:github_url: https://github.com/python-telegram-bot/python-telegram-bot/blob/master/telegram/videochatstarted.py
|
||||
|
||||
telegram.VideoChatStarted
|
||||
=========================
|
||||
|
||||
.. autoclass:: telegram.VideoChatStarted
|
||||
:members:
|
||||
:show-inheritance:
|
||||
@@ -7,3 +7,5 @@ telegram.VoiceChatEnded
|
||||
:members:
|
||||
:show-inheritance:
|
||||
|
||||
.. versionchanged:: v13.12
|
||||
Since Bot API 6.0, voice chat was renamed to video chat.
|
||||
|
||||
@@ -7,3 +7,5 @@ telegram.VoiceChatParticipantsInvited
|
||||
:members:
|
||||
:show-inheritance:
|
||||
|
||||
.. versionchanged:: v13.12
|
||||
Since Bot API 6.0, voice chat was renamed to video chat.
|
||||
|
||||
@@ -7,3 +7,5 @@ telegram.VoiceChatScheduled
|
||||
:members:
|
||||
:show-inheritance:
|
||||
|
||||
.. versionchanged:: v13.12
|
||||
Since Bot API 6.0, voice chat was renamed to video chat.
|
||||
|
||||
@@ -7,3 +7,5 @@ telegram.VoiceChatStarted
|
||||
:members:
|
||||
:show-inheritance:
|
||||
|
||||
.. versionchanged:: v13.12
|
||||
Since Bot API 6.0, voice chat was renamed to video chat.
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
:github_url: https://github.com/python-telegram-bot/python-telegram-bot/blob/master/telegram/webappdata.py
|
||||
|
||||
telegram.WebAppData
|
||||
===================
|
||||
|
||||
.. autoclass:: telegram.WebAppData
|
||||
:members:
|
||||
:show-inheritance:
|
||||
@@ -0,0 +1,8 @@
|
||||
:github_url: https://github.com/python-telegram-bot/python-telegram-bot/blob/master/telegram/webappinfo.py
|
||||
|
||||
telegram.WebAppInfo
|
||||
===================
|
||||
|
||||
.. autoclass:: telegram.WebAppInfo
|
||||
:members:
|
||||
:show-inheritance:
|
||||
+24
-24
@@ -2,60 +2,60 @@
|
||||
|
||||
In this folder are small examples to show what a bot written with `python-telegram-bot` looks like. Some bots focus on one specific aspect of the Telegram Bot API while others focus on one of the mechanics of this library. Except for the [`rawapibot.py`](#pure-api) example, they all use the high-level framework this library provides with the [`telegram.ext`](https://python-telegram-bot.readthedocs.io/en/latest/telegram.ext.html) submodule.
|
||||
|
||||
All examples are licensed under the [CC0 License](https://github.com/python-telegram-bot/python-telegram-bot/blob/master/examples/LICENSE.txt) and are therefore fully dedicated to the public domain. You can use them as the base for your own bots without worrying about copyrights.
|
||||
All examples are licensed under the [CC0 License](https://github.com/python-telegram-bot/python-telegram-bot/blob/v13.x/examples/LICENSE.txt) and are therefore fully dedicated to the public domain. You can use them as the base for your own bots without worrying about copyrights.
|
||||
|
||||
Do note that we ignore one pythonic convention. Best practice would dictate, in many handler callbacks function signatures, to replace the argument `context` with an underscore, since `context` is an unused local variable in those callbacks. However, since these are examples and not having a name for that argument confuses beginners, we decided to have it present.
|
||||
|
||||
### [`echobot.py`](https://github.com/python-telegram-bot/python-telegram-bot/blob/master/examples/echobot.py)
|
||||
### [`echobot.py`](https://github.com/python-telegram-bot/python-telegram-bot/blob/v13.x/examples/echobot.py)
|
||||
This is probably the base for most of the bots made with `python-telegram-bot`. It simply replies to each text message with a message that contains the same text.
|
||||
|
||||
### [`timerbot.py`](https://github.com/python-telegram-bot/python-telegram-bot/blob/master/examples/timerbot.py)
|
||||
### [`timerbot.py`](https://github.com/python-telegram-bot/python-telegram-bot/blob/v13.x/examples/timerbot.py)
|
||||
This bot uses the [`JobQueue`](https://python-telegram-bot.readthedocs.io/en/latest/telegram.ext.jobqueue.html) class to send timed messages. The user sets a timer by using `/set` command with a specific time, for example `/set 30`. The bot then sets up a job to send a message to that user after 30 seconds. The user can also cancel the timer by sending `/unset`. To learn more about the `JobQueue`, read [this wiki article](https://github.com/python-telegram-bot/python-telegram-bot/wiki/Extensions-%E2%80%93-JobQueue).
|
||||
|
||||
### [`conversationbot.py`](https://github.com/python-telegram-bot/python-telegram-bot/blob/master/examples/conversationbot.py)
|
||||
A common task for a bot is to ask information from the user. In v5.0 of this library, we introduced the [`ConversationHandler`](https://python-telegram-bot.readthedocs.io/en/latest/telegram.ext.conversationhandler.html) for that exact purpose. This example uses it to retrieve user-information in a conversation-like style. To get a better understanding, take a look at the [state diagram](https://github.com/python-telegram-bot/python-telegram-bot/blob/master/examples/conversationbot.png).
|
||||
### [`conversationbot.py`](https://github.com/python-telegram-bot/python-telegram-bot/blob/v13.x/examples/conversationbot.py)
|
||||
A common task for a bot is to ask information from the user. In v5.0 of this library, we introduced the [`ConversationHandler`](https://python-telegram-bot.readthedocs.io/en/latest/telegram.ext.conversationhandler.html) for that exact purpose. This example uses it to retrieve user-information in a conversation-like style. To get a better understanding, take a look at the [state diagram](https://github.com/python-telegram-bot/python-telegram-bot/blob/v13.x/examples/conversationbot.png).
|
||||
|
||||
### [`conversationbot2.py`](https://github.com/python-telegram-bot/python-telegram-bot/blob/master/examples/conversationbot2.py)
|
||||
A more complex example of a bot that uses the `ConversationHandler`. It is also more confusing. Good thing there is a [fancy state diagram](https://github.com/python-telegram-bot/python-telegram-bot/blob/master/examples/conversationbot2.png) for this one, too!
|
||||
### [`conversationbot2.py`](https://github.com/python-telegram-bot/python-telegram-bot/blob/v13.x/examples/conversationbot2.py)
|
||||
A more complex example of a bot that uses the `ConversationHandler`. It is also more confusing. Good thing there is a [fancy state diagram](https://github.com/python-telegram-bot/python-telegram-bot/blob/v13.x/examples/conversationbot2.png) for this one, too!
|
||||
|
||||
### [`nestedconversationbot.py`](https://github.com/python-telegram-bot/python-telegram-bot/blob/master/examples/nestedconversationbot.py)
|
||||
A even more complex example of a bot that uses the nested `ConversationHandler`s. While it's certainly not that complex that you couldn't built it without nested `ConversationHanldler`s, it gives a good impression on how to work with them. Of course, there is a [fancy state diagram](https://github.com/python-telegram-bot/python-telegram-bot/blob/master/examples/nestedconversationbot.png) for this example, too!
|
||||
### [`nestedconversationbot.py`](https://github.com/python-telegram-bot/python-telegram-bot/blob/v13.x/examples/nestedconversationbot.py)
|
||||
A even more complex example of a bot that uses the nested `ConversationHandler`s. While it's certainly not that complex that you couldn't built it without nested `ConversationHanldler`s, it gives a good impression on how to work with them. Of course, there is a [fancy state diagram](https://github.com/python-telegram-bot/python-telegram-bot/blob/v13.x/examples/nestedconversationbot.png) for this example, too!
|
||||
|
||||
### [`persistentconversationbot.py`](https://github.com/python-telegram-bot/python-telegram-bot/blob/master/examples/persistentconversationbot.py)
|
||||
### [`persistentconversationbot.py`](https://github.com/python-telegram-bot/python-telegram-bot/blob/v13.x/examples/persistentconversationbot.py)
|
||||
A basic example of a bot store conversation state and user_data over multiple restarts.
|
||||
|
||||
### [`inlinekeyboard.py`](https://github.com/python-telegram-bot/python-telegram-bot/blob/master/examples/inlinekeyboard.py)
|
||||
This example sheds some light on inline keyboards, callback queries and message editing. A wikipedia site explaining this examples lives at https://git.io/JOmFw.
|
||||
### [`inlinekeyboard.py`](https://github.com/python-telegram-bot/python-telegram-bot/blob/v13.x/examples/inlinekeyboard.py)
|
||||
This example sheds some light on inline keyboards, callback queries and message editing. A wikipedia site explaining this examples lives at https://github.com/python-telegram-bot/python-telegram-bot/wiki/InlineKeyboard-Example.
|
||||
|
||||
### [`inlinekeyboard2.py`](https://github.com/python-telegram-bot/python-telegram-bot/blob/master/examples/inlinekeyboard2.py)
|
||||
### [`inlinekeyboard2.py`](https://github.com/python-telegram-bot/python-telegram-bot/blob/v13.x/examples/inlinekeyboard2.py)
|
||||
A more complex example about inline keyboards, callback queries and message editing. This example showcases how an interactive menu could be build using inline keyboards.
|
||||
|
||||
### [`deeplinking.py`](https://github.com/python-telegram-bot/python-telegram-bot/blob/master/examples/deeplinking.py)
|
||||
### [`deeplinking.py`](https://github.com/python-telegram-bot/python-telegram-bot/blob/v13.x/examples/deeplinking.py)
|
||||
A basic example on how to use deeplinking with inline keyboards.
|
||||
|
||||
### [`inlinebot.py`](https://github.com/python-telegram-bot/python-telegram-bot/blob/master/examples/inlinebot.py)
|
||||
### [`inlinebot.py`](https://github.com/python-telegram-bot/python-telegram-bot/blob/v13.x/examples/inlinebot.py)
|
||||
A basic example of an [inline bot](https://core.telegram.org/bots/inline). Don't forget to enable inline mode with [@BotFather](https://telegram.me/BotFather).
|
||||
|
||||
### [`pollbot.py`](https://github.com/python-telegram-bot/python-telegram-bot/blob/master/examples/pollbot.py)
|
||||
### [`pollbot.py`](https://github.com/python-telegram-bot/python-telegram-bot/blob/v13.x/examples/pollbot.py)
|
||||
This example sheds some light on polls, poll answers and the corresponding handlers.
|
||||
|
||||
### [`passportbot.py`](https://github.com/python-telegram-bot/python-telegram-bot/blob/master/examples/passportbot.py)
|
||||
A basic example of a bot that can accept passports. Use in combination with [`passportbot.html`](https://github.com/python-telegram-bot/python-telegram-bot/blob/master/examples/passportbot.html). Don't forget to enable and configure payments with [@BotFather](https://telegram.me/BotFather). Check out this [guide](https://git.io/fAvYd) on Telegram passports in PTB.
|
||||
### [`passportbot.py`](https://github.com/python-telegram-bot/python-telegram-bot/blob/v13.x/examples/passportbot.py)
|
||||
A basic example of a bot that can accept passports. Use in combination with [`passportbot.html`](https://github.com/python-telegram-bot/python-telegram-bot/blob/v13.x/examples/passportbot.html). Don't forget to enable and configure payments with [@BotFather](https://telegram.me/BotFather). Check out this [guide](https://github.com/python-telegram-bot/python-telegram-bot/wiki/Telegram-Passport) on Telegram passports in PTB.
|
||||
|
||||
### [`paymentbot.py`](https://github.com/python-telegram-bot/python-telegram-bot/blob/master/examples/paymentbot.py)
|
||||
### [`paymentbot.py`](https://github.com/python-telegram-bot/python-telegram-bot/blob/v13.x/examples/paymentbot.py)
|
||||
A basic example of a bot that can accept payments. Don't forget to enable and configure payments with [@BotFather](https://telegram.me/BotFather).
|
||||
|
||||
### [`errorhandlerbot.py`](https://github.com/python-telegram-bot/python-telegram-bot/blob/master/examples/errorhandlerbot.py)
|
||||
### [`errorhandlerbot.py`](https://github.com/python-telegram-bot/python-telegram-bot/blob/v13.x/examples/errorhandlerbot.py)
|
||||
A basic example on how to set up a custom error handler.
|
||||
|
||||
### [`chatmemberbot.py`](https://github.com/python-telegram-bot/python-telegram-bot/blob/master/examples/chatmemberbot.py)
|
||||
### [`chatmemberbot.py`](https://github.com/python-telegram-bot/python-telegram-bot/blob/v13.x/examples/chatmemberbot.py)
|
||||
A basic example on how `(my_)chat_member` updates can be used.
|
||||
|
||||
### [`contexttypesbot.py`](https://github.com/python-telegram-bot/python-telegram-bot/blob/master/examples/contexttypesbot.py)
|
||||
### [`contexttypesbot.py`](https://github.com/python-telegram-bot/python-telegram-bot/blob/v13.x/examples/contexttypesbot.py)
|
||||
This example showcases how `telegram.ext.ContextTypes` can be used to customize the `context` argument of handler and job callbacks.
|
||||
|
||||
### [`arbitrarycallbackdatabot.py`](https://github.com/python-telegram-bot/python-telegram-bot/blob/master/examples/arbitrarycallbackdatabot.py)
|
||||
### [`arbitrarycallbackdatabot.py`](https://github.com/python-telegram-bot/python-telegram-bot/blob/v13.x/examples/arbitrarycallbackdatabot.py)
|
||||
This example showcases how PTBs "arbitrary callback data" feature can be used.
|
||||
|
||||
## Pure API
|
||||
The [`rawapibot.py`](https://github.com/python-telegram-bot/python-telegram-bot/blob/master/examples/rawapibot.py) example uses only the pure, "bare-metal" API wrapper.
|
||||
The [`rawapibot.py`](https://github.com/python-telegram-bot/python-telegram-bot/blob/v13.x/examples/rawapibot.py) example uses only the pure, "bare-metal" API wrapper.
|
||||
|
||||
@@ -4,7 +4,8 @@
|
||||
|
||||
"""This example showcases how PTBs "arbitrary callback data" feature can be used.
|
||||
|
||||
For detailed info on arbitrary callback data, see the wiki page at https://git.io/JGBDI
|
||||
For detailed info on arbitrary callback data, see the wiki page at
|
||||
https://github.com/python-telegram-bot/python-telegram-bot/wiki/Arbitrary-callback_data
|
||||
"""
|
||||
import logging
|
||||
from typing import List, Tuple, cast
|
||||
|
||||
+10
-18
@@ -44,24 +44,16 @@ def extract_status_change(
|
||||
return None
|
||||
|
||||
old_status, new_status = status_change
|
||||
was_member = (
|
||||
old_status
|
||||
in [
|
||||
ChatMember.MEMBER,
|
||||
ChatMember.CREATOR,
|
||||
ChatMember.ADMINISTRATOR,
|
||||
]
|
||||
or (old_status == ChatMember.RESTRICTED and old_is_member is True)
|
||||
)
|
||||
is_member = (
|
||||
new_status
|
||||
in [
|
||||
ChatMember.MEMBER,
|
||||
ChatMember.CREATOR,
|
||||
ChatMember.ADMINISTRATOR,
|
||||
]
|
||||
or (new_status == ChatMember.RESTRICTED and new_is_member is True)
|
||||
)
|
||||
was_member = old_status in [
|
||||
ChatMember.MEMBER,
|
||||
ChatMember.CREATOR,
|
||||
ChatMember.ADMINISTRATOR,
|
||||
] or (old_status == ChatMember.RESTRICTED and old_is_member is True)
|
||||
is_member = new_status in [
|
||||
ChatMember.MEMBER,
|
||||
ChatMember.CREATOR,
|
||||
ChatMember.ADMINISTRATOR,
|
||||
] or (new_status == ChatMember.RESTRICTED and new_is_member is True)
|
||||
|
||||
return was_member, is_member
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
"""
|
||||
Basic example for a bot that uses inline keyboards. For an in-depth explanation, check out
|
||||
https://git.io/JOmFw.
|
||||
https://github.com/python-telegram-bot/python-telegram-bot/wiki/InlineKeyboard-Example.
|
||||
"""
|
||||
import logging
|
||||
|
||||
|
||||
@@ -7,7 +7,8 @@ Simple Bot to print/download all incoming passport data
|
||||
|
||||
See https://telegram.org/blog/passport for info about what telegram passport is.
|
||||
|
||||
See https://git.io/fAvYd for how to use Telegram Passport properly with python-telegram-bot.
|
||||
See https://github.com/python-telegram-bot/python-telegram-bot/wiki/Telegram-Passport
|
||||
for how to use Telegram Passport properly with python-telegram-bot.
|
||||
|
||||
"""
|
||||
import logging
|
||||
|
||||
@@ -3,7 +3,7 @@ cryptography!=3.4,!=3.4.1,!=3.4.2,!=3.4.3
|
||||
|
||||
pre-commit
|
||||
# Make sure that the versions specified here match the pre-commit settings!
|
||||
black==20.8b1
|
||||
black==22.3.0
|
||||
flake8==3.9.2
|
||||
pylint==2.8.3
|
||||
mypy==0.812
|
||||
|
||||
@@ -30,6 +30,7 @@ filterwarnings =
|
||||
; Unfortunately due to https://github.com/pytest-dev/pytest/issues/8343 we can't have this here
|
||||
; and instead do a trick directly in tests/conftest.py
|
||||
; ignore::telegram.utils.deprecate.TelegramDeprecationWarning
|
||||
markers = dev: If you want to test a specific test, use this
|
||||
|
||||
[coverage:run]
|
||||
branch = True
|
||||
|
||||
@@ -65,7 +65,7 @@ def get_setup_kwargs(raw=False):
|
||||
author_email='devs@python-telegram-bot.org',
|
||||
license='LGPLv3',
|
||||
url='https://python-telegram-bot.org/',
|
||||
# Keywords supported by PyPI can be found at https://git.io/JtLIZ
|
||||
# Keywords supported by PyPI can be found at https://github.com/pypa/warehouse/blob/aafc5185e57e67d43487ce4faa95913dd4573e14/warehouse/templates/packaging/detail.html#L20-L58
|
||||
project_urls={
|
||||
"Documentation": "https://python-telegram-bot.readthedocs.io",
|
||||
"Bug Tracker": "https://github.com/python-telegram-bot/python-telegram-bot/issues",
|
||||
@@ -98,12 +98,11 @@ def get_setup_kwargs(raw=False):
|
||||
'Topic :: Internet',
|
||||
'Programming Language :: Python',
|
||||
'Programming Language :: Python :: 3',
|
||||
'Programming Language :: Python :: 3.6',
|
||||
'Programming Language :: Python :: 3.7',
|
||||
'Programming Language :: Python :: 3.8',
|
||||
'Programming Language :: Python :: 3.9',
|
||||
],
|
||||
python_requires='>=3.6'
|
||||
python_requires='>=3.7'
|
||||
)
|
||||
|
||||
return kwargs
|
||||
|
||||
+26
-3
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# A library that provides a Python interface to the Telegram Bot API
|
||||
# Copyright (C) 2015-2021
|
||||
# Copyright (C) 2015-2022
|
||||
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
@@ -20,9 +20,16 @@
|
||||
|
||||
from .base import TelegramObject
|
||||
from .botcommand import BotCommand
|
||||
from .webappdata import WebAppData
|
||||
from .webappinfo import WebAppInfo
|
||||
from .sentwebappmessage import SentWebAppMessage
|
||||
from .menubutton import MenuButton, MenuButtonCommands, MenuButtonDefault, MenuButtonWebApp
|
||||
from .loginurl import LoginUrl
|
||||
from .games.callbackgame import CallbackGame
|
||||
from .user import User
|
||||
from .files.chatphoto import ChatPhoto
|
||||
from .chat import Chat
|
||||
from .chatadministratorrights import ChatAdministratorRights
|
||||
from .chatlocation import ChatLocation
|
||||
from .chatinvitelink import ChatInviteLink
|
||||
from .chatjoinrequest import ChatJoinRequest
|
||||
@@ -71,9 +78,13 @@ from .voicechat import (
|
||||
VoiceChatParticipantsInvited,
|
||||
VoiceChatScheduled,
|
||||
)
|
||||
from .loginurl import LoginUrl
|
||||
from .videochat import (
|
||||
VideoChatStarted,
|
||||
VideoChatEnded,
|
||||
VideoChatParticipantsInvited,
|
||||
VideoChatScheduled,
|
||||
)
|
||||
from .proximityalerttriggered import ProximityAlertTriggered
|
||||
from .games.callbackgame import CallbackGame
|
||||
from .payment.shippingaddress import ShippingAddress
|
||||
from .payment.orderinfo import OrderInfo
|
||||
from .payment.successfulpayment import SuccessfulPayment
|
||||
@@ -193,6 +204,7 @@ __all__ = ( # Keep this alphabetically ordered
|
||||
'CallbackGame',
|
||||
'CallbackQuery',
|
||||
'Chat',
|
||||
'ChatAdministratorRights',
|
||||
'ChatAction',
|
||||
'ChatInviteLink',
|
||||
'ChatJoinRequest',
|
||||
@@ -272,6 +284,10 @@ __all__ = ( # Keep this alphabetically ordered
|
||||
'MAX_MESSAGES_PER_SECOND_PER_CHAT',
|
||||
'MAX_MESSAGE_LENGTH',
|
||||
'MaskPosition',
|
||||
'MenuButton',
|
||||
'MenuButtonCommands',
|
||||
'MenuButtonDefault',
|
||||
'MenuButtonWebApp',
|
||||
'Message',
|
||||
'MessageAutoDeleteTimerChanged',
|
||||
'MessageEntity',
|
||||
@@ -304,6 +320,7 @@ __all__ = ( # Keep this alphabetically ordered
|
||||
'SUPPORTED_WEBHOOK_PORTS',
|
||||
'SecureData',
|
||||
'SecureValue',
|
||||
'SentWebAppMessage',
|
||||
'ShippingAddress',
|
||||
'ShippingOption',
|
||||
'ShippingQuery',
|
||||
@@ -318,11 +335,17 @@ __all__ = ( # Keep this alphabetically ordered
|
||||
'UserProfilePhotos',
|
||||
'Venue',
|
||||
'Video',
|
||||
'VideoChatEnded',
|
||||
'VideoChatParticipantsInvited',
|
||||
'VideoChatScheduled',
|
||||
'VideoChatStarted',
|
||||
'VideoNote',
|
||||
'Voice',
|
||||
'VoiceChatStarted',
|
||||
'VoiceChatEnded',
|
||||
'VoiceChatScheduled',
|
||||
'VoiceChatParticipantsInvited',
|
||||
'WebAppData',
|
||||
'WebAppInfo',
|
||||
'WebhookInfo',
|
||||
)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# !/usr/bin/env python
|
||||
#
|
||||
# A library that provides a Python interface to the Telegram Bot API
|
||||
# Copyright (C) 2015-2021
|
||||
# Copyright (C) 2015-2022
|
||||
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
@@ -41,7 +41,7 @@ def print_ver_info() -> None: # skipcq: PY-D0003
|
||||
git_revision = _git_revision()
|
||||
print(f'python-telegram-bot {telegram_ver}' + (f' ({git_revision})' if git_revision else ''))
|
||||
print(f'Bot API {BOT_API_VERSION}')
|
||||
print(f'certifi {certifi.__version__}') # type: ignore[attr-defined]
|
||||
print('certifi' + certifi.__version__)
|
||||
sys_version = sys.version.replace('\n', ' ')
|
||||
print(f'Python {sys_version}')
|
||||
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# A library that provides a Python interface to the Telegram Bot API
|
||||
# Copyright (C) 2015-2021
|
||||
# Copyright (C) 2015-2022
|
||||
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
||||
+667
-34
File diff suppressed because it is too large
Load Diff
@@ -2,7 +2,7 @@
|
||||
# pylint: disable=R0903
|
||||
#
|
||||
# A library that provides a Python interface to the Telegram Bot API
|
||||
# Copyright (C) 2015-2021
|
||||
# Copyright (C) 2015-2022
|
||||
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
@@ -33,7 +33,7 @@ class BotCommand(TelegramObject):
|
||||
Args:
|
||||
command (:obj:`str`): Text of the command, 1-32 characters. Can contain only lowercase
|
||||
English letters, digits and underscores.
|
||||
description (:obj:`str`): Description of the command, 3-256 characters.
|
||||
description (:obj:`str`): Description of the command, 1-256 characters.
|
||||
|
||||
Attributes:
|
||||
command (:obj:`str`): Text of the command.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# A library that provides a Python interface to the Telegram Bot API
|
||||
# Copyright (C) 2021
|
||||
# Copyright (C) 2015-2022
|
||||
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# A library that provides a Python interface to the Telegram Bot API
|
||||
# Copyright (C) 2015-2021
|
||||
# Copyright (C) 2015-2022
|
||||
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
@@ -620,6 +620,7 @@ class CallbackQuery(TelegramObject):
|
||||
reply_markup: ReplyMarkup = None,
|
||||
timeout: ODVInput[float] = DEFAULT_NONE,
|
||||
api_kwargs: JSONDict = None,
|
||||
protect_content: bool = None,
|
||||
) -> 'MessageId':
|
||||
"""Shortcut for::
|
||||
|
||||
@@ -648,6 +649,7 @@ class CallbackQuery(TelegramObject):
|
||||
reply_markup=reply_markup,
|
||||
timeout=timeout,
|
||||
api_kwargs=api_kwargs,
|
||||
protect_content=protect_content,
|
||||
)
|
||||
|
||||
MAX_ANSWER_TEXT_LENGTH: ClassVar[int] = constants.MAX_ANSWER_CALLBACK_QUERY_TEXT_LENGTH
|
||||
|
||||
+244
-2
@@ -2,7 +2,7 @@
|
||||
# pylint: disable=W0622
|
||||
#
|
||||
# A library that provides a Python interface to the Telegram Bot API
|
||||
# Copyright (C) 2015-2021
|
||||
# Copyright (C) 2015-2022
|
||||
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
@@ -22,7 +22,7 @@ import warnings
|
||||
from datetime import datetime
|
||||
from typing import TYPE_CHECKING, List, Optional, ClassVar, Union, Tuple, Any
|
||||
|
||||
from telegram import ChatPhoto, TelegramObject, constants
|
||||
from telegram import ChatPhoto, TelegramObject, constants, MenuButton
|
||||
from telegram.utils.types import JSONDict, FileInput, ODVInput, DVInput
|
||||
from telegram.utils.deprecate import TelegramDeprecationWarning
|
||||
|
||||
@@ -81,6 +81,11 @@ class Chat(TelegramObject):
|
||||
Returned only in :meth:`telegram.Bot.get_chat`.
|
||||
bio (:obj:`str`, optional): Bio of the other party in a private chat. Returned only in
|
||||
:meth:`telegram.Bot.get_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. Returned only in :meth:`telegram.Bot.get_chat`.
|
||||
|
||||
.. versionadded:: 13.9
|
||||
description (:obj:`str`, optional): Description, for groups, supergroups and channel chats.
|
||||
Returned only in :meth:`telegram.Bot.get_chat`.
|
||||
invite_link (:obj:`str`, optional): Primary invite link, for groups, supergroups and
|
||||
@@ -97,6 +102,10 @@ class Chat(TelegramObject):
|
||||
:meth:`telegram.Bot.get_chat`.
|
||||
|
||||
.. versionadded:: 13.4
|
||||
has_protected_content (:obj:`bool`, optional): :obj:`True`, if messages from the chat can't
|
||||
be forwarded to other chats. Returned only in :meth:`telegram.Bot.get_chat`.
|
||||
|
||||
.. versionadded:: 13.9
|
||||
bot (:class:`telegram.Bot`, optional): The Bot to use for instance methods.
|
||||
sticker_set_name (:obj:`str`, optional): For supergroups, name of group sticker set.
|
||||
Returned only in :meth:`telegram.Bot.get_chat`.
|
||||
@@ -107,6 +116,16 @@ class Chat(TelegramObject):
|
||||
chats. Returned only in :meth:`telegram.Bot.get_chat`.
|
||||
location (:class:`telegram.ChatLocation`, optional): For supergroups, the location to which
|
||||
the supergroup is connected. Returned only in :meth:`telegram.Bot.get_chat`.
|
||||
join_to_send_messages (:obj:`bool`, optional): :obj:`True`, if users need to join the
|
||||
supergroup before they can send messages. Returned only in
|
||||
:meth:`telegram.Bot.get_chat`.
|
||||
|
||||
.. versionadded:: 13.13
|
||||
join_by_request (:obj:`bool`, optional): :obj:`True`, if all users directly joining the
|
||||
supergroup need to be approved by supergroup administrators. Returned only in
|
||||
:meth:`telegram.Bot.get_chat`.
|
||||
|
||||
.. versionadded:: 13.13
|
||||
**kwargs (:obj:`dict`): Arbitrary keyword arguments.
|
||||
|
||||
Attributes:
|
||||
@@ -119,6 +138,11 @@ class Chat(TelegramObject):
|
||||
photo (:class:`telegram.ChatPhoto`): Optional. Chat photo.
|
||||
bio (:obj:`str`): Optional. Bio of the other party in a private chat. Returned only in
|
||||
:meth:`telegram.Bot.get_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
|
||||
description (:obj:`str`): Optional. Description, for groups, supergroups and channel chats.
|
||||
invite_link (:obj:`str`): Optional. Primary invite link, for groups, supergroups and
|
||||
channel. Returned only in :meth:`telegram.Bot.get_chat`.
|
||||
@@ -134,6 +158,10 @@ class Chat(TelegramObject):
|
||||
:meth:`telegram.Bot.get_chat`.
|
||||
|
||||
.. versionadded:: 13.4
|
||||
has_protected_content (:obj:`bool`): Optional. :obj:`True`, if messages from the chat can't
|
||||
be forwarded to other chats.
|
||||
|
||||
.. versionadded:: 13.9
|
||||
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.
|
||||
@@ -142,7 +170,16 @@ class Chat(TelegramObject):
|
||||
chats. Returned only in :meth:`telegram.Bot.get_chat`.
|
||||
location (:class:`telegram.ChatLocation`): Optional. For supergroups, the location to which
|
||||
the supergroup is connected. Returned only in :meth:`telegram.Bot.get_chat`.
|
||||
join_to_send_messages (:obj:`bool`): Optional. :obj:`True`, if users need to join the
|
||||
supergroup before they can send messages. Returned only in
|
||||
:meth:`telegram.Bot.get_chat`.
|
||||
|
||||
.. versionadded:: 13.13
|
||||
join_by_request (:obj:`bool`): Optional. :obj:`True`, if all users directly joining the
|
||||
supergroup need to be approved by supergroup administrators. Returned only in
|
||||
:meth:`telegram.Bot.get_chat`.
|
||||
|
||||
.. versionadded:: 13.13
|
||||
"""
|
||||
|
||||
__slots__ = (
|
||||
@@ -166,6 +203,10 @@ class Chat(TelegramObject):
|
||||
'linked_chat_id',
|
||||
'all_members_are_administrators',
|
||||
'message_auto_delete_time',
|
||||
'has_protected_content',
|
||||
'has_private_forwards',
|
||||
'join_to_send_messages',
|
||||
'join_by_request',
|
||||
'_id_attrs',
|
||||
)
|
||||
|
||||
@@ -204,6 +245,10 @@ class Chat(TelegramObject):
|
||||
linked_chat_id: int = None,
|
||||
location: ChatLocation = None,
|
||||
message_auto_delete_time: int = None,
|
||||
has_private_forwards: bool = None,
|
||||
has_protected_content: bool = None,
|
||||
join_to_send_messages: bool = None,
|
||||
join_by_request: bool = None,
|
||||
**_kwargs: Any,
|
||||
):
|
||||
# Required
|
||||
@@ -218,6 +263,7 @@ class Chat(TelegramObject):
|
||||
self.all_members_are_administrators = _kwargs.get('all_members_are_administrators')
|
||||
self.photo = photo
|
||||
self.bio = bio
|
||||
self.has_private_forwards = has_private_forwards
|
||||
self.description = description
|
||||
self.invite_link = invite_link
|
||||
self.pinned_message = pinned_message
|
||||
@@ -226,10 +272,13 @@ class Chat(TelegramObject):
|
||||
self.message_auto_delete_time = (
|
||||
int(message_auto_delete_time) if message_auto_delete_time is not None else None
|
||||
)
|
||||
self.has_protected_content = has_protected_content
|
||||
self.sticker_set_name = sticker_set_name
|
||||
self.can_set_sticker_set = can_set_sticker_set
|
||||
self.linked_chat_id = linked_chat_id
|
||||
self.location = location
|
||||
self.join_to_send_messages = join_to_send_messages
|
||||
self.join_by_request = join_by_request
|
||||
|
||||
self.bot = bot
|
||||
self._id_attrs = (self.id,)
|
||||
@@ -433,6 +482,98 @@ class Chat(TelegramObject):
|
||||
revoke_messages=revoke_messages,
|
||||
)
|
||||
|
||||
def ban_sender_chat(
|
||||
self,
|
||||
sender_chat_id: int,
|
||||
timeout: ODVInput[float] = DEFAULT_NONE,
|
||||
api_kwargs: JSONDict = None,
|
||||
) -> bool:
|
||||
"""Shortcut for::
|
||||
|
||||
bot.ban_chat_sender_chat(chat_id=update.effective_chat.id, *args, **kwargs)
|
||||
|
||||
For the documentation of the arguments, please see
|
||||
:meth:`telegram.Bot.ban_chat_sender_chat`.
|
||||
|
||||
.. versionadded:: 13.9
|
||||
|
||||
Returns:
|
||||
:obj:`bool`: On success, :obj:`True` is returned.
|
||||
|
||||
"""
|
||||
return self.bot.ban_chat_sender_chat(
|
||||
chat_id=self.id, sender_chat_id=sender_chat_id, timeout=timeout, api_kwargs=api_kwargs
|
||||
)
|
||||
|
||||
def ban_chat(
|
||||
self,
|
||||
chat_id: Union[str, int],
|
||||
timeout: ODVInput[float] = DEFAULT_NONE,
|
||||
api_kwargs: JSONDict = None,
|
||||
) -> bool:
|
||||
"""Shortcut for::
|
||||
|
||||
bot.ban_chat_sender_chat(sender_chat_id=update.effective_chat.id, *args, **kwargs)
|
||||
|
||||
For the documentation of the arguments, please see
|
||||
:meth:`telegram.Bot.ban_chat_sender_chat`.
|
||||
|
||||
.. versionadded:: 13.9
|
||||
|
||||
Returns:
|
||||
:obj:`bool`: On success, :obj:`True` is returned.
|
||||
|
||||
"""
|
||||
return self.bot.ban_chat_sender_chat(
|
||||
chat_id=chat_id, sender_chat_id=self.id, timeout=timeout, api_kwargs=api_kwargs
|
||||
)
|
||||
|
||||
def unban_sender_chat(
|
||||
self,
|
||||
sender_chat_id: int,
|
||||
timeout: ODVInput[float] = DEFAULT_NONE,
|
||||
api_kwargs: JSONDict = None,
|
||||
) -> bool:
|
||||
"""Shortcut for::
|
||||
|
||||
bot.unban_chat_sender_chat(chat_id=update.effective_chat.id, *args, **kwargs)
|
||||
|
||||
For the documentation of the arguments, please see
|
||||
:meth:`telegram.Bot.unban_chat_sender_chat`.
|
||||
|
||||
.. versionadded:: 13.9
|
||||
|
||||
Returns:
|
||||
:obj:`bool`: On success, :obj:`True` is returned.
|
||||
|
||||
"""
|
||||
return self.bot.unban_chat_sender_chat(
|
||||
chat_id=self.id, sender_chat_id=sender_chat_id, timeout=timeout, api_kwargs=api_kwargs
|
||||
)
|
||||
|
||||
def unban_chat(
|
||||
self,
|
||||
chat_id: Union[str, int],
|
||||
timeout: ODVInput[float] = DEFAULT_NONE,
|
||||
api_kwargs: JSONDict = None,
|
||||
) -> bool:
|
||||
"""Shortcut for::
|
||||
|
||||
bot.unban_chat_sender_chat(sender_chat_id=update.effective_chat.id, *args, **kwargs)
|
||||
|
||||
For the documentation of the arguments, please see
|
||||
:meth:`telegram.Bot.unban_chat_sender_chat`.
|
||||
|
||||
.. versionadded:: 13.9
|
||||
|
||||
Returns:
|
||||
:obj:`bool`: On success, :obj:`True` is returned.
|
||||
|
||||
"""
|
||||
return self.bot.unban_chat_sender_chat(
|
||||
chat_id=chat_id, sender_chat_id=self.id, timeout=timeout, api_kwargs=api_kwargs
|
||||
)
|
||||
|
||||
def unban_member(
|
||||
self,
|
||||
user_id: Union[str, int],
|
||||
@@ -474,6 +615,7 @@ class Chat(TelegramObject):
|
||||
is_anonymous: bool = None,
|
||||
can_manage_chat: bool = None,
|
||||
can_manage_voice_chats: bool = None,
|
||||
can_manage_video_chats: bool = None,
|
||||
) -> bool:
|
||||
"""Shortcut for::
|
||||
|
||||
@@ -484,6 +626,9 @@ class Chat(TelegramObject):
|
||||
|
||||
.. versionadded:: 13.2
|
||||
|
||||
..versionchanged:: 13.12
|
||||
Since Bot API 6.0, voice chat was renamed to video chat.
|
||||
|
||||
Returns:
|
||||
:obj:`bool`: On success, :obj:`True` is returned.
|
||||
|
||||
@@ -504,6 +649,7 @@ class Chat(TelegramObject):
|
||||
is_anonymous=is_anonymous,
|
||||
can_manage_chat=can_manage_chat,
|
||||
can_manage_voice_chats=can_manage_voice_chats,
|
||||
can_manage_video_chats=can_manage_video_chats,
|
||||
)
|
||||
|
||||
def restrict_member(
|
||||
@@ -676,6 +822,7 @@ class Chat(TelegramObject):
|
||||
api_kwargs: JSONDict = None,
|
||||
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
|
||||
entities: Union[List['MessageEntity'], Tuple['MessageEntity', ...]] = None,
|
||||
protect_content: bool = None,
|
||||
) -> 'Message':
|
||||
"""Shortcut for::
|
||||
|
||||
@@ -699,6 +846,7 @@ class Chat(TelegramObject):
|
||||
api_kwargs=api_kwargs,
|
||||
allow_sending_without_reply=allow_sending_without_reply,
|
||||
entities=entities,
|
||||
protect_content=protect_content,
|
||||
)
|
||||
|
||||
def send_media_group(
|
||||
@@ -711,6 +859,7 @@ class Chat(TelegramObject):
|
||||
timeout: DVInput[float] = DEFAULT_20,
|
||||
api_kwargs: JSONDict = None,
|
||||
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
|
||||
protect_content: bool = None,
|
||||
) -> List['Message']:
|
||||
"""Shortcut for::
|
||||
|
||||
@@ -730,6 +879,7 @@ class Chat(TelegramObject):
|
||||
timeout=timeout,
|
||||
api_kwargs=api_kwargs,
|
||||
allow_sending_without_reply=allow_sending_without_reply,
|
||||
protect_content=protect_content,
|
||||
)
|
||||
|
||||
def send_chat_action(
|
||||
@@ -771,6 +921,7 @@ class Chat(TelegramObject):
|
||||
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
|
||||
caption_entities: Union[List['MessageEntity'], Tuple['MessageEntity', ...]] = None,
|
||||
filename: str = None,
|
||||
protect_content: bool = None,
|
||||
) -> 'Message':
|
||||
"""Shortcut for::
|
||||
|
||||
@@ -795,6 +946,7 @@ class Chat(TelegramObject):
|
||||
allow_sending_without_reply=allow_sending_without_reply,
|
||||
caption_entities=caption_entities,
|
||||
filename=filename,
|
||||
protect_content=protect_content,
|
||||
)
|
||||
|
||||
def send_contact(
|
||||
@@ -810,6 +962,7 @@ class Chat(TelegramObject):
|
||||
vcard: str = None,
|
||||
api_kwargs: JSONDict = None,
|
||||
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
|
||||
protect_content: bool = None,
|
||||
) -> 'Message':
|
||||
"""Shortcut for::
|
||||
|
||||
@@ -834,6 +987,7 @@ class Chat(TelegramObject):
|
||||
vcard=vcard,
|
||||
api_kwargs=api_kwargs,
|
||||
allow_sending_without_reply=allow_sending_without_reply,
|
||||
protect_content=protect_content,
|
||||
)
|
||||
|
||||
def send_audio(
|
||||
@@ -853,6 +1007,7 @@ class Chat(TelegramObject):
|
||||
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
|
||||
caption_entities: Union[List['MessageEntity'], Tuple['MessageEntity', ...]] = None,
|
||||
filename: str = None,
|
||||
protect_content: bool = None,
|
||||
) -> 'Message':
|
||||
"""Shortcut for::
|
||||
|
||||
@@ -881,6 +1036,7 @@ class Chat(TelegramObject):
|
||||
allow_sending_without_reply=allow_sending_without_reply,
|
||||
caption_entities=caption_entities,
|
||||
filename=filename,
|
||||
protect_content=protect_content,
|
||||
)
|
||||
|
||||
def send_document(
|
||||
@@ -898,6 +1054,7 @@ class Chat(TelegramObject):
|
||||
disable_content_type_detection: bool = None,
|
||||
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
|
||||
caption_entities: Union[List['MessageEntity'], Tuple['MessageEntity', ...]] = None,
|
||||
protect_content: bool = None,
|
||||
) -> 'Message':
|
||||
"""Shortcut for::
|
||||
|
||||
@@ -924,6 +1081,7 @@ class Chat(TelegramObject):
|
||||
disable_content_type_detection=disable_content_type_detection,
|
||||
allow_sending_without_reply=allow_sending_without_reply,
|
||||
caption_entities=caption_entities,
|
||||
protect_content=protect_content,
|
||||
)
|
||||
|
||||
def send_dice(
|
||||
@@ -935,6 +1093,7 @@ class Chat(TelegramObject):
|
||||
emoji: str = None,
|
||||
api_kwargs: JSONDict = None,
|
||||
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
|
||||
protect_content: bool = None,
|
||||
) -> 'Message':
|
||||
"""Shortcut for::
|
||||
|
||||
@@ -955,6 +1114,7 @@ class Chat(TelegramObject):
|
||||
emoji=emoji,
|
||||
api_kwargs=api_kwargs,
|
||||
allow_sending_without_reply=allow_sending_without_reply,
|
||||
protect_content=protect_content,
|
||||
)
|
||||
|
||||
def send_game(
|
||||
@@ -966,6 +1126,7 @@ class Chat(TelegramObject):
|
||||
timeout: ODVInput[float] = DEFAULT_NONE,
|
||||
api_kwargs: JSONDict = None,
|
||||
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
|
||||
protect_content: bool = None,
|
||||
) -> 'Message':
|
||||
"""Shortcut for::
|
||||
|
||||
@@ -986,6 +1147,7 @@ class Chat(TelegramObject):
|
||||
timeout=timeout,
|
||||
api_kwargs=api_kwargs,
|
||||
allow_sending_without_reply=allow_sending_without_reply,
|
||||
protect_content=protect_content,
|
||||
)
|
||||
|
||||
def send_invoice(
|
||||
@@ -1017,6 +1179,7 @@ class Chat(TelegramObject):
|
||||
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
|
||||
max_tip_amount: int = None,
|
||||
suggested_tip_amounts: List[int] = None,
|
||||
protect_content: bool = None,
|
||||
) -> 'Message':
|
||||
"""Shortcut for::
|
||||
|
||||
@@ -1065,6 +1228,7 @@ class Chat(TelegramObject):
|
||||
allow_sending_without_reply=allow_sending_without_reply,
|
||||
max_tip_amount=max_tip_amount,
|
||||
suggested_tip_amounts=suggested_tip_amounts,
|
||||
protect_content=protect_content,
|
||||
)
|
||||
|
||||
def send_location(
|
||||
@@ -1082,6 +1246,7 @@ class Chat(TelegramObject):
|
||||
heading: int = None,
|
||||
proximity_alert_radius: int = None,
|
||||
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
|
||||
protect_content: bool = None,
|
||||
) -> 'Message':
|
||||
"""Shortcut for::
|
||||
|
||||
@@ -1108,6 +1273,7 @@ class Chat(TelegramObject):
|
||||
heading=heading,
|
||||
proximity_alert_radius=proximity_alert_radius,
|
||||
allow_sending_without_reply=allow_sending_without_reply,
|
||||
protect_content=protect_content,
|
||||
)
|
||||
|
||||
def send_animation(
|
||||
@@ -1127,6 +1293,7 @@ class Chat(TelegramObject):
|
||||
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
|
||||
caption_entities: Union[List['MessageEntity'], Tuple['MessageEntity', ...]] = None,
|
||||
filename: str = None,
|
||||
protect_content: bool = None,
|
||||
) -> 'Message':
|
||||
"""Shortcut for::
|
||||
|
||||
@@ -1155,6 +1322,7 @@ class Chat(TelegramObject):
|
||||
allow_sending_without_reply=allow_sending_without_reply,
|
||||
caption_entities=caption_entities,
|
||||
filename=filename,
|
||||
protect_content=protect_content,
|
||||
)
|
||||
|
||||
def send_sticker(
|
||||
@@ -1166,6 +1334,7 @@ class Chat(TelegramObject):
|
||||
timeout: DVInput[float] = DEFAULT_20,
|
||||
api_kwargs: JSONDict = None,
|
||||
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
|
||||
protect_content: bool = None,
|
||||
) -> 'Message':
|
||||
"""Shortcut for::
|
||||
|
||||
@@ -1186,6 +1355,7 @@ class Chat(TelegramObject):
|
||||
timeout=timeout,
|
||||
api_kwargs=api_kwargs,
|
||||
allow_sending_without_reply=allow_sending_without_reply,
|
||||
protect_content=protect_content,
|
||||
)
|
||||
|
||||
def send_venue(
|
||||
@@ -1205,6 +1375,7 @@ class Chat(TelegramObject):
|
||||
google_place_id: str = None,
|
||||
google_place_type: str = None,
|
||||
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
|
||||
protect_content: bool = None,
|
||||
) -> 'Message':
|
||||
"""Shortcut for::
|
||||
|
||||
@@ -1233,6 +1404,7 @@ class Chat(TelegramObject):
|
||||
google_place_id=google_place_id,
|
||||
google_place_type=google_place_type,
|
||||
allow_sending_without_reply=allow_sending_without_reply,
|
||||
protect_content=protect_content,
|
||||
)
|
||||
|
||||
def send_video(
|
||||
@@ -1253,6 +1425,7 @@ class Chat(TelegramObject):
|
||||
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
|
||||
caption_entities: Union[List['MessageEntity'], Tuple['MessageEntity', ...]] = None,
|
||||
filename: str = None,
|
||||
protect_content: bool = None,
|
||||
) -> 'Message':
|
||||
"""Shortcut for::
|
||||
|
||||
@@ -1282,6 +1455,7 @@ class Chat(TelegramObject):
|
||||
allow_sending_without_reply=allow_sending_without_reply,
|
||||
caption_entities=caption_entities,
|
||||
filename=filename,
|
||||
protect_content=protect_content,
|
||||
)
|
||||
|
||||
def send_video_note(
|
||||
@@ -1297,6 +1471,7 @@ class Chat(TelegramObject):
|
||||
api_kwargs: JSONDict = None,
|
||||
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
|
||||
filename: str = None,
|
||||
protect_content: bool = None,
|
||||
) -> 'Message':
|
||||
"""Shortcut for::
|
||||
|
||||
@@ -1321,6 +1496,7 @@ class Chat(TelegramObject):
|
||||
api_kwargs=api_kwargs,
|
||||
allow_sending_without_reply=allow_sending_without_reply,
|
||||
filename=filename,
|
||||
protect_content=protect_content,
|
||||
)
|
||||
|
||||
def send_voice(
|
||||
@@ -1337,6 +1513,7 @@ class Chat(TelegramObject):
|
||||
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
|
||||
caption_entities: Union[List['MessageEntity'], Tuple['MessageEntity', ...]] = None,
|
||||
filename: str = None,
|
||||
protect_content: bool = None,
|
||||
) -> 'Message':
|
||||
"""Shortcut for::
|
||||
|
||||
@@ -1362,6 +1539,7 @@ class Chat(TelegramObject):
|
||||
allow_sending_without_reply=allow_sending_without_reply,
|
||||
caption_entities=caption_entities,
|
||||
filename=filename,
|
||||
protect_content=protect_content,
|
||||
)
|
||||
|
||||
def send_poll(
|
||||
@@ -1385,6 +1563,7 @@ class Chat(TelegramObject):
|
||||
api_kwargs: JSONDict = None,
|
||||
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
|
||||
explanation_entities: Union[List['MessageEntity'], Tuple['MessageEntity', ...]] = None,
|
||||
protect_content: bool = None,
|
||||
) -> 'Message':
|
||||
"""Shortcut for::
|
||||
|
||||
@@ -1416,6 +1595,7 @@ class Chat(TelegramObject):
|
||||
api_kwargs=api_kwargs,
|
||||
allow_sending_without_reply=allow_sending_without_reply,
|
||||
explanation_entities=explanation_entities,
|
||||
protect_content=protect_content,
|
||||
)
|
||||
|
||||
def send_copy(
|
||||
@@ -1431,6 +1611,7 @@ class Chat(TelegramObject):
|
||||
reply_markup: 'ReplyMarkup' = None,
|
||||
timeout: ODVInput[float] = DEFAULT_NONE,
|
||||
api_kwargs: JSONDict = None,
|
||||
protect_content: bool = None,
|
||||
) -> 'MessageId':
|
||||
"""Shortcut for::
|
||||
|
||||
@@ -1455,6 +1636,7 @@ class Chat(TelegramObject):
|
||||
reply_markup=reply_markup,
|
||||
timeout=timeout,
|
||||
api_kwargs=api_kwargs,
|
||||
protect_content=protect_content,
|
||||
)
|
||||
|
||||
def copy_message(
|
||||
@@ -1470,6 +1652,7 @@ class Chat(TelegramObject):
|
||||
reply_markup: 'ReplyMarkup' = None,
|
||||
timeout: ODVInput[float] = DEFAULT_NONE,
|
||||
api_kwargs: JSONDict = None,
|
||||
protect_content: bool = None,
|
||||
) -> 'MessageId':
|
||||
"""Shortcut for::
|
||||
|
||||
@@ -1494,6 +1677,7 @@ class Chat(TelegramObject):
|
||||
reply_markup=reply_markup,
|
||||
timeout=timeout,
|
||||
api_kwargs=api_kwargs,
|
||||
protect_content=protect_content,
|
||||
)
|
||||
|
||||
def export_invite_link(
|
||||
@@ -1659,3 +1843,61 @@ class Chat(TelegramObject):
|
||||
return self.bot.decline_chat_join_request(
|
||||
chat_id=self.id, user_id=user_id, timeout=timeout, api_kwargs=api_kwargs
|
||||
)
|
||||
|
||||
def set_menu_button(
|
||||
self,
|
||||
menu_button: MenuButton = None,
|
||||
timeout: ODVInput[float] = DEFAULT_NONE,
|
||||
api_kwargs: JSONDict = None,
|
||||
) -> bool:
|
||||
"""Shortcut for::
|
||||
|
||||
bot.set_chat_menu_button(chat_id=update.effective_chat.id, *args, **kwargs)
|
||||
|
||||
For the documentation of the arguments, please see
|
||||
:meth:`telegram.Bot.set_chat_menu_button`.
|
||||
|
||||
Caution:
|
||||
Can only work, if the chat is a private chat.
|
||||
|
||||
..seealso:: :meth:`get_menu_button`
|
||||
|
||||
.. versionadded:: 13.12
|
||||
|
||||
Returns:
|
||||
:obj:`bool`: On success, :obj:`True` is returned.
|
||||
"""
|
||||
return self.bot.set_chat_menu_button(
|
||||
chat_id=self.id,
|
||||
menu_button=menu_button,
|
||||
timeout=timeout,
|
||||
api_kwargs=api_kwargs,
|
||||
)
|
||||
|
||||
def get_menu_button(
|
||||
self,
|
||||
timeout: ODVInput[float] = DEFAULT_NONE,
|
||||
api_kwargs: JSONDict = None,
|
||||
) -> MenuButton:
|
||||
"""Shortcut for::
|
||||
|
||||
bot.get_chat_menu_button(chat_id=update.effective_chat.id, *args, **kwargs)
|
||||
|
||||
For the documentation of the arguments, please see
|
||||
:meth:`telegram.Bot.set_chat_menu_button`.
|
||||
|
||||
Caution:
|
||||
Can only work, if the chat is a private chat.
|
||||
|
||||
..seealso:: :meth:`set_menu_button`
|
||||
|
||||
.. versionadded:: 13.12
|
||||
|
||||
Returns:
|
||||
:class:`telegram.MenuButton`: On success, the current menu button is returned.
|
||||
"""
|
||||
return self.bot.get_chat_menu_button(
|
||||
chat_id=self.id,
|
||||
timeout=timeout,
|
||||
api_kwargs=api_kwargs,
|
||||
)
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
# pylint: disable=R0903
|
||||
#
|
||||
# A library that provides a Python interface to the Telegram Bot API
|
||||
# Copyright (C) 2015-2021
|
||||
# Copyright (C) 2015-2022
|
||||
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -0,0 +1,167 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# A library that provides a Python interface to the Telegram Bot API
|
||||
# Copyright (C) 2015-2022
|
||||
# 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 the class which represents a Telegram ChatAdministratorRights."""
|
||||
|
||||
from typing import Any
|
||||
|
||||
from telegram import TelegramObject
|
||||
|
||||
|
||||
class ChatAdministratorRights(TelegramObject):
|
||||
"""Represents the rights of an administrator in a chat.
|
||||
Objects of this class are comparable in terms of equality. Two objects of this class are
|
||||
considered equal, if their :attr:`is_anonymous`, :attr:`can_manage_chat`,
|
||||
:attr:`can_delete_messages`, :attr:`can_manage_video_chats`, :attr:`can_restrict_members`,
|
||||
:attr:`can_promote_members`, :attr:`can_change_info`, :attr:`can_invite_users`,
|
||||
:attr:`can_post_messages`, :attr:`can_edit_messages`, :attr:`can_pin_messages` are equal.
|
||||
|
||||
.. seealso: :meth:`Bot.set_my_default_administrator_rights`,
|
||||
:meth:`Bot.get_my_default_administrator_rights`
|
||||
|
||||
.. versionadded:: 13.12
|
||||
|
||||
Args:
|
||||
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, chat statistics, message statistics in channels, see channel members, see
|
||||
anonymous administrators in supergroups 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.
|
||||
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; channels only.
|
||||
can_edit_messages (:obj:`bool`, optional): :obj:`True`, if the administrator can edit
|
||||
messages of other users.
|
||||
can_pin_messages (:obj:`bool`, optional): :obj:`True`, if the user is allowed to pin
|
||||
messages; groups and supergroups only.
|
||||
|
||||
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, chat statistics, message statistics in channels, see channel members, see
|
||||
anonymous administrators in supergroups 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.
|
||||
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; channels only.
|
||||
can_edit_messages (:obj:`bool`): Optional. :obj:`True`, if the administrator can edit
|
||||
messages of other users.
|
||||
can_pin_messages (:obj:`bool`): Optional. :obj:`True`, if the user is allowed to pin
|
||||
messages; groups and supergroups only.
|
||||
"""
|
||||
|
||||
__slots__ = (
|
||||
'is_anonymous',
|
||||
'can_manage_chat',
|
||||
'can_delete_messages',
|
||||
'can_manage_video_chats',
|
||||
'can_restrict_members',
|
||||
'can_promote_members',
|
||||
'can_change_info',
|
||||
'can_invite_users',
|
||||
'can_post_messages',
|
||||
'can_edit_messages',
|
||||
'can_pin_messages',
|
||||
'_id_attrs',
|
||||
)
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
is_anonymous: bool,
|
||||
can_manage_chat: bool,
|
||||
can_delete_messages: bool,
|
||||
can_manage_video_chats: bool,
|
||||
can_restrict_members: bool,
|
||||
can_promote_members: bool,
|
||||
can_change_info: bool,
|
||||
can_invite_users: bool,
|
||||
can_post_messages: bool = None,
|
||||
can_edit_messages: bool = None,
|
||||
can_pin_messages: bool = None,
|
||||
**_kwargs: Any,
|
||||
) -> None:
|
||||
# Required
|
||||
self.is_anonymous = is_anonymous
|
||||
self.can_manage_chat = can_manage_chat
|
||||
self.can_delete_messages = can_delete_messages
|
||||
self.can_manage_video_chats = can_manage_video_chats
|
||||
self.can_restrict_members = can_restrict_members
|
||||
self.can_promote_members = can_promote_members
|
||||
self.can_change_info = can_change_info
|
||||
self.can_invite_users = can_invite_users
|
||||
# Optionals
|
||||
self.can_post_messages = can_post_messages
|
||||
self.can_edit_messages = can_edit_messages
|
||||
self.can_pin_messages = can_pin_messages
|
||||
|
||||
self._id_attrs = (
|
||||
self.is_anonymous,
|
||||
self.can_manage_chat,
|
||||
self.can_delete_messages,
|
||||
self.can_manage_video_chats,
|
||||
self.can_restrict_members,
|
||||
self.can_promote_members,
|
||||
self.can_change_info,
|
||||
self.can_invite_users,
|
||||
self.can_post_messages,
|
||||
self.can_edit_messages,
|
||||
self.can_pin_messages,
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def all_rights(cls) -> 'ChatAdministratorRights':
|
||||
"""
|
||||
This method returns the :class:`ChatAdministratorRights` object with all attributes set to
|
||||
:obj:`True`. This is e.g. useful when changing the bot's default administrator rights with
|
||||
:meth:`telegram.Bot.set_my_default_administrator_rights`.
|
||||
"""
|
||||
return cls(True, True, True, True, True, True, True, True, True, True, True)
|
||||
|
||||
@classmethod
|
||||
def no_rights(cls) -> 'ChatAdministratorRights':
|
||||
"""
|
||||
This method returns the :class:`ChatAdministratorRights` object with all attributes set to
|
||||
:obj:`False`.
|
||||
"""
|
||||
return cls(False, False, False, False, False, False, False, False, False, False, False)
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# A library that provides a Python interface to the Telegram Bot API
|
||||
# Copyright (C) 2015-2021
|
||||
# Copyright (C) 2015-2022
|
||||
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# A library that provides a Python interface to the Telegram Bot API
|
||||
# Copyright (C) 2021
|
||||
# Copyright (C) 2015-2022
|
||||
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
@@ -34,6 +34,12 @@ class ChatJoinRequest(TelegramObject):
|
||||
Objects of this class are comparable in terms of equality. Two objects of this class are
|
||||
considered equal, if their :attr:`chat`, :attr:`from_user` and :attr:`date` are equal.
|
||||
|
||||
Note:
|
||||
Since Bot API 5.5, bots are allowed to contact users who sent a join request to a chat
|
||||
where the bot is an administrator with the
|
||||
:attr:`~telegram.ChatMemberAdministrator.can_invite_users` administrator right – even if
|
||||
the user never interacted with the bot before.
|
||||
|
||||
.. versionadded:: 13.8
|
||||
|
||||
Args:
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# A library that provides a Python interface to the Telegram Bot API
|
||||
# Copyright (C) 2015-2021
|
||||
# Copyright (C) 2015-2022
|
||||
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
||||
+37
-2
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# A library that provides a Python interface to the Telegram Bot API
|
||||
# Copyright (C) 2015-2021
|
||||
# Copyright (C) 2015-2022
|
||||
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
@@ -286,6 +286,7 @@ class ChatMember(TelegramObject):
|
||||
'can_pin_messages',
|
||||
'can_manage_chat',
|
||||
'can_manage_voice_chats',
|
||||
'can_manage_video_chats',
|
||||
'until_date',
|
||||
'_id_attrs',
|
||||
)
|
||||
@@ -327,8 +328,18 @@ class ChatMember(TelegramObject):
|
||||
is_anonymous: bool = None,
|
||||
can_manage_chat: bool = None,
|
||||
can_manage_voice_chats: bool = None,
|
||||
can_manage_video_chats: bool = None,
|
||||
**_kwargs: Any,
|
||||
):
|
||||
# check before required to not waste resources if the error is raised
|
||||
if can_manage_voice_chats is not None and can_manage_video_chats is not None:
|
||||
# if they are the same it's fine...
|
||||
if can_manage_voice_chats != can_manage_video_chats:
|
||||
raise ValueError(
|
||||
"Only supply one of `can_manage_video_chats`/`can_manage_voice_chats`,"
|
||||
" not both."
|
||||
)
|
||||
|
||||
# Required
|
||||
self.user = user
|
||||
self.status = status
|
||||
@@ -353,7 +364,13 @@ class ChatMember(TelegramObject):
|
||||
self.can_add_web_page_previews = can_add_web_page_previews
|
||||
self.is_member = is_member
|
||||
self.can_manage_chat = can_manage_chat
|
||||
self.can_manage_voice_chats = can_manage_voice_chats
|
||||
temp = (
|
||||
can_manage_video_chats
|
||||
if can_manage_video_chats is not None
|
||||
else can_manage_voice_chats
|
||||
)
|
||||
self.can_manage_voice_chats = temp
|
||||
self.can_manage_video_chats = temp
|
||||
|
||||
self._id_attrs = (self.user, self.status)
|
||||
|
||||
@@ -436,6 +453,9 @@ class ChatMemberAdministrator(ChatMember):
|
||||
|
||||
.. versionadded:: 13.7
|
||||
|
||||
.. versionchanged:: 13.12
|
||||
Since Bot API 6.0, voice chat was renamed to video chat.
|
||||
|
||||
Args:
|
||||
user (:class:`telegram.User`): Information about the user.
|
||||
can_be_edited (:obj:`bool`, optional): :obj:`True`, if the bot
|
||||
@@ -456,6 +476,12 @@ class ChatMemberAdministrator(ChatMember):
|
||||
administrator can delete messages of other users.
|
||||
can_manage_voice_chats (:obj:`bool`, optional): :obj:`True`, if the
|
||||
administrator can manage voice chats.
|
||||
|
||||
.. deprecated:: 13.12
|
||||
can_manage_video_chats (:obj:`bool`): :obj:`True`, if the
|
||||
administrator can manage video chats.
|
||||
|
||||
.. versionadded:: 13.12
|
||||
can_restrict_members (:obj:`bool`, optional): :obj:`True`, if the
|
||||
administrator can restrict, ban or unban chat members.
|
||||
can_promote_members (:obj:`bool`, optional): :obj:`True`, if the administrator
|
||||
@@ -491,6 +517,13 @@ class ChatMemberAdministrator(ChatMember):
|
||||
administrator can delete messages of other users.
|
||||
can_manage_voice_chats (:obj:`bool`): Optional. :obj:`True`, if the
|
||||
administrator can manage voice chats.
|
||||
|
||||
.. deprecated:: 13.12 contains the same value as :attr:`can_manage_video_chats`
|
||||
for backwards compatibility.
|
||||
can_manage_video_chats (:obj:`bool`): :obj:`True`, if the
|
||||
administrator can manage video chats.
|
||||
|
||||
.. versionadded:: 13.12
|
||||
can_restrict_members (:obj:`bool`): Optional. :obj:`True`, if the
|
||||
administrator can restrict, ban or unban chat members.
|
||||
can_promote_members (:obj:`bool`): Optional. :obj:`True`, if the administrator
|
||||
@@ -523,6 +556,7 @@ class ChatMemberAdministrator(ChatMember):
|
||||
can_change_info: bool = None,
|
||||
can_invite_users: bool = None,
|
||||
can_pin_messages: bool = None,
|
||||
can_manage_video_chats: bool = None,
|
||||
**_kwargs: Any,
|
||||
):
|
||||
super().__init__(
|
||||
@@ -541,6 +575,7 @@ class ChatMemberAdministrator(ChatMember):
|
||||
can_change_info=can_change_info,
|
||||
can_invite_users=can_invite_users,
|
||||
can_pin_messages=can_pin_messages,
|
||||
can_manage_video_chats=can_manage_video_chats,
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# A library that provides a Python interface to the Telegram Bot API
|
||||
# Copyright (C) 2021
|
||||
# Copyright (C) 2015-2022
|
||||
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# A library that provides a Python interface to the Telegram Bot API
|
||||
# Copyright (C) 2015-2021
|
||||
# Copyright (C) 2015-2022
|
||||
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
# pylint: disable=R0902,R0913
|
||||
#
|
||||
# A library that provides a Python interface to the Telegram Bot API
|
||||
# Copyright (C) 2015-2021
|
||||
# Copyright (C) 2015-2022
|
||||
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
||||
+17
-3
@@ -1,5 +1,5 @@
|
||||
# python-telegram-bot - a Python interface to the Telegram Bot API
|
||||
# Copyright (C) 2015-2021
|
||||
# Copyright (C) 2015-2022
|
||||
# by the python-telegram-bot contributors <devs@python-telegram-bot.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
@@ -21,7 +21,7 @@ The following constants were extracted from the
|
||||
`Telegram Bots API <https://core.telegram.org/bots/api>`_.
|
||||
|
||||
Attributes:
|
||||
BOT_API_VERSION (:obj:`str`): `5.3`. Telegram Bot API version supported by this
|
||||
BOT_API_VERSION (:obj:`str`): `6.1`. Telegram Bot API version supported by this
|
||||
version of `python-telegram-bot`. Also available as ``telegram.bot_api_version``.
|
||||
|
||||
.. versionadded:: 13.4
|
||||
@@ -48,6 +48,10 @@ Attributes:
|
||||
ANONYMOUS_ADMIN_ID (:obj:`int`): ``1087968824`` (User id in groups for anonymous admin)
|
||||
SERVICE_CHAT_ID (:obj:`int`): ``777000`` (Telegram service chat, that also acts as sender of
|
||||
channel posts forwarded to discussion groups)
|
||||
FAKE_CHANNEL_ID (:obj:`int`): ``136817688`` (User id in groups when message is sent on behalf
|
||||
of a channel).
|
||||
|
||||
.. versionadded:: 13.9
|
||||
|
||||
The following constants are related to specific classes and are also available
|
||||
as attributes of those classes:
|
||||
@@ -137,6 +141,9 @@ Attributes:
|
||||
MESSAGEENTITY_TEXT_MENTION (:obj:`str`): ``'text_mention'``
|
||||
MESSAGEENTITY_UNDERLINE (:obj:`str`): ``'underline'``
|
||||
MESSAGEENTITY_STRIKETHROUGH (:obj:`str`): ``'strikethrough'``
|
||||
MESSAGEENTITY_SPOILER (:obj:`str`): ``'spoiler'``
|
||||
|
||||
.. versionadded:: 13.10
|
||||
MESSAGEENTITY_ALL_TYPES (List[:obj:`str`]): List of all the types of message entity.
|
||||
|
||||
:class:`telegram.ParseMode`:
|
||||
@@ -240,11 +247,12 @@ Attributes:
|
||||
"""
|
||||
from typing import List
|
||||
|
||||
BOT_API_VERSION: str = '5.4'
|
||||
BOT_API_VERSION: str = '6.1'
|
||||
MAX_MESSAGE_LENGTH: int = 4096
|
||||
MAX_CAPTION_LENGTH: int = 1024
|
||||
ANONYMOUS_ADMIN_ID: int = 1087968824
|
||||
SERVICE_CHAT_ID: int = 777000
|
||||
FAKE_CHANNEL_ID: int = 136817688
|
||||
|
||||
# constants above this line are tested
|
||||
|
||||
@@ -316,6 +324,7 @@ MESSAGEENTITY_TEXT_LINK: str = 'text_link'
|
||||
MESSAGEENTITY_TEXT_MENTION: str = 'text_mention'
|
||||
MESSAGEENTITY_UNDERLINE: str = 'underline'
|
||||
MESSAGEENTITY_STRIKETHROUGH: str = 'strikethrough'
|
||||
MESSAGEENTITY_SPOILER: str = 'spoiler'
|
||||
MESSAGEENTITY_ALL_TYPES: List[str] = [
|
||||
MESSAGEENTITY_MENTION,
|
||||
MESSAGEENTITY_HASHTAG,
|
||||
@@ -332,6 +341,7 @@ MESSAGEENTITY_ALL_TYPES: List[str] = [
|
||||
MESSAGEENTITY_TEXT_MENTION,
|
||||
MESSAGEENTITY_UNDERLINE,
|
||||
MESSAGEENTITY_STRIKETHROUGH,
|
||||
MESSAGEENTITY_SPOILER,
|
||||
]
|
||||
|
||||
PARSEMODE_MARKDOWN: str = 'Markdown'
|
||||
@@ -386,3 +396,7 @@ BOT_COMMAND_SCOPE_ALL_CHAT_ADMINISTRATORS = 'all_chat_administrators'
|
||||
BOT_COMMAND_SCOPE_CHAT = 'chat'
|
||||
BOT_COMMAND_SCOPE_CHAT_ADMINISTRATORS = 'chat_administrators'
|
||||
BOT_COMMAND_SCOPE_CHAT_MEMBER = 'chat_member'
|
||||
|
||||
MENU_BUTTON_COMMANDS = 'commands'
|
||||
MENU_BUTTON_WEB_APP = 'web_app'
|
||||
MENU_BUTTON_DEFAULT = 'default'
|
||||
|
||||
+4
-3
@@ -2,7 +2,7 @@
|
||||
# pylint: disable=R0903
|
||||
#
|
||||
# A library that provides a Python interface to the Telegram Bot API
|
||||
# Copyright (C) 2015-2021
|
||||
# Copyright (C) 2015-2022
|
||||
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
@@ -50,8 +50,9 @@ class Dice(TelegramObject):
|
||||
Telegram.
|
||||
|
||||
If :attr:`emoji` is "🎰", each value corresponds to a unique combination of symbols, which
|
||||
can be found at our `wiki <https://git.io/JkeC6>`_. However, this behaviour is undocumented
|
||||
and might be changed by Telegram.
|
||||
can be found at our `wiki <https://github.com/python-telegram-bot/python-telegram-bot/\
|
||||
wiki/Code-snippets#map-a-slot-machine-dice-value-to-the-corresponding-symbols>`_.
|
||||
However, this behaviour is undocumented and might be changed by Telegram.
|
||||
|
||||
Args:
|
||||
value (:obj:`int`): Value of the dice. 1-6 for dice, darts and bowling balls, 1-5 for
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# A library that provides a Python interface to the Telegram Bot API
|
||||
# Copyright (C) 2015-2021
|
||||
# Copyright (C) 2015-2022
|
||||
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# A library that provides a Python interface to the Telegram Bot API
|
||||
# Copyright (C) 2015-2021
|
||||
# Copyright (C) 2015-2022
|
||||
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
@@ -16,7 +16,6 @@
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser Public License
|
||||
# along with this program. If not, see [http://www.gnu.org/licenses/].
|
||||
# pylint: disable=C0413
|
||||
"""Extensions over the Telegram Bot API to facilitate bot making"""
|
||||
|
||||
from .extbot import ExtBot
|
||||
@@ -28,17 +27,6 @@ from .callbackcontext import CallbackContext
|
||||
from .contexttypes import ContextTypes
|
||||
from .dispatcher import Dispatcher, DispatcherHandlerStop, run_async
|
||||
|
||||
# https://bugs.python.org/issue41451, fixed on 3.7+, doesn't actually remove slots
|
||||
# try-except is just here in case the __init__ is called twice (like in the tests)
|
||||
# this block is also the reason for the pylint-ignore at the top of the file
|
||||
try:
|
||||
del Dispatcher.__slots__
|
||||
except AttributeError as exc:
|
||||
if str(exc) == '__slots__':
|
||||
pass
|
||||
else:
|
||||
raise exc
|
||||
|
||||
from .jobqueue import JobQueue, Job
|
||||
from .updater import Updater
|
||||
from .callbackqueryhandler import CallbackQueryHandler
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# A library that provides a Python interface to the Telegram Bot API
|
||||
# Copyright (C) 2015-2021
|
||||
# Copyright (C) 2015-2022
|
||||
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# A library that provides a Python interface to the Telegram Bot API
|
||||
# Copyright (C) 2015-2021
|
||||
# Copyright (C) 2015-2022
|
||||
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
@@ -139,7 +139,9 @@ class CallbackContext(Generic[UD, CD, BD]):
|
||||
@bot_data.setter
|
||||
def bot_data(self, value: object) -> NoReturn:
|
||||
raise AttributeError(
|
||||
"You can not assign a new value to bot_data, see https://git.io/Jt6ic"
|
||||
"You can not assign a new value to bot_data, "
|
||||
"see https://github.com/python-telegram-bot/python-telegram-bot/wiki/Storing-bot%2C"
|
||||
"-user-and-chat-related-data "
|
||||
)
|
||||
|
||||
@property
|
||||
@@ -160,7 +162,9 @@ class CallbackContext(Generic[UD, CD, BD]):
|
||||
@chat_data.setter
|
||||
def chat_data(self, value: object) -> NoReturn:
|
||||
raise AttributeError(
|
||||
"You can not assign a new value to chat_data, see https://git.io/Jt6ic"
|
||||
"You can not assign a new value to chat_data, "
|
||||
"see https://github.com/python-telegram-bot/python-telegram-bot/wiki/Storing-bot%2C"
|
||||
"-user-and-chat-related-data "
|
||||
)
|
||||
|
||||
@property
|
||||
@@ -175,7 +179,9 @@ class CallbackContext(Generic[UD, CD, BD]):
|
||||
@user_data.setter
|
||||
def user_data(self, value: object) -> NoReturn:
|
||||
raise AttributeError(
|
||||
"You can not assign a new value to user_data, see https://git.io/Jt6ic"
|
||||
"You can not assign a new value to user_data, "
|
||||
"see https://github.com/python-telegram-bot/python-telegram-bot/wiki/Storing-bot%2C"
|
||||
"-user-and-chat-related-data "
|
||||
)
|
||||
|
||||
def refresh_data(self) -> None:
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
#
|
||||
# A library that provides a Python interface to the Telegram Bot API
|
||||
# Copyright (C) 2015-2021
|
||||
# Copyright (C) 2015-2022
|
||||
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
@@ -17,24 +16,6 @@
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser Public License
|
||||
# along with this program. If not, see [http://www.gnu.org/licenses/].
|
||||
|
||||
#
|
||||
# A library that provides a Python interface to the Telegram Bot API
|
||||
# Copyright (C) 2015-2021
|
||||
# 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 the CallbackDataCache class."""
|
||||
import logging
|
||||
import time
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# A library that provides a Python interface to the Telegram Bot API
|
||||
# Copyright (C) 2015-2021
|
||||
# Copyright (C) 2015-2022
|
||||
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
@@ -55,7 +55,8 @@ class CallbackQueryHandler(Handler[Update, CCT]):
|
||||
user or in the same chat, it will be the same ``dict``.
|
||||
|
||||
Note that this is DEPRECATED, and you should use context based callbacks. See
|
||||
https://git.io/fxJuV for more info.
|
||||
https://github.com/python-telegram-bot/python-telegram-bot/wiki\
|
||||
/Transition-guide-to-Version-12.0 for more info.
|
||||
* If your bot allows arbitrary objects as ``callback_data``, it may happen that the
|
||||
original ``callback_data`` for the incoming :class:`telegram.CallbackQuery`` can not be
|
||||
found. This is the case when either a malicious client tempered with the
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# A library that provides a Python interface to the Telegram Bot API
|
||||
# Copyright (C) 2021
|
||||
# Copyright (C) 2015-2022
|
||||
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
@@ -35,13 +35,14 @@ class ChatJoinRequestHandler(Handler[Update, CCT]):
|
||||
or in the same chat, it will be the same ``dict``.
|
||||
|
||||
Note that this is DEPRECATED, and you should use context based callbacks. See
|
||||
https://git.io/fxJuV for more info.
|
||||
https://github.com/python-telegram-bot/python-telegram-bot/wiki\
|
||||
/Transition-guide-to-Version-12.0 for more info.
|
||||
|
||||
Warning:
|
||||
When setting ``run_async`` to :obj:`True`, you cannot rely on adding custom
|
||||
attributes to :class:`telegram.ext.CallbackContext`. See its docs for more info.
|
||||
|
||||
.. versionadded:: 13.8
|
||||
.. versionadded:: 13.8
|
||||
|
||||
Args:
|
||||
callback (:obj:`callable`): The callback function for this handler. Will be called when
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# A library that provides a Python interface to the Telegram Bot API
|
||||
# Copyright (C) 2019-2021
|
||||
# Copyright (C) 2015-2022
|
||||
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
@@ -39,7 +39,8 @@ class ChatMemberHandler(Handler[Update, CCT]):
|
||||
or in the same chat, it will be the same ``dict``.
|
||||
|
||||
Note that this is DEPRECATED, and you should use context based callbacks. See
|
||||
https://git.io/fxJuV for more info.
|
||||
https://github.com/python-telegram-bot/python-telegram-bot/wiki\
|
||||
/Transition-guide-to-Version-12.0 for more info.
|
||||
|
||||
Warning:
|
||||
When setting ``run_async`` to :obj:`True`, you cannot rely on adding custom
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# A library that provides a Python interface to the Telegram Bot API
|
||||
# Copyright (C) 2015-2021
|
||||
# Copyright (C) 2015-2022
|
||||
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
@@ -42,7 +42,8 @@ class ChosenInlineResultHandler(Handler[Update, CCT]):
|
||||
or in the same chat, it will be the same ``dict``.
|
||||
|
||||
Note that this is DEPRECATED, and you should use context based callbacks. See
|
||||
https://git.io/fxJuV for more info.
|
||||
https://github.com/python-telegram-bot/python-telegram-bot/wiki\
|
||||
/Transition-guide-to-Version-12.0 for more info.
|
||||
|
||||
Warning:
|
||||
When setting ``run_async`` to :obj:`True`, you cannot rely on adding custom
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# A library that provides a Python interface to the Telegram Bot API
|
||||
# Copyright (C) 2015-2021
|
||||
# Copyright (C) 2015-2022
|
||||
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
@@ -55,7 +55,8 @@ class CommandHandler(Handler[Update, CCT]):
|
||||
user or in the same chat, it will be the same :obj:`dict`.
|
||||
|
||||
Note that this is DEPRECATED, and you should use context based callbacks. See
|
||||
https://git.io/fxJuV for more info.
|
||||
https://github.com/python-telegram-bot/python-telegram-bot/wiki\
|
||||
/Transition-guide-to-Version-12.0 for more info.
|
||||
|
||||
Warning:
|
||||
When setting ``run_async`` to :obj:`True`, you cannot rely on adding custom
|
||||
@@ -169,7 +170,9 @@ class CommandHandler(Handler[Update, CCT]):
|
||||
|
||||
if allow_edited is not None:
|
||||
warnings.warn(
|
||||
'allow_edited is deprecated. See https://git.io/fxJuV for more info',
|
||||
'allow_edited is deprecated. See '
|
||||
'https://github.com/python-telegram-bot/python-telegram-bot/wiki/Transition'
|
||||
'-guide-to-Version-12.0 for more info',
|
||||
TelegramDeprecationWarning,
|
||||
stacklevel=2,
|
||||
)
|
||||
@@ -288,7 +291,8 @@ class PrefixHandler(CommandHandler):
|
||||
user or in the same chat, it will be the same :obj:`dict`.
|
||||
|
||||
Note that this is DEPRECATED, and you should use context based callbacks. See
|
||||
https://git.io/fxJuV for more info.
|
||||
https://github.com/python-telegram-bot/python-telegram-bot/wiki\
|
||||
/Transition-guide-to-Version-12.0 for more info.
|
||||
|
||||
Warning:
|
||||
When setting ``run_async`` to :obj:`True`, you cannot rely on adding custom
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# A library that provides a Python interface to the Telegram Bot API
|
||||
# Copyright (C) 2020
|
||||
# Copyright (C) 2015-2022
|
||||
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
@@ -50,7 +50,8 @@ class ContextTypes(Generic[CCT, UD, CD, BD]):
|
||||
|
||||
__slots__ = ('_context', '_bot_data', '_chat_data', '_user_data')
|
||||
|
||||
# overload signatures generated with https://git.io/JtJPj
|
||||
# overload signatures generated with
|
||||
# https://gist.github.com/Bibo-Joshi/399382cda537fb01bd86b13c3d03a956
|
||||
|
||||
@overload
|
||||
def __init__(
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# A library that provides a Python interface to the Telegram Bot API
|
||||
# Copyright (C) 2015-2021
|
||||
# Copyright (C) 2015-2022
|
||||
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
@@ -79,7 +79,8 @@ class ConversationHandler(Handler[Update, CCT]):
|
||||
|
||||
Finally, ``ConversationHandler``, does *not* handle (edited) channel posts.
|
||||
|
||||
.. _`FAQ`: https://git.io/JtcyU
|
||||
.. _`FAQ`: https://github.com/python-telegram-bot/python-telegram-bot/wiki\
|
||||
/Frequently-Asked-Questions#what-do-the-per_-settings-in-conversationhandler-do
|
||||
|
||||
The first collection, a ``list`` named :attr:`entry_points`, is used to initiate the
|
||||
conversation, for example with a :class:`telegram.ext.CommandHandler` or
|
||||
@@ -119,7 +120,7 @@ class ConversationHandler(Handler[Update, CCT]):
|
||||
:attr:`END` to end the *parent* conversation from within the nested one. For an example on
|
||||
nested :class:`ConversationHandler` s, see our `examples`_.
|
||||
|
||||
.. _`examples`: https://github.com/python-telegram-bot/python-telegram-bot/blob/master/examples
|
||||
.. _`examples`: https://github.com/python-telegram-bot/python-telegram-bot/blob/v13.x/examples
|
||||
|
||||
Args:
|
||||
entry_points (List[:class:`telegram.ext.Handler`]): A list of ``Handler`` objects that can
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# A library that provides a Python interface to the Telegram Bot API
|
||||
# Copyright (C) 2020-2021
|
||||
# Copyright (C) 2015-2022
|
||||
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# A library that provides a Python interface to the Telegram Bot API
|
||||
# Copyright (C) 2015-2021
|
||||
# Copyright (C) 2015-2022
|
||||
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# A library that provides a Python interface to the Telegram Bot API
|
||||
# Copyright (C) 2015-2021
|
||||
# Copyright (C) 2015-2022
|
||||
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
@@ -241,7 +241,9 @@ class Dispatcher(Generic[CCT, UD, CD, BD]):
|
||||
|
||||
if not use_context:
|
||||
warnings.warn(
|
||||
'Old Handler API is deprecated - see https://git.io/fxJuV for details',
|
||||
'Old Handler API is deprecated - see '
|
||||
'https://github.com/python-telegram-bot/python-telegram-bot/wiki/Transition'
|
||||
'-guide-to-Version-12.0 for details',
|
||||
TelegramDeprecationWarning,
|
||||
stacklevel=3,
|
||||
)
|
||||
@@ -356,7 +358,7 @@ class Dispatcher(Generic[CCT, UD, CD, BD]):
|
||||
raise RuntimeError(f'{cls.__name__} not initialized or multiple instances exist')
|
||||
|
||||
def _pooled(self) -> None:
|
||||
thr_name = current_thread().getName()
|
||||
thr_name = current_thread().name
|
||||
while 1:
|
||||
promise = self.__async_queue.get()
|
||||
|
||||
@@ -763,7 +765,8 @@ class Dispatcher(Generic[CCT, UD, CD, BD]):
|
||||
asynchronously using :meth:`run_async`. Defaults to :obj:`False`.
|
||||
|
||||
Note:
|
||||
See https://git.io/fxJuV for more info about switching to context based API.
|
||||
See https://github.com/python-telegram-bot/python-telegram-bot/wiki\
|
||||
/Transition-guide-to-Version-12.0 for more info about switching to context based API.
|
||||
"""
|
||||
if callback in self.error_handlers:
|
||||
self.logger.debug('The callback is already registered as an error handler. Ignoring.')
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
# pylint: disable=E0611,E0213,E1102,C0103,E1101,R0913,R0904
|
||||
#
|
||||
# A library that provides a Python interface to the Telegram Bot API
|
||||
# Copyright (C) 2015-2021
|
||||
# Copyright (C) 2015-2022
|
||||
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
@@ -62,7 +62,9 @@ class ExtBot(telegram.bot.Bot):
|
||||
arbitrary_callback_data (:obj:`bool` | :obj:`int`, optional): Whether to
|
||||
allow arbitrary objects as callback data for :class:`telegram.InlineKeyboardButton`.
|
||||
Pass an integer to specify the maximum number of objects cached in memory. For more
|
||||
details, please see our `wiki <https://git.io/JGBDI>`_. Defaults to :obj:`False`.
|
||||
details, please see our `wiki <https://github.com/python-telegram-bot/\
|
||||
python-telegram-bot/wiki/Arbitrary-callback_data>`_.
|
||||
Defaults to :obj:`False`.
|
||||
|
||||
Attributes:
|
||||
arbitrary_callback_data (:obj:`bool` | :obj:`int`): Whether this bot instance
|
||||
@@ -193,6 +195,7 @@ class ExtBot(telegram.bot.Bot):
|
||||
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
|
||||
timeout: ODVInput[float] = DEFAULT_NONE,
|
||||
api_kwargs: JSONDict = None,
|
||||
protect_content: bool = None,
|
||||
) -> Union[bool, Message]:
|
||||
# We override this method to call self._replace_keyboard and self._insert_callback_data.
|
||||
# This covers most methods that have a reply_markup
|
||||
@@ -205,6 +208,7 @@ class ExtBot(telegram.bot.Bot):
|
||||
allow_sending_without_reply=allow_sending_without_reply,
|
||||
timeout=timeout,
|
||||
api_kwargs=api_kwargs,
|
||||
protect_content=protect_content,
|
||||
)
|
||||
if isinstance(result, Message):
|
||||
self._insert_callback_data(result)
|
||||
@@ -299,6 +303,7 @@ class ExtBot(telegram.bot.Bot):
|
||||
reply_markup: ReplyMarkup = None,
|
||||
timeout: ODVInput[float] = DEFAULT_NONE,
|
||||
api_kwargs: JSONDict = None,
|
||||
protect_content: bool = None,
|
||||
) -> MessageId:
|
||||
# We override this method to call self._replace_keyboard
|
||||
return super().copy_message(
|
||||
@@ -314,6 +319,7 @@ class ExtBot(telegram.bot.Bot):
|
||||
reply_markup=self._replace_keyboard(reply_markup),
|
||||
timeout=timeout,
|
||||
api_kwargs=api_kwargs,
|
||||
protect_content=protect_content,
|
||||
)
|
||||
|
||||
def get_chat(
|
||||
|
||||
+141
-5
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# A library that provides a Python interface to the Telegram Bot API
|
||||
# Copyright (C) 2015-2021
|
||||
# Copyright (C) 2015-2022
|
||||
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
@@ -1004,6 +1004,38 @@ officedocument.wordprocessingml.document")``.
|
||||
location = _Location()
|
||||
"""Messages that contain :class:`telegram.Location`."""
|
||||
|
||||
class _UserAttachment(UpdateFilter):
|
||||
__slots__ = ()
|
||||
name = "Filters.user_attachment"
|
||||
|
||||
def filter(self, update: Update) -> bool:
|
||||
return bool(update.effective_user) and bool(
|
||||
update.effective_user.added_to_attachment_menu
|
||||
)
|
||||
|
||||
user_attachment = _UserAttachment()
|
||||
"""This filter filters *any* message that have a user who added the bot to their
|
||||
:attr:`attachment menu <telegram.User.added_to_attachment_menu>` as
|
||||
:attr:`telegram.Update.effective_user`.
|
||||
|
||||
.. versionadded:: 13.13
|
||||
"""
|
||||
|
||||
class _UserPremium(UpdateFilter):
|
||||
__slots__ = ()
|
||||
name = "Filters.premium_user"
|
||||
|
||||
def filter(self, update: Update) -> bool:
|
||||
return bool(update.effective_user) and bool(update.effective_user.is_premium)
|
||||
|
||||
premium_user = _UserPremium()
|
||||
"""This filter filters *any* message from a
|
||||
:attr:`Telegram Premium user <telegram.User.is_premium>` as
|
||||
:attr:`telegram.Update.effective_user`.
|
||||
|
||||
.. versionadded:: 13.13
|
||||
"""
|
||||
|
||||
class _Venue(MessageFilter):
|
||||
__slots__ = ()
|
||||
name = 'Filters.venue'
|
||||
@@ -1182,6 +1214,56 @@ officedocument.wordprocessingml.document")``.
|
||||
voice_chat_participants_invited = _VoiceChatParticipantsInvited()
|
||||
"""Messages that contain :attr:`telegram.Message.voice_chat_participants_invited`."""
|
||||
|
||||
class _VideoChatScheduled(MessageFilter):
|
||||
__slots__ = ()
|
||||
name = 'Filters.status_update.video_chat_scheduled'
|
||||
|
||||
def filter(self, message: Message) -> bool:
|
||||
return bool(message.video_chat_scheduled)
|
||||
|
||||
video_chat_scheduled = _VideoChatScheduled()
|
||||
"""Messages that contain :attr:`telegram.Message.video_chat_scheduled`."""
|
||||
|
||||
class _VideoChatStarted(MessageFilter):
|
||||
__slots__ = ()
|
||||
name = 'Filters.status_update.video_chat_started'
|
||||
|
||||
def filter(self, message: Message) -> bool:
|
||||
return bool(message.video_chat_started)
|
||||
|
||||
video_chat_started = _VideoChatStarted()
|
||||
"""Messages that contain :attr:`telegram.Message.video_chat_started`."""
|
||||
|
||||
class _VideoChatEnded(MessageFilter):
|
||||
__slots__ = ()
|
||||
name = 'Filters.status_update.video_chat_ended'
|
||||
|
||||
def filter(self, message: Message) -> bool:
|
||||
return bool(message.video_chat_ended)
|
||||
|
||||
video_chat_ended = _VideoChatEnded()
|
||||
"""Messages that contain :attr:`telegram.Message.voice_chat_ended`."""
|
||||
|
||||
class _VideoChatParticipantsInvited(MessageFilter):
|
||||
__slots__ = ()
|
||||
name = 'Filters.status_update.video_chat_participants_invited'
|
||||
|
||||
def filter(self, message: Message) -> bool:
|
||||
return bool(message.video_chat_participants_invited)
|
||||
|
||||
video_chat_participants_invited = _VideoChatParticipantsInvited()
|
||||
"""Messages that contain :attr:`telegram.Message.video_chat_participants_invited`."""
|
||||
|
||||
class _WebAppData(MessageFilter):
|
||||
__slots__ = ()
|
||||
name = 'Filters.status_update.web_app_data'
|
||||
|
||||
def filter(self, message: Message) -> bool:
|
||||
return bool(message.web_app_data)
|
||||
|
||||
web_app_data = _WebAppData()
|
||||
"""Messages that contain :attr:`telegram.Message.web_app_data`."""
|
||||
|
||||
name = 'Filters.status_update'
|
||||
|
||||
def filter(self, message: Update) -> bool:
|
||||
@@ -1201,6 +1283,11 @@ officedocument.wordprocessingml.document")``.
|
||||
or self.voice_chat_started(message)
|
||||
or self.voice_chat_ended(message)
|
||||
or self.voice_chat_participants_invited(message)
|
||||
or self.video_chat_scheduled(message)
|
||||
or self.video_chat_started(message)
|
||||
or self.video_chat_ended(message)
|
||||
or self.video_chat_participants_invited(message)
|
||||
or self.web_app_data(message)
|
||||
)
|
||||
|
||||
status_update = _StatusUpdate()
|
||||
@@ -1242,18 +1329,38 @@ officedocument.wordprocessingml.document")``.
|
||||
:attr:`telegram.Message.voice_chat_scheduled`.
|
||||
|
||||
.. versionadded:: 13.5
|
||||
.. deprecated:: 13.12
|
||||
voice_chat_started: Messages that contain
|
||||
:attr:`telegram.Message.voice_chat_started`.
|
||||
|
||||
.. versionadded:: 13.4
|
||||
.. deprecated:: 13.12
|
||||
voice_chat_ended: Messages that contain
|
||||
:attr:`telegram.Message.voice_chat_ended`.
|
||||
|
||||
.. versionadded:: 13.4
|
||||
.. deprecated:: 13.12
|
||||
voice_chat_participants_invited: Messages that contain
|
||||
:attr:`telegram.Message.voice_chat_participants_invited`.
|
||||
|
||||
.. versionadded:: 13.4
|
||||
.. deprecated:: 13.12
|
||||
video_chat_scheduled: Messages that contain
|
||||
:attr:`telegram.Message.video_chat_scheduled`.
|
||||
|
||||
.. versionadded:: 13.12
|
||||
video_chat_started: Messages that contain
|
||||
:attr:`telegram.Message.video_chat_started`.
|
||||
|
||||
.. versionadded:: 13.12
|
||||
video_chat_ended: Messages that contain
|
||||
:attr:`telegram.Message.video_chat_ended`.
|
||||
|
||||
.. versionadded:: 13.12
|
||||
video_chat_participants_invited: Messages that contain
|
||||
:attr:`telegram.Message.video_chat_participants_invited`.
|
||||
|
||||
.. versionadded:: 13.12
|
||||
|
||||
"""
|
||||
|
||||
@@ -1965,16 +2072,16 @@ officedocument.wordprocessingml.document")``.
|
||||
|
||||
class sender_chat(_ChatUserBaseFilter):
|
||||
# pylint: disable=W0235
|
||||
"""Filters messages to allow only those which are from a specified sender chats chat ID or
|
||||
"""Filters messages to allow only those which are from a specified sender chat's chat ID or
|
||||
username.
|
||||
|
||||
Examples:
|
||||
* To filter for messages forwarded to a discussion group from a channel with ID
|
||||
* To filter for messages sent to a group by a channel with ID
|
||||
``-1234``, use ``MessageHandler(Filters.sender_chat(-1234), callback_method)``.
|
||||
* To filter for messages of anonymous admins in a super group with username
|
||||
``@anonymous``, use
|
||||
``MessageHandler(Filters.sender_chat(username='anonymous'), callback_method)``.
|
||||
* To filter for messages forwarded to a discussion group from *any* channel, use
|
||||
* To filter for messages sent to a group by *any* channel, use
|
||||
``MessageHandler(Filters.sender_chat.channel, callback_method)``.
|
||||
* To filter for messages of anonymous admins in *any* super group, use
|
||||
``MessageHandler(Filters.sender_chat.super_group, callback_method)``.
|
||||
@@ -1983,7 +2090,10 @@ officedocument.wordprocessingml.document")``.
|
||||
Remember, ``sender_chat`` is also set for messages in a channel as the channel itself,
|
||||
so when your bot is an admin in a channel and the linked discussion group, you would
|
||||
receive the message twice (once from inside the channel, once inside the discussion
|
||||
group).
|
||||
group). Since v13.9, the field :attr:`telegram.Message.is_automatic_forward` will be
|
||||
:obj:`True` for the discussion group message.
|
||||
|
||||
.. seealso:: :attr:`Filters.is_automatic_forward`
|
||||
|
||||
Warning:
|
||||
:attr:`chat_ids` will return a *copy* of the saved chat ids as :class:`frozenset`. This
|
||||
@@ -2089,6 +2199,32 @@ officedocument.wordprocessingml.document")``.
|
||||
super_group = _SuperGroup()
|
||||
channel = _Channel()
|
||||
|
||||
class _IsAutomaticForward(MessageFilter):
|
||||
__slots__ = ()
|
||||
name = 'Filters.is_automatic_forward'
|
||||
|
||||
def filter(self, message: Message) -> bool:
|
||||
return bool(message.is_automatic_forward)
|
||||
|
||||
is_automatic_forward = _IsAutomaticForward()
|
||||
"""Messages that contain :attr:`telegram.Message.is_automatic_forward`.
|
||||
|
||||
.. versionadded:: 13.9
|
||||
"""
|
||||
|
||||
class _HasProtectedContent(MessageFilter):
|
||||
__slots__ = ()
|
||||
name = 'Filters.has_protected_content'
|
||||
|
||||
def filter(self, message: Message) -> bool:
|
||||
return bool(message.has_protected_content)
|
||||
|
||||
has_protected_content = _HasProtectedContent()
|
||||
"""Messages that contain :attr:`telegram.Message.has_protected_content`.
|
||||
|
||||
.. versionadded:: 13.9
|
||||
"""
|
||||
|
||||
class _Invoice(MessageFilter):
|
||||
__slots__ = ()
|
||||
name = 'Filters.invoice'
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# A library that provides a Python interface to the Telegram Bot API
|
||||
# Copyright (C) 2015-2021
|
||||
# Copyright (C) 2015-2022
|
||||
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
@@ -45,7 +45,8 @@ class Handler(Generic[UT, CCT], ABC):
|
||||
or in the same chat, it will be the same ``dict``.
|
||||
|
||||
Note that this is DEPRECATED, and you should use context based callbacks. See
|
||||
https://git.io/fxJuV for more info.
|
||||
https://github.com/python-telegram-bot/python-telegram-bot/wiki\
|
||||
/Transition-guide-to-Version-12.0 for more info.
|
||||
|
||||
Warning:
|
||||
When setting ``run_async`` to :obj:`True`, you cannot rely on adding custom
|
||||
@@ -232,7 +233,8 @@ class Handler(Generic[UT, CCT], ABC):
|
||||
it should subclass this method, but remember to call this super method.
|
||||
|
||||
DEPRECATED: This method is being replaced by new context based callbacks. Please see
|
||||
https://git.io/fxJuV for more info.
|
||||
https://github.com/python-telegram-bot/python-telegram-bot/wiki\
|
||||
/Transition-guide-to-Version-12.0 for more info.
|
||||
|
||||
Args:
|
||||
dispatcher (:class:`telegram.ext.Dispatcher`): The dispatcher.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# A library that provides a Python interface to the Telegram Bot API
|
||||
# Copyright (C) 2015-2021
|
||||
# Copyright (C) 2015-2022
|
||||
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
@@ -55,7 +55,8 @@ class InlineQueryHandler(Handler[Update, CCT]):
|
||||
or in the same chat, it will be the same ``dict``.
|
||||
|
||||
Note that this is DEPRECATED, and you should use context based callbacks. See
|
||||
https://git.io/fxJuV for more info.
|
||||
https://github.com/python-telegram-bot/python-telegram-bot/wiki\
|
||||
/Transition-guide-to-Version-12.0 for more info.
|
||||
|
||||
Warning:
|
||||
* When setting ``run_async`` to :obj:`True`, you cannot rely on adding custom
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# A library that provides a Python interface to the Telegram Bot API
|
||||
# Copyright (C) 2015-2021
|
||||
# Copyright (C) 2015-2022
|
||||
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# A library that provides a Python interface to the Telegram Bot API
|
||||
# Copyright (C) 2015-2021
|
||||
# Copyright (C) 2015-2022
|
||||
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
@@ -45,7 +45,8 @@ class MessageHandler(Handler[Update, CCT]):
|
||||
or in the same chat, it will be the same ``dict``.
|
||||
|
||||
Note that this is DEPRECATED, and you should use context based callbacks. See
|
||||
https://git.io/fxJuV for more info.
|
||||
https://github.com/python-telegram-bot/python-telegram-bot/wiki\
|
||||
/Transition-guide-to-Version-12.0 for more info.
|
||||
|
||||
Warning:
|
||||
When setting ``run_async`` to :obj:`True`, you cannot rely on adding custom
|
||||
@@ -155,7 +156,9 @@ class MessageHandler(Handler[Update, CCT]):
|
||||
self.filters = Filters.update
|
||||
if message_updates is not None:
|
||||
warnings.warn(
|
||||
'message_updates is deprecated. See https://git.io/fxJuV for more info',
|
||||
'message_updates is deprecated. See '
|
||||
'https://github.com/python-telegram-bot/python-telegram-bot/wiki/Transition'
|
||||
'-guide-to-Version-12.0 for more info',
|
||||
TelegramDeprecationWarning,
|
||||
stacklevel=2,
|
||||
)
|
||||
@@ -164,7 +167,10 @@ class MessageHandler(Handler[Update, CCT]):
|
||||
|
||||
if channel_post_updates is not None:
|
||||
warnings.warn(
|
||||
'channel_post_updates is deprecated. See https://git.io/fxJuV ' 'for more info',
|
||||
'channel_post_updates is deprecated. See '
|
||||
'https://github.com/python-telegram-bot/python-telegram-bot/wiki/Transition'
|
||||
'-guide-to-Version-12.0 '
|
||||
'for more info',
|
||||
TelegramDeprecationWarning,
|
||||
stacklevel=2,
|
||||
)
|
||||
@@ -173,7 +179,9 @@ class MessageHandler(Handler[Update, CCT]):
|
||||
|
||||
if edited_updates is not None:
|
||||
warnings.warn(
|
||||
'edited_updates is deprecated. See https://git.io/fxJuV for more info',
|
||||
'edited_updates is deprecated. See '
|
||||
'https://github.com/python-telegram-bot/python-telegram-bot/wiki/Transition'
|
||||
'-guide-to-Version-12.0 for more info',
|
||||
TelegramDeprecationWarning,
|
||||
stacklevel=2,
|
||||
)
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
# Tymofii A. Khodniev (thodnev) <thodnev@mail.ru>
|
||||
#
|
||||
# A library that provides a Python interface to the Telegram Bot API
|
||||
# Copyright (C) 2015-2021
|
||||
# Copyright (C) 2015-2022
|
||||
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
@@ -50,7 +50,8 @@ class DelayQueue(threading.Thread):
|
||||
|
||||
.. deprecated:: 13.3
|
||||
:class:`telegram.ext.DelayQueue` in its current form is deprecated and will be reinvented
|
||||
in a future release. See `this thread <https://git.io/JtDbF>`_ for a list of known bugs.
|
||||
in a future release. See `this thread <https://github.com/python-telegram-bot/\
|
||||
python-telegram-bot/issues/2139>`_ for a list of known bugs.
|
||||
|
||||
Args:
|
||||
queue (:obj:`Queue`, optional): Used to pass callbacks to thread. Creates ``Queue``
|
||||
@@ -92,7 +93,8 @@ class DelayQueue(threading.Thread):
|
||||
):
|
||||
warnings.warn(
|
||||
'DelayQueue in its current form is deprecated and will be reinvented in a future '
|
||||
'release. See https://git.io/JtDbF for a list of known bugs.',
|
||||
'release. See https://github.com/python-telegram-bot/python-telegram-bot/issues/2139 '
|
||||
'for a list of known bugs.',
|
||||
category=TelegramDeprecationWarning,
|
||||
)
|
||||
|
||||
@@ -194,7 +196,8 @@ class MessageQueue:
|
||||
|
||||
.. deprecated:: 13.3
|
||||
:class:`telegram.ext.MessageQueue` in its current form is deprecated and will be reinvented
|
||||
in a future release. See `this thread <https://git.io/JtDbF>`_ for a list of known bugs.
|
||||
in a future release. See `this thread <https://github.com/python-telegram-bot/\
|
||||
python-telegram-bot/issues/2139>`_ for a list of known bugs.
|
||||
|
||||
Args:
|
||||
all_burst_limit (:obj:`int`, optional): Number of maximum *all-type* callbacks to process
|
||||
@@ -226,7 +229,8 @@ class MessageQueue:
|
||||
):
|
||||
warnings.warn(
|
||||
'MessageQueue in its current form is deprecated and will be reinvented in a future '
|
||||
'release. See https://git.io/JtDbF for a list of known bugs.',
|
||||
'release. See https://github.com/python-telegram-bot/python-telegram-bot/issues/2139 '
|
||||
'for a list of known bugs.',
|
||||
category=TelegramDeprecationWarning,
|
||||
)
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# A library that provides a Python interface to the Telegram Bot API
|
||||
# Copyright (C) 2015-2021
|
||||
# Copyright (C) 2015-2022
|
||||
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# A library that provides a Python interface to the Telegram Bot API
|
||||
# Copyright (C) 2019-2021
|
||||
# Copyright (C) 2015-2022
|
||||
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
@@ -14,8 +14,8 @@
|
||||
# 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/].
|
||||
# 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 the PollAnswerHandler class."""
|
||||
|
||||
|
||||
@@ -35,7 +35,8 @@ class PollAnswerHandler(Handler[Update, CCT]):
|
||||
or in the same chat, it will be the same ``dict``.
|
||||
|
||||
Note that this is DEPRECATED, and you should use context based callbacks. See
|
||||
https://git.io/fxJuV for more info.
|
||||
https://github.com/python-telegram-bot/python-telegram-bot/wiki\
|
||||
/Transition-guide-to-Version-12.0 for more info.
|
||||
|
||||
Warning:
|
||||
When setting ``run_async`` to :obj:`True`, you cannot rely on adding custom
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# A library that provides a Python interface to the Telegram Bot API
|
||||
# Copyright (C) 2019-2021
|
||||
# Copyright (C) 2015-2022
|
||||
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
@@ -35,7 +35,8 @@ class PollHandler(Handler[Update, CCT]):
|
||||
or in the same chat, it will be the same ``dict``.
|
||||
|
||||
Note that this is DEPRECATED, and you should use context based callbacks. See
|
||||
https://git.io/fxJuV for more info.
|
||||
https://github.com/python-telegram-bot/python-telegram-bot/wiki\
|
||||
/Transition-guide-to-Version-12.0 for more info.
|
||||
|
||||
Warning:
|
||||
When setting ``run_async`` to :obj:`True`, you cannot rely on adding custom
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# A library that provides a Python interface to the Telegram Bot API
|
||||
# Copyright (C) 2015-2021
|
||||
# Copyright (C) 2015-2022
|
||||
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
@@ -35,7 +35,8 @@ class PreCheckoutQueryHandler(Handler[Update, CCT]):
|
||||
or in the same chat, it will be the same ``dict``.
|
||||
|
||||
Note that this is DEPRECATED, and you should use context based callbacks. See
|
||||
https://git.io/fxJuV for more info.
|
||||
https://github.com/python-telegram-bot/python-telegram-bot/wiki\
|
||||
/Transition-guide-to-Version-12.0 for more info.
|
||||
|
||||
Warning:
|
||||
When setting ``run_async`` to :obj:`True`, you cannot rely on adding custom
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# A library that provides a Python interface to the Telegram Bot API
|
||||
# Copyright (C) 2015-2021
|
||||
# Copyright (C) 2015-2022
|
||||
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
@@ -128,7 +128,9 @@ class RegexHandler(MessageHandler):
|
||||
run_async: Union[bool, DefaultValue] = DEFAULT_FALSE,
|
||||
):
|
||||
warnings.warn(
|
||||
'RegexHandler is deprecated. See https://git.io/fxJuV for more info',
|
||||
'RegexHandler is deprecated. See '
|
||||
'https://github.com/python-telegram-bot/python-telegram-bot/wiki/Transition-guide-to'
|
||||
'-Version-12.0 for more info',
|
||||
TelegramDeprecationWarning,
|
||||
stacklevel=2,
|
||||
)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# A library that provides a Python interface to the Telegram Bot API
|
||||
# Copyright (C) 2015-2021
|
||||
# Copyright (C) 2015-2022
|
||||
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
@@ -34,7 +34,8 @@ class ShippingQueryHandler(Handler[Update, CCT]):
|
||||
or in the same chat, it will be the same ``dict``.
|
||||
|
||||
Note that this is DEPRECATED, and you should use context based callbacks. See
|
||||
https://git.io/fxJuV for more info.
|
||||
https://github.com/python-telegram-bot/python-telegram-bot/wiki\
|
||||
/Transition-guide-to-Version-12.0 for more info.
|
||||
|
||||
Warning:
|
||||
When setting ``run_async`` to :obj:`True`, you cannot rely on adding custom
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# A library that provides a Python interface to the Telegram Bot API
|
||||
# Copyright (C) 2015-2021
|
||||
# Copyright (C) 2015-2022
|
||||
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# A library that provides a Python interface to the Telegram Bot API
|
||||
# Copyright (C) 2015-2021
|
||||
# Copyright (C) 2015-2022
|
||||
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# A library that provides a Python interface to the Telegram Bot API
|
||||
# Copyright (C) 2015-2021
|
||||
# Copyright (C) 2015-2022
|
||||
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# A library that provides a Python interface to the Telegram Bot API
|
||||
# Copyright (C) 2015-2021
|
||||
# Copyright (C) 2015-2022
|
||||
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
@@ -463,6 +463,11 @@ class Updater(Generic[CCT, UD, CD, BD]):
|
||||
application. Else, the webhook will be started on
|
||||
https://listen:port/url_path. Also calls :meth:`telegram.Bot.set_webhook` as required.
|
||||
|
||||
Note:
|
||||
``telegram.Bot.set_webhook.secret_token`` is not checked by this webhook
|
||||
implementation. If you want to use this new security parameter, either build your own
|
||||
webhook server or update your code to version 20.0a2+.
|
||||
|
||||
.. versionchanged:: 13.4
|
||||
:meth:`start_webhook` now *always* calls :meth:`telegram.Bot.set_webhook`, so pass
|
||||
``webhook_url`` instead of calling ``updater.bot.set_webhook(webhook_url)`` manually.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#
|
||||
# A library that provides a Python interface to the Telegram Bot API
|
||||
# Copyright (C) 2015-2021
|
||||
# Copyright (C) 2015-2022
|
||||
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# A library that provides a Python interface to the Telegram Bot API
|
||||
# Copyright (C) 2015-2021
|
||||
# Copyright (C) 2015-2022
|
||||
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# A library that provides a Python interface to the Telegram Bot API
|
||||
# Copyright (C) 2021
|
||||
# Copyright (C) 2015-2022
|
||||
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# A library that provides a Python interface to the Telegram Bot API
|
||||
# Copyright (C) 2015-2021
|
||||
# Copyright (C) 2015-2022
|
||||
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# A library that provides a Python interface to the Telegram Bot API
|
||||
# Copyright (C) 2015-2021
|
||||
# Copyright (C) 2015-2022
|
||||
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# A library that provides a Python interface to the Telegram Bot API
|
||||
# Copyright (C) 2015-2021
|
||||
# Copyright (C) 2015-2022
|
||||
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# A library that provides a Python interface to the Telegram Bot API
|
||||
# Copyright (C) 2015-2021
|
||||
# Copyright (C) 2015-2022
|
||||
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# A library that provides a Python interface to the Telegram Bot API
|
||||
# Copyright (C) 2015-2021
|
||||
# Copyright (C) 2015-2022
|
||||
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# A library that provides a Python interface to the Telegram Bot API
|
||||
# Copyright (C) 2015-2021
|
||||
# Copyright (C) 2015-2022
|
||||
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# A library that provides a Python interface to the Telegram Bot API
|
||||
# Copyright (C) 2015-2021
|
||||
# Copyright (C) 2015-2022
|
||||
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
# pylint: disable=W0622,E0611
|
||||
#
|
||||
# A library that provides a Python interface to the Telegram Bot API
|
||||
# Copyright (C) 2015-2021
|
||||
# Copyright (C) 2015-2022
|
||||
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user