Ejemplo n.º 1
0
        def decorator(func: Callable) -> Callable:
            if isinstance(self, pyrogram.Client):
                self.add_handler(pyrogram.UserStatusHandler(func, filters),
                                 group)
            elif isinstance(self, Filter) or self is None:
                func.pyrogram_plugin = (pyrogram.UserStatusHandler(func, self),
                                        group if filters is None else filters)

            return func
Ejemplo n.º 2
0
        def decorator(func):
            handler = pyrogram.UserStatusHandler(func, filters)

            if isinstance(self, Filter):
                return pyrogram.UserStatusHandler(func, self), group if filters is None else filters

            if self is not None:
                self.add_handler(handler, group)

            return handler, group
Ejemplo n.º 3
0
        def decorator(func: callable) -> Tuple[Handler, int]:
            if isinstance(func, tuple):
                func = func[0].callback

            handler = pyrogram.UserStatusHandler(func, filters)

            if isinstance(self, Filter):
                return pyrogram.UserStatusHandler(func, self), group if filters is None else filters

            if self is not None:
                self.add_handler(handler, group)

            return handler, group