mirror of
https://github.com/pyrogram/pyrogram
synced 2025-08-28 12:57:52 +00:00
Fix on_disconnect decorator not working (#1134)
* Fix on_disconnect decorator not working * Remove useless if else statment in on_raw_update
This commit is contained in:
parent
035bbbb76e
commit
b423730dcb
@ -32,6 +32,11 @@ class OnDisconnect:
|
||||
def decorator(func: Callable) -> Callable:
|
||||
if isinstance(self, pyrogram.Client):
|
||||
self.add_handler(pyrogram.handlers.DisconnectHandler(func))
|
||||
else:
|
||||
if not hasattr(func, "handlers"):
|
||||
func.handlers = []
|
||||
|
||||
func.handlers.append((pyrogram.handlers.DisconnectHandler(func), 0))
|
||||
|
||||
return func
|
||||
|
||||
|
@ -46,7 +46,7 @@ class OnRawUpdate:
|
||||
func.handlers.append(
|
||||
(
|
||||
pyrogram.handlers.RawUpdateHandler(func),
|
||||
group if self is None else group
|
||||
group
|
||||
)
|
||||
)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user