Response Builders#
MessageBuilder
#
MessageBuilder(
type: t.Literal[
hikari.ResponseType.MESSAGE_CREATE,
4,
hikari.ResponseType.MESSAGE_UPDATE,
7,
],
content: str | hikari.UndefinedType = hikari.UNDEFINED,
*,
flags: (
hikari.MessageFlag | hikari.UndefinedType
) = hikari.UNDEFINED,
embeds: (
t.Sequence[hikari.Embed]
| hikari.UndefinedType
| None
) = hikari.UNDEFINED,
components: (
t.Sequence[hikari.api.ComponentBuilder]
| hikari.UndefinedType
| None
) = hikari.UNDEFINED,
attachments: (
t.Sequence[hikari.Resourceish]
| hikari.UndefinedType
| None
) = hikari.UNDEFINED,
is_tts: bool | hikari.UndefinedType = hikari.UNDEFINED,
mentions_everyone: (
bool | hikari.UndefinedType
) = hikari.UNDEFINED,
user_mentions: (
t.Sequence[
hikari.Snowflakeish | hikari.PartialUser
]
| bool
| hikari.UndefinedType
) = hikari.UNDEFINED,
role_mentions: (
t.Sequence[
hikari.Snowflakeish | hikari.PartialRole
]
| bool
| hikari.UndefinedType
) = hikari.UNDEFINED
)
Bases: hikari.impl.InteractionMessageBuilder
, Mapping[str, t.Any]
A builder that represents a message payload.
This adapter object can be used to create a message response in both REST and Gateway contexts. It should not be instantiated directly, it is created by special view types.
to_hikari_kwargs
#
Convert this builder to kwargs that can be passed to a hikari interaction's 'create_initial_response'.
send_to_channel
async
#
send_to_channel(
channel: hikari.SnowflakeishOr[hikari.TextableChannel],
) -> hikari.Message
Send this builder to a channel.
PARAMETER | DESCRIPTION |
---|---|
channel |
The channel to send this message to.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
hikari.Message
|
The message that was sent. |
RAISES | DESCRIPTION |
---|---|
RuntimeError
|
This method was invoked on a builder that has no client assigned to it. |
create_initial_response
async
#
create_initial_response(
interaction: hikari.MessageResponseMixin[t.Any],
) -> None
Create an initial response from this builder. This only works in a Gateway context.
When using a REST bot, this object can be returned directly from the REST interaction callback.
PARAMETER | DESCRIPTION |
---|---|
interaction |
The interaction to respond to.
TYPE:
|
RAISES | DESCRIPTION |
---|---|
RuntimeError
|
This method was invoked on a builder that was created by a RESTClient. |
respond_with_tanjun
async
#
create_followup
async
#
Create a followup message from this builder. This works in both Gateway and REST contexts.
PARAMETER | DESCRIPTION |
---|---|
interaction |
The interaction to respond to.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
hikari.Message
|
The message that was sent or edited. |
DeferredResponseBuilder
#
DeferredResponseBuilder(
type: t.Literal[
hikari.ResponseType.DEFERRED_MESSAGE_CREATE,
5,
hikari.ResponseType.DEFERRED_MESSAGE_UPDATE,
6,
],
*,
flags: (
hikari.MessageFlag | hikari.UndefinedType
) = hikari.UNDEFINED
)
Bases: hikari.impl.InteractionDeferredBuilder
, t.Mapping[str, t.Any]
A builder that represents a deferred response payload.
to_hikari_kwargs
#
Convert this builder to kwargs that can be passed to a hikari interaction's create_initial_response.
create_initial_response
async
#
create_initial_response(
interaction: hikari.MessageResponseMixin[t.Any],
) -> None
Create an initial response from this builder. This only works with a GatewayClient.
PARAMETER | DESCRIPTION |
---|---|
interaction |
The interaction to respond to.
TYPE:
|
RAISES | DESCRIPTION |
---|---|
RuntimeError
|
This method was invoked on a builder that was created by a RESTClient. |
respond_with_tanjun
async
#
respond_with_tanjun(
context: tanjun.abc.AppCommandContext,
) -> None
Respond to a tanjun context with this builder. This works in both Gateway and REST contexts.
PARAMETER | DESCRIPTION |
---|---|
context |
The context to respond to.
TYPE:
|
ModalBuilder
#
Bases: hikari.impl.InteractionModalBuilder
, t.Mapping[str, t.Any]
A builder that represents a modal payload. This can only be used as an initial response to an interaction.
This adapter object can be used to create a modal response in both REST and Gateway contexts. It should not be instantiated directly, it is created by modal objects.
to_hikari_kwargs
#
Convert this builder to kwargs that can be passed to a hikari interaction's create_modal_response.
create_modal_response
async
#
create_modal_response(
interaction: hikari.ModalResponseMixin,
) -> None
Create a modal response from this builder. This only works with a GatewayClient.
PARAMETER | DESCRIPTION |
---|---|
interaction |
The interaction to respond to.
TYPE:
|
RAISES | DESCRIPTION |
---|---|
RuntimeError
|
This method was invoked on a builder that was created by a RESTClient. |
respond_with_tanjun
async
#
respond_with_tanjun(
context: tanjun.abc.AppCommandContext,
) -> None
Respond to a tanjun context with this builder. This works in both Gateway and REST contexts.
PARAMETER | DESCRIPTION |
---|---|
context |
The context to respond to.
TYPE:
|