2
0
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:
Dan 2018-11-10 15:21:52 +01:00
parent fafa3b5131
commit 2e16499369
5 changed files with 15 additions and 0 deletions

View File

@ -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):

View File

@ -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):

View File

@ -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):

View File

@ -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):

View File

@ -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):