def decorator(func: callable) -> Handler: handler = pyrogram.DisconnectHandler(func) if self is not None: self.add_handler(handler) return handler
def decorator(func): self.add_handler(pyrogram.DisconnectHandler(func)) return func
def decorator(func: Callable) -> Callable: if isinstance(self, pyrogram.Client): self.add_handler(pyrogram.DisconnectHandler(func)) return func