Skip to content

Commit 7078059

Browse files
Bibo-Joshiaelkheir
andauthored
Full Support for Bot API 9.0 (#4756)
Co-authored-by: Abdelrahman Elkheir <90580077+aelkheir@users.noreply.github.com>
1 parent c34e19e commit 7078059

File tree

81 files changed

+8154
-86
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

81 files changed

+8154
-86
lines changed

README.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
:target: https://pypi.org/project/python-telegram-bot/
1212
:alt: Supported Python versions
1313

14-
.. image:: https://img.shields.io/badge/Bot%20API-8.3-blue?logo=telegram
14+
.. image:: https://img.shields.io/badge/Bot%20API-9.0-blue?logo=telegram
1515
:target: https://core.telegram.org/bots/api-changelog
1616
:alt: Supported Bot API version
1717

@@ -81,7 +81,7 @@ After installing_ the library, be sure to check out the section on `working with
8181
Telegram API support
8282
~~~~~~~~~~~~~~~~~~~~
8383

84-
All types and methods of the Telegram Bot API **8.3** are natively supported by this library.
84+
All types and methods of the Telegram Bot API **9.0** are natively supported by this library.
8585
In addition, Bot API functionality not yet natively included can still be used as described `in our wiki <https://github.com/python-telegram-bot/python-telegram-bot/wiki/Bot-API-Forward-Compatibility>`_.
8686

8787
Notable Features
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
features = "Full Support for Bot API 9.0"
2+
deprecations = """This release comes with several deprecations, in line with our :ref:`stability policy <stability-policy>`.
3+
This includes the following:
4+
5+
- Deprecated ``telegram.constants.StarTransactionsLimit.NANOSTAR_MIN_AMOUNT`` and ``telegram.constants.StarTransactionsLimit.NANOSTAR_MAX_AMOUNT``. These members will be replaced by ``telegram.constants.NanostarLimit.MIN_AMOUNT`` and ``telegram.constants.NanostarLimit.MAX_AMOUNT``.
6+
- Deprecated the class ``telegram.constants.StarTransactions``. Its only member ``telegram.constants.StarTransactions.NANOSTAR_VALUE`` will be replaced by ``telegram.constants.Nanostar.VALUE``.
7+
- Bot API 9.0 deprecated ``BusinessConnection.can_reply`` in favor of ``BusinessConnection.rights``
8+
- Bot API 9.0 deprecated ``ChatFullInfo.can_send_gift`` in favor of ``ChatFullInfo.accepted_gift_types``.
9+
- Bot API 9.0 introduced these new required fields to existing classes:
10+
- ``TransactionPartnerUser.transaction_type``
11+
- ``ChatFullInfo.accepted_gift_types``
12+
13+
Passing these values as positional arguments is deprecated. We encourage you to use keyword arguments instead, as the the signature will be updated in a future release.
14+
15+
These deprecations are backward compatible, but we strongly recommend to update your code to use the new members.
16+
"""
17+
[[pull_requests]]
18+
uid = "4756"
19+
author_uid = "Bibo-Joshi"
20+
closes_threads = ["4754"]
21+
[[pull_requests]]
22+
uid = "4757"
23+
author_uid = "Bibo-Joshi"
24+
closes_threads = []
25+
[[pull_requests]]
26+
uid = "4759"
27+
author_uid = "Bibo-Joshi"
28+
closes_threads = []
29+
[[pull_requests]]
30+
uid = "4763"
31+
author_uid = "aelkheir"
32+
closes_threads = []
33+
[[pull_requests]]
34+
uid = "4766"
35+
author_uid = "Bibo-Joshi"
36+
[[pull_requests]]
37+
uid = "4769"
38+
author_uid = "aelkheir"
39+
closes_threads = []
40+
[[pull_requests]]
41+
uid = "4773"
42+
author_uid = "aelkheir"
43+
closes_threads = []
44+
[[pull_requests]]
45+
uid = "4781"
46+
author_uid = "aelkheir"
47+
closes_threads = []
48+
[[pull_requests]]
49+
uid = "4782"
50+
author_uid = "Bibo-Joshi"
51+
closes_threads = []

docs/source/inclusions/bot_methods.rst

Lines changed: 54 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,8 +161,6 @@
161161
- Used for unpinning a message
162162
* - :meth:`~telegram.Bot.unpin_all_chat_messages`
163163
- Used for unpinning all pinned chat messages
164-
* - :meth:`~telegram.Bot.get_business_connection`
165-
- Used for getting information about the business account.
166164
* - :meth:`~telegram.Bot.get_user_profile_photos`
167165
- Used for obtaining user's profile pictures
168166
* - :meth:`~telegram.Bot.get_chat`
@@ -396,6 +394,60 @@
396394
- Used for obtaining the bot's Telegram Stars transactions
397395
* - :meth:`~telegram.Bot.refund_star_payment`
398396
- Used for refunding a payment in Telegram Stars
397+
* - :meth:`~telegram.Bot.gift_premium_subscription`
398+
- Used for gifting Telegram Premium to another user.
399+
400+
.. raw:: html
401+
402+
</details>
403+
<br>
404+
405+
.. raw:: html
406+
407+
<details>
408+
<summary>Business Related Methods</summary>
409+
410+
.. list-table::
411+
:align: left
412+
:widths: 1 4
413+
414+
* - :meth:`~telegram.Bot.get_business_connection`
415+
- Used for getting information about the business account.
416+
* - :meth:`~telegram.Bot.get_business_account_gifts`
417+
- Used for getting gifts owned by the business account.
418+
* - :meth:`~telegram.Bot.get_business_account_star_balance`
419+
- Used for getting the amount of Stars owned by the business account.
420+
* - :meth:`~telegram.Bot.read_business_message`
421+
- Used for marking a message as read.
422+
* - :meth:`~telegram.Bot.delete_story`
423+
- Used for deleting business stories posted by the bot.
424+
* - :meth:`~telegram.Bot.delete_business_messages`
425+
- Used for deleting business messages.
426+
* - :meth:`~telegram.Bot.remove_business_account_profile_photo`
427+
- Used for removing the business accounts profile photo
428+
* - :meth:`~telegram.Bot.set_business_account_name`
429+
- Used for setting the business account name.
430+
* - :meth:`~telegram.Bot.set_business_account_username`
431+
- Used for setting the business account username.
432+
* - :meth:`~telegram.Bot.set_business_account_bio`
433+
- Used for setting the business account bio.
434+
* - :meth:`~telegram.Bot.set_business_account_gift_settings`
435+
- Used for setting the business account gift settings.
436+
* - :meth:`~telegram.Bot.set_business_account_profile_photo`
437+
- Used for setting the business accounts profile photo
438+
* - :meth:`~telegram.Bot.post_story`
439+
- Used for posting a story on behalf of business account.
440+
* - :meth:`~telegram.Bot.edit_story`
441+
- Used for editing business stories posted by the bot.
442+
* - :meth:`~telegram.Bot.convert_gift_to_stars`
443+
- Used for converting owned reqular gifts to stars.
444+
* - :meth:`~telegram.Bot.upgrade_gift`
445+
- Used for upgrading owned regular gifts to unique ones.
446+
* - :meth:`~telegram.Bot.transfer_gift`
447+
- Used for transferring owned unique gifts to another user.
448+
* - :meth:`~telegram.Bot.transfer_business_account_stars`
449+
- Used for transfering Stars from the business account balance to the bot's balance.
450+
399451

400452
.. raw:: html
401453

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
AcceptedGiftTypes
2+
=================
3+
4+
.. autoclass:: telegram.AcceptedGiftTypes
5+
:members:
6+
:show-inheritance:

docs/source/telegram.at-tree.rst

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ Available Types
44
.. toctree::
55
:titlesonly:
66

7+
telegram.acceptedgifttypes
78
telegram.animation
89
telegram.audio
910
telegram.birthdate
@@ -19,6 +20,7 @@ Available Types
1920
telegram.botdescription
2021
telegram.botname
2122
telegram.botshortdescription
23+
telegram.businessbotrights
2224
telegram.businessconnection
2325
telegram.businessintro
2426
telegram.businesslocation
@@ -75,6 +77,7 @@ Available Types
7577
telegram.forumtopicreopened
7678
telegram.generalforumtopichidden
7779
telegram.generalforumtopicunhidden
80+
telegram.giftinfo
7881
telegram.giveaway
7982
telegram.giveawaycompleted
8083
telegram.giveawaycreated
@@ -92,13 +95,20 @@ Available Types
9295
telegram.inputpaidmedia
9396
telegram.inputpaidmediaphoto
9497
telegram.inputpaidmediavideo
98+
telegram.inputprofilephoto
99+
telegram.inputprofilephotoanimated
100+
telegram.inputprofilephotostatic
95101
telegram.inputpolloption
102+
telegram.inputstorycontent
103+
telegram.inputstorycontentphoto
104+
telegram.inputstorycontentvideo
96105
telegram.keyboardbutton
97106
telegram.keyboardbuttonpolltype
98107
telegram.keyboardbuttonrequestchat
99108
telegram.keyboardbuttonrequestusers
100109
telegram.linkpreviewoptions
101110
telegram.location
111+
telegram.locationaddress
102112
telegram.loginurl
103113
telegram.maybeinaccessiblemessage
104114
telegram.menubutton
@@ -116,12 +126,17 @@ Available Types
116126
telegram.messageoriginuser
117127
telegram.messagereactioncountupdated
118128
telegram.messagereactionupdated
129+
telegram.ownedgift
130+
telegram.ownedgiftregular
131+
telegram.ownedgifts
132+
telegram.ownedgiftunique
119133
telegram.paidmedia
120134
telegram.paidmediainfo
121135
telegram.paidmediaphoto
122136
telegram.paidmediapreview
123137
telegram.paidmediapurchased
124138
telegram.paidmediavideo
139+
telegram.paidmessagepricechanged
125140
telegram.photosize
126141
telegram.poll
127142
telegram.pollanswer
@@ -138,9 +153,23 @@ Available Types
138153
telegram.sentwebappmessage
139154
telegram.shareduser
140155
telegram.story
156+
telegram.storyarea
157+
telegram.storyareaposition
158+
telegram.storyareatype
159+
telegram.storyareatypelink
160+
telegram.storyareatypelocation
161+
telegram.storyareatypesuggestedreaction
162+
telegram.storyareatypeuniquegift
163+
telegram.storyareatypeweather
141164
telegram.switchinlinequerychosenchat
142165
telegram.telegramobject
143166
telegram.textquote
167+
telegram.uniquegift
168+
telegram.uniquegiftbackdrop
169+
telegram.uniquegiftbackdropcolors
170+
telegram.uniquegiftinfo
171+
telegram.uniquegiftmodel
172+
telegram.uniquegiftsymbol
144173
telegram.update
145174
telegram.user
146175
telegram.userchatboosts
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
BusinessBotRights
2+
=================
3+
4+
.. autoclass:: telegram.BusinessBotRights
5+
:members:
6+
:show-inheritance:

docs/source/telegram.giftinfo.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
GiftInfo
2+
========
3+
4+
.. autoclass:: telegram.GiftInfo
5+
:members:
6+
:show-inheritance:
7+
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
InputProfilePhoto
2+
=================
3+
4+
.. autoclass:: telegram.InputProfilePhoto
5+
:members:
6+
:show-inheritance:
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
InputProfilePhotoAnimated
2+
=========================
3+
4+
.. autoclass:: telegram.InputProfilePhotoAnimated
5+
:members:
6+
:show-inheritance:
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
InputProfilePhotoStatic
2+
=======================
3+
4+
.. autoclass:: telegram.InputProfilePhotoStatic
5+
:members:
6+
:show-inheritance:

0 commit comments

Comments
 (0)