mirror of
https://github.com/pyrogram/pyrogram
synced 2025-08-29 05:18:10 +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):
|
||||
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
|
||||
|
Loading…
x
Reference in New Issue
Block a user