2
0
mirror of https://github.com/pyrogram/pyrogram synced 2025-08-29 13:27:47 +00:00

Allow on_disconnect to be used as a static decorator

This commit is contained in:
Dan 2018-10-13 10:47:39 +02:00
parent 1fdc757f2a
commit 54296a6fda

View File

@ -28,7 +28,11 @@ class OnDisconnect(BaseClient):
"""
def decorator(func):
self.add_handler(pyrogram.DisconnectHandler(func))
return func
handler = pyrogram.DisconnectHandler(func)
if self is not None:
self.add_handler(handler)
return handler
return decorator