yuyo.interactions#
Base classes used for interaction handling.
BaseContext #
Bases: ABC
, Generic[_InteractionT]
Base class for components contexts.
alluka abstractmethod
property
#
alluka
The Alluka client being used for callback dependency injection.
cache abstractmethod
property
#
cache
Hikari cache instance this context's client was initialised with.
events abstractmethod
property
#
events
Object of the event manager this context's client was initialised with.
expires_at property
#
expires_at
When this context expires.
After this time is reached, the message/response methods on this context will always raise hikari.NotFoundError.
has_been_deferred property
#
has_been_deferred
Whether this context's initial response has been deferred.
This will be true if BaseContext.defer has been called.
has_responded property
#
has_responded
Whether an initial response has been made to this context yet.
It's worth noting that a context must be either responded to or deferred within 3 seconds from it being received otherwise it'll be marked as failed.
This will be true if either BaseContext.respond, BaseContext.create_initial_response or BaseContext.edit_initial_response (after a deferral) has been called.
rest abstractmethod
property
#
rest
Object of the Hikari REST client this context's client was initialised with.
server abstractmethod
property
#
server
Object of the Hikari interaction server provided for this context's client.
shard property
#
shard
Shard that triggered the interaction.
Note
This will be None if BaseContext.shards is also None.
shards abstractmethod
property
#
shards
Object of the Hikari shard manager this context's client was initialised with.
voice abstractmethod
property
#
voice
Object of the Hikari voice component this context's client was initialised with.
__init__ #
__init__(interaction, id_match, id_metadata, register_task, *, ephemeral_default=False, response_future=None)
Initialise a base context.
create_followup async
#
create_followup(content=hikari.UNDEFINED, *, delete_after=None, ephemeral=None, attachment=hikari.UNDEFINED, attachments=hikari.UNDEFINED, component=hikari.UNDEFINED, components=hikari.UNDEFINED, embed=hikari.UNDEFINED, embeds=hikari.UNDEFINED, mentions_everyone=hikari.UNDEFINED, user_mentions=hikari.UNDEFINED, role_mentions=hikari.UNDEFINED, tts=hikari.UNDEFINED, flags=hikari.UNDEFINED)
Create a followup response for this context.
Warning
Calling this on a context which hasn't had an initial response yet will lead to a hikari.NotFoundError being raised.
Parameters:
-
content
(UndefinedOr[Any]
, default:UNDEFINED
) –If provided, the message content to send.
If this is a hikari.Embed and no
embed
norembeds
kwarg is provided, then this will instead be treated as an embed. This allows for simpler syntax when sending an embed alone.Likewise, if this is a hikari.Resource, then the content is instead treated as an attachment if no
attachment
and noattachments
kwargs are provided. -
delete_after
(Union[timedelta, float, int, None]
, default:None
) –If provided, the seconds after which the response message should be deleted.
Interaction responses can only be deleted within 15 minutes of the interaction being received.
-
ephemeral
(Optional[bool]
, default:None
) –Whether the deferred response should be ephemeral. Passing True here is a shorthand for including
1 << 64
in the passed flags. -
attachment
(UndefinedOr[Resourceish]
, default:UNDEFINED
) –If provided, the message attachment. This can be a resource, or string of a path on your computer or a URL.
-
attachments
(UndefinedOr[Sequence[Resourceish]]
, default:UNDEFINED
) –If provided, the message attachments. These can be resources, or strings consisting of paths on your computer or URLs.
-
component
(UndefinedOr[ComponentBuilder]
, default:UNDEFINED
) –If provided, builder object of the component to include in this message.
-
components
(UndefinedOr[Sequence[ComponentBuilder]]
, default:UNDEFINED
) –If provided, a sequence of the component builder objects to include in this message.
-
embed
(UndefinedOr[Embed]
, default:UNDEFINED
) –If provided, the message embed.
-
embeds
(UndefinedOr[Sequence[Embed]]
, default:UNDEFINED
) –If provided, the message embeds.
-
mentions_everyone
(UndefinedOr[bool]
, default:UNDEFINED
) –If provided, whether the message should parse @everyone/@here mentions.
-
user_mentions
(Union[SnowflakeishSequence[PartialUser], bool, UndefinedType]
, default:UNDEFINED
) –If provided, and True, all mentions will be parsed. If provided, and False, no mentions will be parsed.
Alternatively this may be a collection of hikari.Snowflake, or hikari.PartialUser derivatives to enforce mentioning specific users.
-
role_mentions
(Union[SnowflakeishSequence[PartialRole], bool, UndefinedType]
, default:UNDEFINED
) –If provided, and True, all mentions will be parsed. If provided, and False, no mentions will be parsed.
Alternatively this may be a collection of hikari.Snowflake, or hikari.PartialRole derivatives to enforce mentioning specific roles.
-
tts
(UndefinedOr[bool]
, default:UNDEFINED
) –If provided, whether the message will be sent as a TTS message.
-
flags
(Union[UndefinedType, int, MessageFlag]
, default:UNDEFINED
) –The flags to set for this response.
As of writing this can only flag which can be provided is EPHEMERAL, other flags are just ignored.
Returns:
-
Message
–The created message object.
Raises:
-
NotFoundError
–If the current interaction is not found or it hasn't had an initial response yet.
-
BadRequestError
–This can be raised if the file is too large; if the embed exceeds the defined limits; if the message content is specified only and empty or greater than
2000
characters; if neither content, file or embeds are specified. If any invalid snowflake IDs are passed; a snowflake may be invalid due to it being outside of the range of a 64 bit integer. -
ValueError
–If more than 100 unique objects/entities are passed for
role_mentions
or `user_mentions.If the interaction will have expired before
delete_after
is reached.If both
attachment
andattachments
are passed or bothcomponent
andcomponents
are passed or bothembed
andembeds
are passed.
create_initial_response async
#
create_initial_response(content=hikari.UNDEFINED, *, response_type=hikari.ResponseType.MESSAGE_CREATE, delete_after=None, ephemeral=None, attachment=hikari.UNDEFINED, attachments=hikari.UNDEFINED, component=hikari.UNDEFINED, components=hikari.UNDEFINED, embed=hikari.UNDEFINED, embeds=hikari.UNDEFINED, mentions_everyone=hikari.UNDEFINED, user_mentions=hikari.UNDEFINED, role_mentions=hikari.UNDEFINED, flags=hikari.UNDEFINED, tts=hikari.UNDEFINED)
Create the initial response for this context.
Warning
Calling this on a context which already has an initial response will result in this raising a hikari.NotFoundError. This includes if the REST interaction server has already responded to the request and deferrals.
Parameters:
-
content
(UndefinedOr[Any]
, default:UNDEFINED
) –If provided, the message content to respond with.
If this is a hikari.Embed and no
embed
norembeds
kwarg is provided, then this will instead be treated as an embed. This allows for simpler syntax when sending an embed alone.Likewise, if this is a hikari.Resource, then the content is instead treated as an attachment if no
attachment
and noattachments
kwargs are provided. -
response_type
(MessageResponseTypesT
, default:MESSAGE_CREATE
) –The type of message response to give.
-
delete_after
(Union[timedelta, float, int, None]
, default:None
) –If provided, the seconds after which the response message should be deleted.
Interaction responses can only be deleted within 15 minutes of the interaction being received.
-
ephemeral
(Optional[bool]
, default:None
) –Whether the deferred response should be ephemeral.
Passing True here is a shorthand for including
1 << 64
in the passed flags. -
attachment
(UndefinedOr[Resourceish]
, default:UNDEFINED
) –If provided, the message attachment. This can be a resource, or string of a path on your computer or a URL.
-
attachments
(UndefinedOr[Sequence[Resourceish]]
, default:UNDEFINED
) –If provided, the message attachments. These can be resources, or strings consisting of paths on your computer or URLs.
-
component
(UndefinedOr[ComponentBuilder]
, default:UNDEFINED
) –If provided, builder object of the component to include in this message.
-
components
(UndefinedOr[Sequence[ComponentBuilder]]
, default:UNDEFINED
) –If provided, a sequence of the component builder objects to include in this message.
-
embed
(UndefinedOr[Embed]
, default:UNDEFINED
) –If provided, the message embed.
-
embeds
(UndefinedOr[Sequence[Embed]]
, default:UNDEFINED
) –If provided, the message embeds.
-
flags
(Union[int, MessageFlag, UndefinedType]
, default:UNDEFINED
) –If provided, the message flags this response should have.
As of writing the only message flag which can be set here is MessageFlag.EPHEMERAL.
-
tts
(UndefinedOr[bool]
, default:UNDEFINED
) –If provided, whether the message will be read out by a screen reader using Discord's TTS (text-to-speech) system.
-
mentions_everyone
(UndefinedOr[bool]
, default:UNDEFINED
) –If provided, whether the message should parse @everyone/@here mentions.
-
user_mentions
(Union[SnowflakeishSequence[PartialUser], bool, UndefinedType]
, default:UNDEFINED
) –If provided, and True, all mentions will be parsed. If provided, and False, no mentions will be parsed.
Alternatively this may be a collection of hikari.Snowflake, or hikari.PartialUser derivatives to enforce mentioning specific users.
-
role_mentions
(Union[SnowflakeishSequence[PartialRole], bool, UndefinedType]
, default:UNDEFINED
) –If provided, and True, all mentions will be parsed. If provided, and False, no mentions will be parsed.
Alternatively this may be a collection of hikari.Snowflake, or hikari.PartialRole derivatives to enforce mentioning specific roles.
Raises:
-
ValueError
–If more than 100 unique objects/entities are passed for
role_mentions
oruser_mentions
.If the interaction will have expired before
delete_after
is reached.If both
attachment
andattachments
are passed or bothcomponent
andcomponents
are passed or bothembed
andembeds
are passed. -
BadRequestError
–This may be raised in several discrete situations, such as messages being empty with no embeds; messages with more than 2000 characters in them, embeds that exceed one of the many embed limits; invalid image URLs in embeds.
-
UnauthorizedError
–If you are unauthorized to make the request (invalid/missing token).
-
NotFoundError
–If the interaction is not found or if the interaction's initial response has already been created.
-
RateLimitTooLongError
–Raised in the event that a rate limit occurs that is longer than
max_rate_limit
when making a request. -
InternalServerError
–If an internal error occurs on Discord while handling the request.
defer async
#
defer(*, defer_type=hikari.ResponseType.DEFERRED_MESSAGE_CREATE, ephemeral=None, flags=hikari.UNDEFINED)
Defer the initial response for this context.
Note
The ephemeral state of the first response is decided by whether the deferral is ephemeral.
Parameters:
-
defer_type
(DeferredResponseTypesT
, default:DEFERRED_MESSAGE_CREATE
) –The type of deferral this should be.
This may any of the following:
- ResponseType.DEFERRED_MESSAGE_CREATE to indicate that the following up call to BaseContext.edit_initial_response or BaseContext.respond should create a new message.
- ResponseType.DEFERRED_MESSAGE_UPDATE to indicate that the following call to the aforementioned methods should update the existing message.
-
ephemeral
(Optional[bool]
, default:None
) –Whether the deferred response should be ephemeral.
Passing True here is a shorthand for including
1 << 64
in the passed flags. -
flags
(Union[UndefinedType, int, MessageFlag]
, default:UNDEFINED
) –The flags to use for the initial response.
delete_initial_response async
#
delete_initial_response()
Delete the initial response after invoking this context.
Raises:
-
(LookupError, NotFoundError)
–The last context has no initial response.
delete_last_response async
#
delete_last_response()
Delete the last response after invoking this context.
Raises:
-
(LookupError, NotFoundError)
–The last context has no responses.
edit_initial_response async
#
edit_initial_response(content=hikari.UNDEFINED, *, delete_after=None, attachment=hikari.UNDEFINED, attachments=hikari.UNDEFINED, component=hikari.UNDEFINED, components=hikari.UNDEFINED, embed=hikari.UNDEFINED, embeds=hikari.UNDEFINED, mentions_everyone=hikari.UNDEFINED, user_mentions=hikari.UNDEFINED, role_mentions=hikari.UNDEFINED)
Edit the initial response for this context.
Parameters:
-
content
(UndefinedOr[Any]
, default:UNDEFINED
) –If provided, the message content to edit the initial response with.
If this is a hikari.Embed and no
embed
norembeds
kwarg is provided, then this will instead update the embed. This allows for simpler syntax when sending an embed alone.Likewise, if this is a hikari.Resource, then the content is instead treated as an attachment if no
attachment
and noattachments
kwargs are provided. -
delete_after
(Union[timedelta, float, int, None]
, default:None
) –If provided, the seconds after which the response message should be deleted.
Interaction responses can only be deleted within 15 minutes of the interaction being received.
-
attachment
(UndefinedNoneOr[Resourceish]
, default:UNDEFINED
) –A singular attachment to edit the initial response with.
-
attachments
(UndefinedNoneOr[Sequence[Resourceish]]
, default:UNDEFINED
) –A sequence of attachments to edit the initial response with.
-
component
(UndefinedNoneOr[ComponentBuilder]
, default:UNDEFINED
) –If provided, builder object of the component to set for this message. This component will replace any previously set components and passing None will remove all components.
-
components
(UndefinedNoneOr[Sequence[ComponentBuilder]]
, default:UNDEFINED
) –If provided, a sequence of the component builder objects set for this message. These components will replace any previously set components and passing None or an empty sequence will remove all components.
-
embed
(UndefinedNoneOr[Embed]
, default:UNDEFINED
) –An embed to replace the initial response with.
-
embeds
(UndefinedNoneOr[Sequence[Embed]]
, default:UNDEFINED
) –A sequence of embeds to replace the initial response with.
-
mentions_everyone
(UndefinedOr[bool]
, default:UNDEFINED
) –If provided, whether the message should parse @everyone/@here mentions.
-
user_mentions
(Union[SnowflakeishSequence[PartialUser], bool, UndefinedType]
, default:UNDEFINED
) –If provided, and True, all mentions will be parsed. If provided, and False, no mentions will be parsed.
Alternatively this may be a collection of hikari.Snowflake, or hikari.PartialUser derivatives to enforce mentioning specific users.
-
role_mentions
(Union[SnowflakeishSequence[PartialRole], bool, UndefinedType]
, default:UNDEFINED
) –If provided, and True, all mentions will be parsed. If provided, and False, no mentions will be parsed.
Alternatively this may be a collection of hikari.Snowflake, or hikari.PartialRole derivatives to enforce mentioning specific roles.
Returns:
-
Message
–The message that has been edited.
Raises:
-
ValueError
–If more than 100 unique objects/entities are passed for
role_mentions
oruser_mentions
.If
delete_after
would be more than 15 minutes after the interaction was received.If both
attachment
andattachments
are passed or bothcomponent
andcomponents
are passed or bothembed
andembeds
are passed. -
BadRequestError
–This may be raised in several discrete situations, such as messages being empty with no attachments or embeds; messages with more than 2000 characters in them, embeds that exceed one of the many embed limits; too many attachments; attachments that are too large; invalid image URLs in embeds; too many components.
-
UnauthorizedError
–If you are unauthorized to make the request (invalid/missing token).
-
ForbiddenError
–If you are missing the
SEND_MESSAGES
in the channel or the person you are trying to message has the DM's disabled. -
NotFoundError
–If the channel is not found.
-
RateLimitTooLongError
–Raised in the event that a rate limit occurs that is longer than
max_rate_limit
when making a request. -
InternalServerError
–If an internal error occurs on Discord while handling the request.
edit_last_response async
#
edit_last_response(content=hikari.UNDEFINED, *, delete_after=None, attachment=hikari.UNDEFINED, attachments=hikari.UNDEFINED, component=hikari.UNDEFINED, components=hikari.UNDEFINED, embed=hikari.UNDEFINED, embeds=hikari.UNDEFINED, mentions_everyone=hikari.UNDEFINED, user_mentions=hikari.UNDEFINED, role_mentions=hikari.UNDEFINED)
Edit the last response for this context.
Parameters:
-
content
(UndefinedOr[Any]
, default:UNDEFINED
) –If provided, the content to edit the last response with.
If this is a hikari.Embed and no
embed
norembeds
kwarg is provided, then this will instead update the embed. This allows for simpler syntax when sending an embed alone.Likewise, if this is a hikari.Resource, then the content is instead treated as an attachment if no
attachment
and noattachments
kwargs are provided. -
delete_after
(Union[timedelta, float, int, None]
, default:None
) –If provided, the seconds after which the response message should be deleted.
Interaction responses can only be deleted within 15 minutes of the interaction being received.
-
attachment
(UndefinedNoneOr[Resourceish]
, default:UNDEFINED
) –A singular attachment to edit the last response with.
-
attachments
(UndefinedNoneOr[Sequence[Resourceish]]
, default:UNDEFINED
) –A sequence of attachments to edit the last response with.
-
component
(UndefinedNoneOr[ComponentBuilder]
, default:UNDEFINED
) –If provided, builder object of the component to set for this message. This component will replace any previously set components and passing None will remove all components.
-
components
(UndefinedNoneOr[Sequence[ComponentBuilder]]
, default:UNDEFINED
) –If provided, a sequence of the component builder objects set for this message. These components will replace any previously set components and passing None or an empty sequence will remove all components.
-
embed
(UndefinedNoneOr[Embed]
, default:UNDEFINED
) –An embed to replace the last response with.
-
embeds
(UndefinedNoneOr[Sequence[Embed]]
, default:UNDEFINED
) –A sequence of embeds to replace the last response with.
-
mentions_everyone
(UndefinedOr[bool]
, default:UNDEFINED
) –If provided, whether the message should parse @everyone/@here mentions.
-
user_mentions
(Union[SnowflakeishSequence[PartialUser], bool, UndefinedType]
, default:UNDEFINED
) –If provided, and True, all mentions will be parsed. If provided, and False, no mentions will be parsed.
Alternatively this may be a collection of hikari.Snowflake, or hikari.PartialUser derivatives to enforce mentioning specific users.
-
role_mentions
(Union[SnowflakeishSequence[PartialRole], bool, UndefinedType]
, default:UNDEFINED
) –If provided, and True, all mentions will be parsed. If provided, and False, no mentions will be parsed.
Alternatively this may be a collection of hikari.Snowflake, or hikari.PartialRole derivatives to enforce mentioning specific roles.
Returns:
-
Message
–The message that has been edited.
Raises:
-
ValueError
–If more than 100 unique objects/entities are passed for
role_mentions
oruser_mentions
.If
delete_after
would be more than 15 minutes after the slash interaction was received.If both
attachment
andattachments
are passed or bothcomponent
andcomponents
are passed or bothembed
andembeds
are passed. -
BadRequestError
–This may be raised in several discrete situations, such as messages being empty with no attachments or embeds; messages with more than 2000 characters in them, embeds that exceed one of the many embed limits; too many attachments; attachments that are too large; invalid image URLs in embeds; too many components.
-
UnauthorizedError
–If you are unauthorized to make the request (invalid/missing token).
-
ForbiddenError
–If you are missing the
SEND_MESSAGES
in the channel or the person you are trying to message has the DM's disabled. -
NotFoundError
–If the channel is not found.
-
RateLimitTooLongError
–Raised in the event that a rate limit occurs that is longer than
max_rate_limit
when making a request. -
InternalServerError
–If an internal error occurs on Discord while handling the request.
fetch_initial_response async
#
fetch_initial_response()
Fetch the initial response for this context.
Returns:
-
Message
–The initial response's message object.
Raises:
-
(LookupError, NotFoundError)
–The response was not found.
fetch_last_response async
#
fetch_last_response()
Fetch the last response for this context.
Returns:
-
Message
–The most response response's message object.
Raises:
-
(LookupError, NotFoundError)
–The response was not found.
respond async
#
respond(content=hikari.UNDEFINED, *, ensure_result=False, delete_after=None, attachment=hikari.UNDEFINED, attachments=hikari.UNDEFINED, component=hikari.UNDEFINED, components=hikari.UNDEFINED, embed=hikari.UNDEFINED, embeds=hikari.UNDEFINED, mentions_everyone=hikari.UNDEFINED, user_mentions=hikari.UNDEFINED, role_mentions=hikari.UNDEFINED)
Respond to this context.
Parameters:
-
content
(UndefinedOr[Any]
, default:UNDEFINED
) –If provided, the message content to respond with.
If this is a hikari.Embed and no
embed
norembeds
kwarg is provided, then this will instead be treated as an embed. This allows for simpler syntax when sending an embed alone.Likewise, if this is a hikari.Resource, then the content is instead treated as an attachment if no
attachment
and noattachments
kwargs are provided. -
ensure_result
(bool
, default:False
) –Ensure that this call will always return a message object.
If True then this will always return hikari.Message, otherwise this will return
hikari.Message | None
.It's worth noting that this may lead to an extre request being made under certain scenarios.
-
delete_after
(Union[timedelta, float, int, None]
, default:None
) –If provided, the seconds after which the response message should be deleted.
Interaction responses can only be deleted within 15 minutes of the interaction being received.
-
attachment
(UndefinedOr[Resourceish]
, default:UNDEFINED
) –If provided, the message attachment. This can be a resource, or string of a path on your computer or a URL.
-
attachments
(UndefinedOr[Sequence[Resourceish]]
, default:UNDEFINED
) –If provided, the message attachments. These can be resources, or strings consisting of paths on your computer or URLs.
-
component
(UndefinedOr[ComponentBuilder]
, default:UNDEFINED
) –If provided, builder object of the component to include in this response.
-
components
(UndefinedOr[Sequence[ComponentBuilder]]
, default:UNDEFINED
) –If provided, a sequence of the component builder objects to include in this response.
-
embed
(UndefinedOr[Embed]
, default:UNDEFINED
) –An embed to respond with.
-
embeds
(UndefinedOr[Sequence[Embed]]
, default:UNDEFINED
) –A sequence of embeds to respond with.
-
mentions_everyone
(UndefinedOr[bool]
, default:UNDEFINED
) –If provided, whether the message should parse @everyone/@here mentions.
-
user_mentions
(Union[SnowflakeishSequence[PartialUser], bool, UndefinedType]
, default:UNDEFINED
) –If provided, and True, all mentions will be parsed. If provided, and False, no mentions will be parsed.
Alternatively this may be a collection of hikari.Snowflake, or hikari.PartialUser derivatives to enforce mentioning specific users.
-
role_mentions
(Union[SnowflakeishSequence[PartialRole], bool, UndefinedType]
, default:UNDEFINED
) –If provided, and True, all mentions will be parsed. If provided, and False, no mentions will be parsed.
Alternatively this may be a collection of hikari.Snowflake, or hikari.PartialRole derivatives to enforce mentioning specific roles.
Returns:
-
Message | None
–
Raises:
-
ValueError
–If more than 100 unique objects/entities are passed for
role_mentions
oruser_mentions
.If
delete_after
would be more than 15 minutes after the interaction was received.If both
attachment
andattachments
are passed or bothcomponent
andcomponents
are passed or bothembed
andembeds
are passed. -
BadRequestError
–This may be raised in several discrete situations, such as messages being empty with no attachments or embeds; messages with more than 2000 characters in them, embeds that exceed one of the many embed limits; too many attachments; attachments that are too large; invalid image URLs in embeds; too many components.
-
UnauthorizedError
–If you are unauthorized to make the request (invalid/missing token).
-
ForbiddenError
–If you are missing the
SEND_MESSAGES
in the channel or the person you are trying to message has the DM's disabled. -
NotFoundError
–If the channel is not found.
-
RateLimitTooLongError
–Raised in the event that a rate limit occurs that is longer than
max_rate_limit
when making a request. -
InternalServerError
–If an internal error occurs on Discord while handling the request.
InteractionError #
Bases: Exception
Error which is sent as a response to a modal or component call.
__init__ #
__init__(content=hikari.UNDEFINED, *, delete_after=None, attachment=hikari.UNDEFINED, attachments=hikari.UNDEFINED, component=hikari.UNDEFINED, components=hikari.UNDEFINED, embed=hikari.UNDEFINED, embeds=hikari.UNDEFINED, mentions_everyone=hikari.UNDEFINED, user_mentions=hikari.UNDEFINED, role_mentions=hikari.UNDEFINED)
Initialise an interaction error.
Parameters:
-
content
(UndefinedOr[Any]
, default:UNDEFINED
) –If provided, the message content to respond with.
If this is a hikari.Embed and no
embed
norembeds
kwarg is provided, then this will instead be treated as an embed. This allows for simpler syntax when sending an embed alone.Likewise, if this is a hikari.Resource, then the content is instead treated as an attachment if no
attachment
and noattachments
kwargs are provided. -
delete_after
(Union[timedelta, float, int, None]
, default:None
) –If provided, the seconds after which the response message should be deleted.
Interaction responses can only be deleted within 15 minutes of the interaction being received.
-
attachment
(UndefinedOr[Resourceish]
, default:UNDEFINED
) –A singular attachment to respond with.
-
attachments
(UndefinedOr[Sequence[Resourceish]]
, default:UNDEFINED
) –A sequence of attachments to respond with.
-
component
(UndefinedOr[ComponentBuilder]
, default:UNDEFINED
) –If provided, builder object of the component to include in this response.
-
components
(UndefinedOr[Sequence[ComponentBuilder]]
, default:UNDEFINED
) –If provided, a sequence of the component builder objects to include in this response.
-
embed
(UndefinedOr[Embed]
, default:UNDEFINED
) –An embed to respond with.
-
embeds
(UndefinedOr[Sequence[Embed]]
, default:UNDEFINED
) –A sequence of embeds to respond with.
-
mentions_everyone
(UndefinedOr[bool]
, default:UNDEFINED
) –If provided, whether the message should parse @everyone/@here mentions.
-
user_mentions
(Union[SnowflakeishSequence[PartialUser], bool, UndefinedType]
, default:UNDEFINED
) –If provided, and True, all mentions will be parsed. If provided, and False, no mentions will be parsed.
Alternatively this may be a collection of hikari.Snowflake, or hikari.PartialUser derivatives to enforce mentioning specific users.
-
role_mentions
(Union[SnowflakeishSequence[PartialRole], bool, UndefinedType]
, default:UNDEFINED
) –If provided, and True, all mentions will be parsed. If provided, and False, no mentions will be parsed.
Alternatively this may be a collection of hikari.Snowflake, or hikari.PartialRole derivatives to enforce mentioning specific roles.
Raises:
-
ValueError
–Raised for any of the following reasons:
- When both
attachment
andattachments
are provided. - When both
component
andcomponents
are passed. - When both
embed
andembeds
are passed. - If more than 100 entries are passed for
role_mentions
. - If more than 100 entries are passed for
user_mentions
.
- When both
send async
#
send(ctx, /, *, ensure_result=False)
Send this error as an interaction response.
Parameters:
-
ctx
(Union[BaseContext[ComponentInteraction], BaseContext[ModalInteraction]]
) –The interaction context to respond to.
-
ensure_result
(bool
, default:False
) –Ensure that this call will always return a message object.
If True then this will always return hikari.Message, otherwise this will return
hikari.Message | None
.It's worth noting that this may lead to an extra request being made under certain scenarios.
Raises:
-
ValueError
–If
delete_after
would be more than 15 minutes after the interaction was received. -
BadRequestError
–This may be raised in several discrete situations, such as messages being empty with no attachments or embeds; messages with more than 2000 characters in them, embeds that exceed one of the many embed limits; too many attachments; attachments that are too large; invalid image URLs in embeds; too many components.
-
UnauthorizedError
–If you are unauthorized to make the request (invalid/missing token).
-
ForbiddenError
–If you are missing the
SEND_MESSAGES
in the channel or the person you are trying to message has the DM's disabled. -
NotFoundError
–If the channel is not found.
-
RateLimitTooLongError
–Raised in the event that a rate limit occurs that is longer than
max_rate_limit
when making a request. -
InternalServerError
–If an internal error occurs on Discord while handling the request.