Skip to content

Commit

Permalink
Generate Pytdbot files
Browse files Browse the repository at this point in the history
  • Loading branch information
AYMENJD authored and github-actions[bot] committed Jun 18, 2024
1 parent c796789 commit 53ebff3
Show file tree
Hide file tree
Showing 4 changed files with 1,146 additions and 107 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Pytdbot [![Version](https://img.shields.io/pypi/v/Pytdbot?style=flat&logo=pypi)](https://pypi.org/project/Pytdbot) [![TDLib version](https://img.shields.io/badge/TDLib-v1.8.30-blue?logo=telegram)](https://github.com/tdlib/td) [![Downloads](https://static.pepy.tech/personalized-badge/pytdbot?period=month&units=none&left_color=grey&right_color=brightgreen&left_text=Downloads)](https://pepy.tech/project/pytdbot)
# Pytdbot [![Version](https://img.shields.io/pypi/v/Pytdbot?style=flat&logo=pypi)](https://pypi.org/project/Pytdbot) [![TDLib version](https://img.shields.io/badge/TDLib-v1.8.31-blue?logo=telegram)](https://github.com/tdlib/td) [![Downloads](https://static.pepy.tech/personalized-badge/pytdbot?period=month&units=none&left_color=grey&right_color=brightgreen&left_text=Downloads)](https://pepy.tech/project/pytdbot)

Pytdbot (Python TDLib) is an asynchronous [**TDLib**](https://github.com/tdlib/td) wrapper for **Telegram** users/bots written in **Python**.

Expand Down
76 changes: 76 additions & 0 deletions pytdbot/handlers/updates.py
Original file line number Diff line number Diff line change
Expand Up @@ -4475,6 +4475,42 @@ def decorator(func: Callable) -> Callable:

return decorator

def on_updateStarRevenueStatus(
self: "pytdbot.Client" = None,
filters: "pytdbot.filters.Filter" = None,
position: int = None,
) -> Callable:
"""The Telegram star revenue earned by a bot or a chat has changed\. If star transactions screen of the chat is opened, then getStarTransactions may be called to fetch new transactions
Args:
filters (:class:`pytdbot.filters.Filter`, *optional*):
An update filter
position (``int``, *optional*):
The function position in handlers list. Default is ``None`` (append)
Raises:
:py:class:`TypeError`
"""

def decorator(func: Callable) -> Callable:
if hasattr(func, "_handler"):
return func
elif isinstance(self, pytdbot.Client):
if iscoroutinefunction(func):
self.add_handler("updateStarRevenueStatus", func, filters, position)
else:
raise TypeError("Handler must be async")
elif isinstance(self, pytdbot.filters.Filter):
func._handler = Handler(func, "updateStarRevenueStatus", self, position)
else:
func._handler = Handler(
func, "updateStarRevenueStatus", filters, position
)
return func

return decorator

def on_updateSpeechRecognitionTrial(
self: "pytdbot.Client" = None,
filters: "pytdbot.filters.Filter" = None,
Expand Down Expand Up @@ -5091,6 +5127,46 @@ def decorator(func: Callable) -> Callable:

return decorator

def on_updateNewBusinessCallbackQuery(
self: "pytdbot.Client" = None,
filters: "pytdbot.filters.Filter" = None,
position: int = None,
) -> Callable:
"""A new incoming callback query from a business message; for bots only
Args:
filters (:class:`pytdbot.filters.Filter`, *optional*):
An update filter
position (``int``, *optional*):
The function position in handlers list. Default is ``None`` (append)
Raises:
:py:class:`TypeError`
"""

def decorator(func: Callable) -> Callable:
if hasattr(func, "_handler"):
return func
elif isinstance(self, pytdbot.Client):
if iscoroutinefunction(func):
self.add_handler(
"updateNewBusinessCallbackQuery", func, filters, position
)
else:
raise TypeError("Handler must be async")
elif isinstance(self, pytdbot.filters.Filter):
func._handler = Handler(
func, "updateNewBusinessCallbackQuery", self, position
)
else:
func._handler = Handler(
func, "updateNewBusinessCallbackQuery", filters, position
)
return func

return decorator

def on_updateNewShippingQuery(
self: "pytdbot.Client" = None,
filters: "pytdbot.filters.Filter" = None,
Expand Down
Loading

0 comments on commit 53ebff3

Please sign in to comment.