Skip to content

Commit 83b3722

Browse files
AYMENJDgithub-actions[bot]
authored andcommitted
Generate Pytdbot files
1 parent a9a0f67 commit 83b3722

File tree

5 files changed

+1984
-150
lines changed

5 files changed

+1984
-150
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# 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.51-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) [![Telegram Chat](https://img.shields.io/badge/Pytdbot%20chat-blue?logo=telegram&label=Telegram)](https://t.me/pytdbotchat)
1+
# 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.52-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) [![Telegram Chat](https://img.shields.io/badge/Pytdbot%20chat-blue?logo=telegram&label=Telegram)](https://t.me/pytdbotchat)
22

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

pytdbot/handlers/td_updates.py

Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -778,6 +778,65 @@ def decorator(func: Callable) -> Callable:
778778

779779
return decorator
780780

781+
def on_updateMessageSuggestedPostInfo(
782+
self: "pytdbot.Client" = None,
783+
filters: "pytdbot.filters.Filter" = None,
784+
position: int = None,
785+
timeout: float = None,
786+
) -> Callable:
787+
r"""Information about suggested post of a message was changed
788+
789+
Parameters:
790+
filters (:class:`pytdbot.filters.Filter`, *optional*):
791+
An update filter
792+
793+
position (``int``, *optional*):
794+
The function position in handlers list. Default is ``None`` (append)
795+
796+
timeout (``float``, *optional*):
797+
Max execution time for the handler before it timeout. Default is ``None``
798+
799+
Raises:
800+
:py:class:`TypeError`
801+
"""
802+
803+
def decorator(func: Callable) -> Callable:
804+
if hasattr(func, "_handler"):
805+
return func
806+
elif isinstance(self, pytdbot.Client):
807+
if iscoroutinefunction(func):
808+
self.add_handler(
809+
update_type="updateMessageSuggestedPostInfo",
810+
func=func,
811+
filters=filters,
812+
position=position,
813+
inner_object=False,
814+
timeout=timeout,
815+
)
816+
else:
817+
raise TypeError("Handler must be async")
818+
elif isinstance(self, pytdbot.filters.Filter):
819+
func._handler = Handler(
820+
func=func,
821+
update_type="updateMessageSuggestedPostInfo",
822+
filter=self,
823+
position=position,
824+
inner_object=False,
825+
timeout=timeout,
826+
)
827+
else:
828+
func._handler = Handler(
829+
func=func,
830+
update_type="updateMessageSuggestedPostInfo",
831+
filter=filters,
832+
position=position,
833+
inner_object=False,
834+
timeout=timeout,
835+
)
836+
return func
837+
838+
return decorator
839+
781840
def on_updateMessageLiveLocationViewed(
782841
self: "pytdbot.Client" = None,
783842
filters: "pytdbot.filters.Filter" = None,
@@ -7563,6 +7622,65 @@ def decorator(func: Callable) -> Callable:
75637622

75647623
return decorator
75657624

7625+
def on_updateOwnedTonCount(
7626+
self: "pytdbot.Client" = None,
7627+
filters: "pytdbot.filters.Filter" = None,
7628+
position: int = None,
7629+
timeout: float = None,
7630+
) -> Callable:
7631+
r"""The number of Toncoins owned by the current user has changed
7632+
7633+
Parameters:
7634+
filters (:class:`pytdbot.filters.Filter`, *optional*):
7635+
An update filter
7636+
7637+
position (``int``, *optional*):
7638+
The function position in handlers list. Default is ``None`` (append)
7639+
7640+
timeout (``float``, *optional*):
7641+
Max execution time for the handler before it timeout. Default is ``None``
7642+
7643+
Raises:
7644+
:py:class:`TypeError`
7645+
"""
7646+
7647+
def decorator(func: Callable) -> Callable:
7648+
if hasattr(func, "_handler"):
7649+
return func
7650+
elif isinstance(self, pytdbot.Client):
7651+
if iscoroutinefunction(func):
7652+
self.add_handler(
7653+
update_type="updateOwnedTonCount",
7654+
func=func,
7655+
filters=filters,
7656+
position=position,
7657+
inner_object=False,
7658+
timeout=timeout,
7659+
)
7660+
else:
7661+
raise TypeError("Handler must be async")
7662+
elif isinstance(self, pytdbot.filters.Filter):
7663+
func._handler = Handler(
7664+
func=func,
7665+
update_type="updateOwnedTonCount",
7666+
filter=self,
7667+
position=position,
7668+
inner_object=False,
7669+
timeout=timeout,
7670+
)
7671+
else:
7672+
func._handler = Handler(
7673+
func=func,
7674+
update_type="updateOwnedTonCount",
7675+
filter=filters,
7676+
position=position,
7677+
inner_object=False,
7678+
timeout=timeout,
7679+
)
7680+
return func
7681+
7682+
return decorator
7683+
75667684
def on_updateChatRevenueAmount(
75677685
self: "pytdbot.Client" = None,
75687686
filters: "pytdbot.filters.Filter" = None,

0 commit comments

Comments
 (0)