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:
parent
1fdc757f2a
commit
54296a6fda
@ -28,7 +28,11 @@ class OnDisconnect(BaseClient):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
def decorator(func):
|
def decorator(func):
|
||||||
self.add_handler(pyrogram.DisconnectHandler(func))
|
handler = pyrogram.DisconnectHandler(func)
|
||||||
return func
|
|
||||||
|
if self is not None:
|
||||||
|
self.add_handler(handler)
|
||||||
|
|
||||||
|
return handler
|
||||||
|
|
||||||
return decorator
|
return decorator
|
||||||
|
Loading…
x
Reference in New Issue
Block a user