Module slack_bolt.listener_matcher.async_listener_matcher

Classes

class AsyncCustomListenerMatcher (*,
app_name: str,
func: Callable[..., Awaitable[bool]],
base_logger: logging.Logger | None = None)
Expand source code
class AsyncCustomListenerMatcher(AsyncListenerMatcher):
    app_name: str
    func: Callable[..., Awaitable[bool]]
    arg_names: Sequence[str]
    logger: Logger

    def __init__(self, *, app_name: str, func: Callable[..., Awaitable[bool]], base_logger: Optional[Logger] = None):
        self.app_name = app_name
        self.func = func
        self.arg_names = get_arg_names_of_callable(func)
        self.logger = get_bolt_app_logger(self.app_name, self.func, base_logger)

    async def async_matches(self, req: AsyncBoltRequest, resp: BoltResponse) -> bool:
        return await self.func(
            **build_async_required_kwargs(
                logger=self.logger,
                required_arg_names=self.arg_names,  # type: ignore[arg-type]
                request=req,
                response=resp,
                this_func=self.func,
            )
        )

Ancestors

Class variables

var app_name : str

The type of the None singleton.

var arg_names : Sequence[str]

The type of the None singleton.

var func : Callable[..., Awaitable[bool]]

The type of the None singleton.

var logger : logging.Logger

The type of the None singleton.

Methods

async def async_matches(self,
req: AsyncBoltRequest,
resp: BoltResponse) ‑> bool
Expand source code
async def async_matches(self, req: AsyncBoltRequest, resp: BoltResponse) -> bool:
    return await self.func(
        **build_async_required_kwargs(
            logger=self.logger,
            required_arg_names=self.arg_names,  # type: ignore[arg-type]
            request=req,
            response=resp,
            this_func=self.func,
        )
    )

Matches against the request and returns True if matched.

Args

req
The request
resp
The response

Returns

True if matched

class cls (*,
app_name: str,
func: Callable[..., Awaitable[bool]],
base_logger: logging.Logger | None = None)
Expand source code
class AsyncCustomListenerMatcher(AsyncListenerMatcher):
    app_name: str
    func: Callable[..., Awaitable[bool]]
    arg_names: Sequence[str]
    logger: Logger

    def __init__(self, *, app_name: str, func: Callable[..., Awaitable[bool]], base_logger: Optional[Logger] = None):
        self.app_name = app_name
        self.func = func
        self.arg_names = get_arg_names_of_callable(func)
        self.logger = get_bolt_app_logger(self.app_name, self.func, base_logger)

    async def async_matches(self, req: AsyncBoltRequest, resp: BoltResponse) -> bool:
        return await self.func(
            **build_async_required_kwargs(
                logger=self.logger,
                required_arg_names=self.arg_names,  # type: ignore[arg-type]
                request=req,
                response=resp,
                this_func=self.func,
            )
        )

Ancestors

Class variables

var app_name : str

The type of the None singleton.

var arg_names : Sequence[str]

The type of the None singleton.

var func : Callable[..., Awaitable[bool]]

The type of the None singleton.

var logger : logging.Logger

The type of the None singleton.

Inherited members

class AsyncListenerMatcher
Expand source code
class AsyncListenerMatcher(metaclass=ABCMeta):
    @abstractmethod
    async def async_matches(self, req: AsyncBoltRequest, resp: BoltResponse) -> bool:
        """Matches against the request and returns True if matched.

        Args:
            req: The request
            resp: The response

        Returns:
            True if matched
        """
        raise NotImplementedError()

Subclasses

Methods

async def async_matches(self,
req: AsyncBoltRequest,
resp: BoltResponse) ‑> bool
Expand source code
@abstractmethod
async def async_matches(self, req: AsyncBoltRequest, resp: BoltResponse) -> bool:
    """Matches against the request and returns True if matched.

    Args:
        req: The request
        resp: The response

    Returns:
        True if matched
    """
    raise NotImplementedError()

Matches against the request and returns True if matched.

Args

req
The request
resp
The response

Returns

True if matched