mirror of
https://github.com/pyrogram/pyrogram
synced 2025-08-28 12:57:52 +00:00
Allow decorators to be stacked
E.g: app1.on_message(...) app2.on_message(...) app3.on_message(...) def on_message(client, message): ...
This commit is contained in:
parent
fafa3b5131
commit
2e16499369
@ -37,6 +37,9 @@ class OnCallbackQuery(BaseClient):
|
||||
"""
|
||||
|
||||
def decorator(func):
|
||||
if isinstance(func, tuple):
|
||||
func = func[0].callback
|
||||
|
||||
handler = pyrogram.CallbackQueryHandler(func, filters)
|
||||
|
||||
if isinstance(self, Filter):
|
||||
|
@ -37,6 +37,9 @@ class OnDeletedMessages(BaseClient):
|
||||
"""
|
||||
|
||||
def decorator(func):
|
||||
if isinstance(func, tuple):
|
||||
func = func[0].callback
|
||||
|
||||
handler = pyrogram.DeletedMessagesHandler(func, filters)
|
||||
|
||||
if isinstance(self, Filter):
|
||||
|
@ -37,6 +37,9 @@ class OnMessage(BaseClient):
|
||||
"""
|
||||
|
||||
def decorator(func):
|
||||
if isinstance(func, tuple):
|
||||
func = func[0].callback
|
||||
|
||||
handler = pyrogram.MessageHandler(func, filters)
|
||||
|
||||
if isinstance(self, Filter):
|
||||
|
@ -32,6 +32,9 @@ class OnRawUpdate(BaseClient):
|
||||
"""
|
||||
|
||||
def decorator(func):
|
||||
if isinstance(func, tuple):
|
||||
func = func[0].callback
|
||||
|
||||
handler = pyrogram.RawUpdateHandler(func)
|
||||
|
||||
if isinstance(self, int):
|
||||
|
@ -36,6 +36,9 @@ class OnUserStatus(BaseClient):
|
||||
"""
|
||||
|
||||
def decorator(func):
|
||||
if isinstance(func, tuple):
|
||||
func = func[0].callback
|
||||
|
||||
handler = pyrogram.UserStatusHandler(func, filters)
|
||||
|
||||
if isinstance(self, Filter):
|
||||
|
Loading…
x
Reference in New Issue
Block a user