mirror of
https://github.com/Mayuri-Chan/pyrofork.git
synced 2026-01-04 14:24: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):
|
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…
Reference in a new issue