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

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

            handler = pyrogram.InlineQueryHandler(func, filters)

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

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

            return handler, group