mirror of
https://github.com/TeamPGM/pyrogram.git
synced 2024-11-18 13:34:54 +00:00
Merge branch 'develop' into asyncio
This commit is contained in:
commit
df0de0c85a
@ -22,7 +22,7 @@ from ...ext import BaseClient
|
|||||||
|
|
||||||
|
|
||||||
class OnCallbackQuery(BaseClient):
|
class OnCallbackQuery(BaseClient):
|
||||||
def on_callback_query(self, filters=None, group: int = 0):
|
def on_callback_query(self=None, filters=None, group: int = 0):
|
||||||
"""Use this decorator to automatically register a function for handling
|
"""Use this decorator to automatically register a function for handling
|
||||||
callback queries. This does the same thing as :meth:`add_handler` using the
|
callback queries. This does the same thing as :meth:`add_handler` using the
|
||||||
:class:`CallbackQueryHandler`.
|
:class:`CallbackQueryHandler`.
|
||||||
@ -37,6 +37,9 @@ class OnCallbackQuery(BaseClient):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
def decorator(func):
|
def decorator(func):
|
||||||
|
if isinstance(func, tuple):
|
||||||
|
func = func[0].callback
|
||||||
|
|
||||||
handler = pyrogram.CallbackQueryHandler(func, filters)
|
handler = pyrogram.CallbackQueryHandler(func, filters)
|
||||||
|
|
||||||
if isinstance(self, Filter):
|
if isinstance(self, Filter):
|
||||||
|
@ -22,7 +22,7 @@ from ...ext import BaseClient
|
|||||||
|
|
||||||
|
|
||||||
class OnDeletedMessages(BaseClient):
|
class OnDeletedMessages(BaseClient):
|
||||||
def on_deleted_messages(self, filters=None, group: int = 0):
|
def on_deleted_messages(self=None, filters=None, group: int = 0):
|
||||||
"""Use this decorator to automatically register a function for handling
|
"""Use this decorator to automatically register a function for handling
|
||||||
deleted messages. This does the same thing as :meth:`add_handler` using the
|
deleted messages. This does the same thing as :meth:`add_handler` using the
|
||||||
:class:`DeletedMessagesHandler`.
|
:class:`DeletedMessagesHandler`.
|
||||||
@ -37,6 +37,9 @@ class OnDeletedMessages(BaseClient):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
def decorator(func):
|
def decorator(func):
|
||||||
|
if isinstance(func, tuple):
|
||||||
|
func = func[0].callback
|
||||||
|
|
||||||
handler = pyrogram.DeletedMessagesHandler(func, filters)
|
handler = pyrogram.DeletedMessagesHandler(func, filters)
|
||||||
|
|
||||||
if isinstance(self, Filter):
|
if isinstance(self, Filter):
|
||||||
|
@ -21,7 +21,7 @@ from ...ext import BaseClient
|
|||||||
|
|
||||||
|
|
||||||
class OnDisconnect(BaseClient):
|
class OnDisconnect(BaseClient):
|
||||||
def on_disconnect(self):
|
def on_disconnect(self=None):
|
||||||
"""Use this decorator to automatically register a function for handling
|
"""Use this decorator to automatically register a function for handling
|
||||||
disconnections. This does the same thing as :meth:`add_handler` using the
|
disconnections. This does the same thing as :meth:`add_handler` using the
|
||||||
:class:`DisconnectHandler`.
|
:class:`DisconnectHandler`.
|
||||||
|
@ -37,6 +37,9 @@ class OnMessage(BaseClient):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
def decorator(func):
|
def decorator(func):
|
||||||
|
if isinstance(func, tuple):
|
||||||
|
func = func[0].callback
|
||||||
|
|
||||||
handler = pyrogram.MessageHandler(func, filters)
|
handler = pyrogram.MessageHandler(func, filters)
|
||||||
|
|
||||||
if isinstance(self, Filter):
|
if isinstance(self, Filter):
|
||||||
|
@ -32,6 +32,9 @@ class OnRawUpdate(BaseClient):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
def decorator(func):
|
def decorator(func):
|
||||||
|
if isinstance(func, tuple):
|
||||||
|
func = func[0].callback
|
||||||
|
|
||||||
handler = pyrogram.RawUpdateHandler(func)
|
handler = pyrogram.RawUpdateHandler(func)
|
||||||
|
|
||||||
if isinstance(self, int):
|
if isinstance(self, int):
|
||||||
|
@ -36,6 +36,9 @@ class OnUserStatus(BaseClient):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
def decorator(func):
|
def decorator(func):
|
||||||
|
if isinstance(func, tuple):
|
||||||
|
func = func[0].callback
|
||||||
|
|
||||||
handler = pyrogram.UserStatusHandler(func, filters)
|
handler = pyrogram.UserStatusHandler(func, filters)
|
||||||
|
|
||||||
if isinstance(self, Filter):
|
if isinstance(self, Filter):
|
||||||
|
Loading…
Reference in New Issue
Block a user