mirror of
https://github.com/Mayuri-Chan/pyrofork.git
synced 2025-12-31 20:54:51 +00:00
Allow on_disconnect to be used as a static decorator
This commit is contained in:
parent
1fdc757f2a
commit
54296a6fda
1 changed files with 6 additions and 2 deletions
|
|
@ -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…
Reference in a new issue