What an adapter calls with an interaction (public, for a consumer
that routes clicks itself). The contract is to answer inside the
platform's 3 seconds, with no error channel. refused is called when
a click's or a command's reply was not carried out (no modal opened, a
private answer without ephemeral, a refusal by the platform, or a
reply past the deadline).
Functions#
__init__#
__init__(*, click, submit, command, refused) -> None| Parameter | Type | Description |
|---|---|---|
click | Callable[[ButtonClicked | SelectChanged], Effect[ClickReply]] | |
submit | Callable[[ModalSubmitted], Effect[SubmitReply]] | |
command | Callable[[CommandInvoked], Effect[CommandReply]] | |
refused | Callable[[ButtonClicked | SelectChanged | CommandInvoked, ChatError], Effect[None]] |
def __init__(
self,
*,
click: Callable[[ButtonClicked | SelectChanged], Effect[ClickReply]],
submit: Callable[[ModalSubmitted], Effect[SubmitReply]],
command: Callable[[CommandInvoked], Effect[CommandReply]],
refused: Callable[
[ButtonClicked | SelectChanged | CommandInvoked, ChatError], Effect[None]
],
) -> None:
self._click = click
self._submit = submit
self._command = command
self._refused = refusedclick#
click(event) -> Effect[ClickReply]The reply to a button click or a select change.
| Parameter | Type | Description |
|---|---|---|
event | ButtonClicked | SelectChanged |
Returns Effect[ClickReply]
def click(self, event: ButtonClicked | SelectChanged) -> Effect[ClickReply]:
"""The reply to a button click or a select change."""
return self._click(event)submit#
submit(event) -> Effect[SubmitReply]The reply to a modal submit.
| Parameter | Type | Description |
|---|---|---|
event | ModalSubmitted |
Returns Effect[SubmitReply]
def submit(self, event: ModalSubmitted) -> Effect[SubmitReply]:
"""The reply to a modal submit."""
return self._submit(event)command#
command(event) -> Effect[CommandReply]The reply to a slash command.
| Parameter | Type | Description |
|---|---|---|
event | CommandInvoked |
Returns Effect[CommandReply]
def command(self, event: CommandInvoked) -> Effect[CommandReply]:
"""The reply to a slash command."""
return self._command(event)refused#
refused(event, error) -> Effect[None]Reports that a click's or a command's reply was not carried out.
| Parameter | Type | Description |
|---|---|---|
event | ButtonClicked | SelectChanged | CommandInvoked | |
error | ChatError |
Returns Effect[None]
def refused(
self, event: ButtonClicked | SelectChanged | CommandInvoked, error: ChatError
) -> Effect[None]:
"""Reports that a click's or a command's reply was not carried out."""
return self._refused(event, error)