GitHub

API reference for Command.

A slash command definition: a name and at most one text argument. description and argument are what registration needs (Slack reads its own from the app manifest).

Attributes

AttributeTypeDescription
idI_co
descriptionstr
argumentCommandArgument | None
kindLiteral['command'] = field(default='command', init=False)

Functions

__init__

__init__(id, description, argument) -> None
ParameterTypeDescription
idI_co
descriptionstr
argumentCommandArgument | None

handler

handler[RR = Never](fn) -> Handled[I_co, RR]

This command's handler: it answers respond, a modal to open or defer, never ack.

ParameterTypeDescription
fnCallable[[CommandInvoked], Effect[Respond | OpenModal | Defer, Never, RR]]

Returns Handled[I_co, RR]

def handler[RR = Never](
    self, fn: Callable[[CommandInvoked], Effect[Respond | OpenModal | Defer, Never, RR]]
) -> Handled[I_co, RR]:
    """This command's handler: it answers ``respond``, a modal to open
    or ``defer``, never ``ack``."""
    return Handled(cast("Definition", self), fn)