We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 1fdc757 commit 54296a6Copy full SHA for 54296a6
pyrogram/client/methods/decorators/on_disconnect.py
@@ -28,7 +28,11 @@ def on_disconnect(self):
28
"""
29
30
def decorator(func):
31
- self.add_handler(pyrogram.DisconnectHandler(func))
32
- return func
+ handler = pyrogram.DisconnectHandler(func)
+
33
+ if self is not None:
34
+ self.add_handler(handler)
35
36
+ return handler
37
38
return decorator
0 commit comments