8000 Full Support for Bot API 9.1 by Bibo-Joshi · Pull Request #4847 · python-telegram-bot/python-telegram-bot · GitHub
[go: up one dir, main page]

Skip to content

Full Support for Bot API 9.1 #4847

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
:target: https://pypi.org/project/python-telegram-bot/
:alt: Supported Python versions

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

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

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

Notable Features
Expand Down
17 changes: 17 additions & 0 deletions changes/unreleased/4847.8ujbbBbaZ2VTEdRLeqirSZ.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
highlights = "Full Support for Bot API 9.1"

features = """
New filters based on Bot API 9.1:

* ``filters.StatusUpdate.DIRECT_MESSAGE_PRICE_CHANGED`` for ``Message.direct_message_price_changed``
* ``filters.StatusUpdate.CHECKLIST_TASKS_ADDED`` for ``Message.checklist_tasks_added``
* ``filters.StatusUpdate.CHECKLIST_TASKS_DONE`` for ``Message.checklist_tasks_done``
* ``filters.CHECKLIST`` for ``Message.checklist``
"""

pull_requests = [
{ uid = "4847", author_uid = "Bibo-Joshi", closes_threads = ["4845"] },
{ uid = "4848", author_uid = "Bibo-Joshi" },
{ uid = "4849", author_uid = "harshil21" },
{ uid = "4851", author_uid = "harshil21" },
]
2 changes: 2 additions & 0 deletions docs/source/inclusions/bot_methods.rst
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,8 @@
- Used to generate an HTTP link for an invoice
* - :meth:`~telegram.Bot.edit_user_star_subscription`
- Used for editing a user's star subscription
* - :meth:`~telegram.Bot.get_my_star_balance`
- Used for obtaining the bot's Telegram Stars balance
* - :meth:`~telegram.Bot.get_star_transactions`
- Used for obtaining the bot's Telegram Stars transactions
* - :meth:`~telegram.Bot.refund_star_payment`
Expand Down
5 changes: 5 additions & 0 deletions docs/source/telegram.at-tree.rst
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ Available Types
telegram.chat
telegram.chatadministratorrights
telegram.chatbackground
67F4 telegram.checklist
telegram.checklisttask
telegram.checklisttasksadded
telegram.checklisttasksdone
telegram.copytextbutton
telegram.backgroundtype
telegram.backgroundtypefill
Expand Down Expand Up @@ -66,6 +70,7 @@ Available Types
telegram.chatshared
telegram.contact
telegram.dice
telegram.directmessagepricechanged
telegram.document
telegram.externalreplyinfo
telegram.file
Expand Down
6 changes: 6 additions & 0 deletions docs/source/telegram.checklist.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Checklist
=========

.. autoclass:: telegram.Checklist
:members:
:show-inheritance:
6 changes: 6 additions & 0 deletions docs/source/telegram.checklisttask.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
ChecklistTask
=============

.. autoclass:: telegram.ChecklistTask
:members:
:show-inheritance:
6 changes: 6 additions & 0 deletions docs/source/telegram.checklisttasksadded.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
ChecklistTasksAdded
===================

.. autoclass:: telegram.ChecklistTasksAdded
:members:
:show-inheritance:
6 changes: 6 additions & 0 deletions docs/source/telegram.checklisttasksdone.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
ChecklistTasksDone
==================

.. autoclass:: telegram.ChecklistTasksDone
:members:
:show-inheritance:
6 changes: 6 additions & 0 deletions docs/source/telegram.directmessagepricechanged.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
DirectMessagePriceChanged
=========================

.. autoclass:: telegram.DirectMessagePriceChanged
:members:
:show-inheritance:
7 changes: 7 additions & 0 deletions src/telegram/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,17 @@
"ChatPermissions",
"ChatPhoto",
"ChatShared",
"Checklist",
"ChecklistTask",
"ChecklistTasksAdded",
"ChecklistTasksDone",
"ChosenInlineResult",
"Contact",
"CopyTextButton",
"Credentials",
"DataCredentials",
"Dice",
"DirectMessagePriceChanged",
"Document",
"EncryptedCredentials",
"EncryptedPassportElement",
Expand Down Expand Up @@ -381,9 +386,11 @@
)
from ._chatmemberupdated import ChatMemberUpdated
from ._chatpermissions import ChatPermissions
from ._checklists import Checklist, ChecklistTask, ChecklistTasksAdded, ChecklistTasksDone
from ._choseninlineresult import ChosenInlineResult
from ._copytextbutton import CopyTextButton
from ._dice import Dice
from ._directmessagepricechanged import DirectMessagePriceChanged
from ._files._inputstorycontent import (
InputStoryContent,
InputStoryContentPhoto,
Expand Down
32 changes: 32 additions & 0 deletions src/telegram/_bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -11072,6 +11072,36 @@ async def remove_user_verification(
api_kwargs=api_kwargs,
)

async def get_my_star_balance(
self,
*,
read_timeout: ODVInput[float] = DEFAULT_NONE,
write_timeout: ODVInput[float] = DEFAULT_NONE,
connect_timeout: ODVInput[float] = DEFAULT_NONE,
pool_timeout: ODVInput[float] = DEFAULT_NONE,
api_kwargs: Optional[JSONDict] = None,
) -> StarAmount:
"""A method to get the current Telegram Stars balance of the bot. Requires no parameters.

.. versionadded:: NEXT.VERSION

Returns:
:class:`telegram.StarAmount`

Raises:
:class:`telegram.error.TelegramError`
"""
return StarAmount.de_json(
await self._post(
"getMyStarBalance",
read_timeout=read_timeout,
write_timeout=write_timeout,
connect_timeout=connect_timeout,
pool_timeout=pool_timeout,
api_kwargs=api_kwargs,
)
)

def to_dict(self, recursive: bool = True) -> JSONDict: # noqa: ARG002
"""See :meth:`telegram.TelegramObject.to_dict`."""
data: JSONDict = {"id": self.id, "username": self.username, "first_name": self.first_name}
Expand Down Expand Up @@ -11386,3 +11416,5 @@ def to_dict(self, recursive: bool = True) -> JSONDict: # noqa: ARG002
"""Alias for :meth:`remove_chat_verification`"""
removeUserVerification = remove_user_verification
"""Alias for :meth:`remove_user_verification`"""
getMyStarBalance = get_my_star_balance
"""Alias for :meth:`get_my_star_balance`"""
Loading
Loading
0