hikari.interactions.base_interactions
#
Base classes and enums inherited and used throughout the interactions flow.
DEFERRED_RESPONSE_TYPES
module-attribute
#
DEFERRED_RESPONSE_TYPES: Final[AbstractSet[DeferredResponseTypesT]] = frozenset(
[DEFERRED_MESSAGE_CREATE, DEFERRED_MESSAGE_UPDATE]
)
Set of the response types which are valid for deferred messages responses.
This includes the following:
DeferredResponseTypesT
module-attribute
#
DeferredResponseTypesT = Literal[
DEFERRED_MESSAGE_CREATE, 5, DEFERRED_MESSAGE_UPDATE, 6
]
Type-hint of the response types which are valid for deferred messages responses.
The following are valid for this:
MESSAGE_RESPONSE_TYPES
module-attribute
#
MESSAGE_RESPONSE_TYPES: Final[AbstractSet[MessageResponseTypesT]] = frozenset(
[MESSAGE_CREATE, MESSAGE_UPDATE]
)
Set of the response types which are valid for message responses.
This includes the following:
MessageResponseTypesT
module-attribute
#
MessageResponseTypesT = Literal[MESSAGE_CREATE, 4, MESSAGE_UPDATE, 7]
Type-hint of the response types which are valid for message responses.
The following are valid for this:
InteractionChannel
#
Bases: PartialChannel
Represents partial channels returned as resolved entities on interactions.
app
class-attribute
instance-attribute
#
Client application that models may use for procedures.
id
class-attribute
instance-attribute
#
The ID of this entity.
mention
property
#
mention: str
Return a raw mention string for the channel.
Note
There are platform specific inconsistencies with mentions of GuildCategories, GroupDMChannels and DMChannels showing the correct name but not being interactable.
RETURNS | DESCRIPTION |
---|---|
str
|
The mention string to use. |
name
class-attribute
instance-attribute
#
The channel's name. This will be missing for DM channels.
permissions
class-attribute
instance-attribute
#
permissions: Permissions = field(eq=False, hash=False, repr=True)
Permissions the command's executor has in this channel.
type
class-attribute
instance-attribute
#
type: Union[ChannelType, int] = field(eq=False, hash=False, repr=True)
The channel's type.
delete
async
#
delete() -> PartialChannel
Delete a channel in a guild, or close a DM.
Note
For Public servers, the set 'Rules' or 'Guidelines' channels and the 'Public Server Updates' channel cannot be deleted.
RETURNS | DESCRIPTION |
---|---|
PartialChannel
|
Object of the channel that was deleted. |
RAISES | DESCRIPTION |
---|---|
UnauthorizedError
|
If you are unauthorized to make the request (invalid/missing token). |
ForbiddenError
|
If you are missing the |
NotFoundError
|
If the channel is not found. |
RateLimitTooLongError
|
Raised in the event that a rate limit occurs that is
longer than |
InternalServerError
|
If an internal error occurs on Discord while handling the request. |
InteractionMember
#
Bases: Member
Model of the member who triggered an interaction.
Unlike hikari.guilds.Member
, this object comes with an extra
hikari.interactions.base_interactions.InteractionMember.permissions
field.
accent_color
property
#
The custom banner color for the user, if set else None
.
The official client will decide the default color if not set.
accent_colour
property
#
Alias for the hikari.users.User.accent_color
field.
avatar_url
property
#
Avatar URL for the user, if they have one set.
May be None
if no custom avatar is set. In this case, you
should use hikari.User.default_avatar_url
instead.
banner_url
property
#
Banner URL for the user, if they have one set.
May be None
if no custom banner is set.
discriminator
property
#
discriminator: str
Discriminator for the user.
!!! deprecated 2.0.0.dev120 Discriminators are deprecated and being replaced with "0" by Discord during username migration. This field will be removed after migration is complete. Learn more here: https://dis.gd/usernames
display_name
property
#
display_name: str
Return the member's display name.
If the member has a nickname, this will return that nickname. If the user has a global name, this will return that global name. If the user has neither, the username will be returned instead.
See Also
guild_avatar_hash
class-attribute
instance-attribute
#
Hash of the member's guild avatar guild if set, else None
.
Note
This takes precedence over hikari.guilds.Member.avatar_hash
.
guild_avatar_url
property
#
Guild Avatar URL for the user, if they have one set.
May be None
if no guild avatar is set. In this case, you
should use hikari.guilds.Member.avatar_hash
or hikari.guilds.Member.default_avatar_url
instead.
guild_id
class-attribute
instance-attribute
#
The ID of the guild this member belongs to.
is_deaf
class-attribute
instance-attribute
#
is_deaf: UndefinedOr[bool] = field(repr=False)
True
if this member is deafened in the current voice channel.
This will be hikari.undefined.UNDEFINED
if it's state is
unknown.
is_mute
class-attribute
instance-attribute
#
is_mute: UndefinedOr[bool] = field(repr=False)
True
if this member is muted in the current voice channel.
This will be hikari.undefined.UNDEFINED
if it's state is unknown.
is_pending
class-attribute
instance-attribute
#
is_pending: UndefinedOr[bool] = field(repr=False)
Whether the user has passed the guild's membership screening requirements.
This will be hikari.undefined.UNDEFINED
if it's state is unknown.
joined_at
class-attribute
instance-attribute
#
The datetime of when this member joined the guild they belong to.
This will be None
for guest members that have been temporarily
invited.
permissions
class-attribute
instance-attribute
#
permissions: Permissions = field(eq=False, hash=False, repr=False)
Permissions the member has in the current channel.
premium_since
class-attribute
instance-attribute
#
The datetime of when this member started "boosting" this guild.
Will be None
if the member is not a premium user.
raw_communication_disabled_until
class-attribute
instance-attribute
#
The datetime when this member's timeout will expire.
Will be None
if the member is not timed out.
Note
The datetime might be in the past, so it is recommended to use
hikari.guilds.Member.communication_disabled_until
method to check if the member is timed
out at the time of the call.
role_ids
class-attribute
instance-attribute
#
A sequence of the IDs of the member's current roles.
user
class-attribute
instance-attribute
#
This member's corresponding user object.
add_role
async
#
add_role(
role: SnowflakeishOr[PartialRole],
*,
reason: UndefinedOr[str] = undefined.UNDEFINED
) -> None
Add a role to the member.
PARAMETER | DESCRIPTION |
---|---|
role |
The role to add. This may be the object or the ID of an existing role.
TYPE:
|
PARAMETER | DESCRIPTION |
---|---|
reason |
If provided, the reason that will be recorded in the audit logs. Maximum of 512 characters.
TYPE:
|
RAISES | DESCRIPTION |
---|---|
ForbiddenError
|
If you are missing the |
UnauthorizedError
|
If you are unauthorized to make the request (invalid/missing token). |
NotFoundError
|
If the guild, user or role are not found. |
RateLimitTooLongError
|
Raised in the event that a rate limit occurs that is
longer than |
InternalServerError
|
If an internal error occurs on Discord while handling the request. |
ban
async
#
ban(
*,
delete_message_seconds: UndefinedOr[Intervalish] = undefined.UNDEFINED,
reason: UndefinedOr[str] = undefined.UNDEFINED
) -> None
Ban this member from this guild.
PARAMETER | DESCRIPTION |
---|---|
delete_message_seconds |
If provided, the number of seconds to delete messages for.
This can be represented as either an int/float between 0 and 604800 (7 days), or
a
TYPE:
|
reason |
If provided, the reason that will be recorded in the audit logs. Maximum of 512 characters.
TYPE:
|
RAISES | DESCRIPTION |
---|---|
BadRequestError
|
If any of the fields that are passed have an invalid value. |
ForbiddenError
|
If you are missing the |
UnauthorizedError
|
If you are unauthorized to make the request (invalid/missing token). |
NotFoundError
|
If the guild or user are not found. |
RateLimitTooLongError
|
Raised in the event that a rate limit occurs that is
longer than |
InternalServerError
|
If an internal error occurs on Discord while handling the request. |
communication_disabled_until
#
Return when the timeout for this member ends.
Unlike raw_communication_disabled_until
, this will always be
None
if the member is not currently timed out.
Note
The output of this function can depend based on when the function is called.
edit
async
#
edit(
*,
nickname: UndefinedNoneOr[str] = undefined.UNDEFINED,
roles: UndefinedOr[SnowflakeishSequence[PartialRole]] = undefined.UNDEFINED,
mute: UndefinedOr[bool] = undefined.UNDEFINED,
deaf: UndefinedOr[bool] = undefined.UNDEFINED,
voice_channel: UndefinedNoneOr[
SnowflakeishOr[GuildVoiceChannel]
] = undefined.UNDEFINED,
communication_disabled_until: UndefinedNoneOr[
datetime
] = undefined.UNDEFINED,
reason: UndefinedOr[str] = undefined.UNDEFINED
) -> Member
Edit the member.
PARAMETER | DESCRIPTION |
---|---|
nickname |
If provided, the new nick for the member. If Requires the
TYPE:
|
roles |
If provided, the new roles for the member. Requires the |
mute |
If provided, the new server mute state for the member. Requires the
TYPE:
|
deaf |
If provided, the new server deaf state for the member. Requires the
TYPE:
|
voice_channel |
If provided, Requires the Note If the member is not in a voice channel, this will take no effect.
TYPE:
|
communication_disabled_until |
If provided, the datetime when the timeout (disable communication)
of the member expires, up to 28 days in the future, or Requires the
TYPE:
|
reason |
If provided, the reason that will be recorded in the audit logs. Maximum of 512 characters.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Member
|
Object of the member that was updated. |
RAISES | DESCRIPTION |
---|---|
BadRequestError
|
If any of the fields that are passed have an invalid value. |
ForbiddenError
|
If you are missing a permission to do an action. |
UnauthorizedError
|
If you are unauthorized to make the request (invalid/missing token). |
NotFoundError
|
If the guild or the user are not found. |
RateLimitTooLongError
|
Raised in the event that a rate limit occurs that is
longer than |
InternalServerError
|
If an internal error occurs on Discord while handling the request. |
fetch_dm_channel
async
#
fetch_dm_channel() -> DMChannel
Fetch the DM channel for this user.
RETURNS | DESCRIPTION |
---|---|
DMChannel
|
The requested channel. |
RAISES | DESCRIPTION |
---|---|
UnauthorizedError
|
If you are unauthorized to make the request (invalid/missing token). |
NotFoundError
|
If the user is not found. |
RateLimitTooLongError
|
Raised in the event that a rate limit occurs that is
longer than |
InternalServerError
|
If an internal error occurs on Discord while handling the request. |
fetch_roles
async
#
Fetch an up-to-date view of this member's roles from the API.
RETURNS | DESCRIPTION |
---|---|
Sequence[Role]
|
An up-to-date view of this member's roles. |
RAISES | DESCRIPTION |
---|---|
UnauthorizedError
|
If you are unauthorized to make the request (invalid/missing token). |
NotFoundError
|
If the member is not found. |
RateLimitTooLongError
|
Raised in the event that a rate limit occurs that is
longer than |
InternalServerError
|
If an internal error occurs on Discord while handling the request. |
fetch_self
async
#
fetch_self() -> Member
Fetch an up-to-date view of this member from the API.
RETURNS | DESCRIPTION |
---|---|
Member
|
An up-to-date view of this member. |
RAISES | DESCRIPTION |
---|---|
UnauthorizedError
|
If you are unauthorized to make the request (invalid/missing token). |
NotFoundError
|
If the member is not found. |
RateLimitTooLongError
|
Raised in the event that a rate limit occurs that is
longer than |
InternalServerError
|
If an internal error occurs on Discord while handling the request. |
get_guild
#
get_presence
#
get_presence() -> Optional[MemberPresence]
Get the cached presence for this member, if known.
Presence info includes user status and activities.
This requires the hikari.intents.Intents.GUILD_PRESENCES
intent to be enabled.
RETURNS | DESCRIPTION |
---|---|
Optional[MemberPresence]
|
The member presence, or |
get_roles
#
get_top_role
#
kick
async
#
kick(*, reason: UndefinedOr[str] = undefined.UNDEFINED) -> None
Kick this member from this guild.
PARAMETER | DESCRIPTION |
---|---|
reason |
If provided, the reason that will be recorded in the audit logs. Maximum of 512 characters.
TYPE:
|
RAISES | DESCRIPTION |
---|---|
BadRequestError
|
If any of the fields that are passed have an invalid value. |
ForbiddenError
|
If you are missing the |
UnauthorizedError
|
If you are unauthorized to make the request (invalid/missing token). |
NotFoundError
|
If the guild or user are not found. |
RateLimitTooLongError
|
Raised in the event that a rate limit occurs that is
longer than |
InternalServerError
|
If an internal error occurs on Discord while handling the request. |
make_avatar_url
#
Generate the avatar URL for this user, if set.
If no custom avatar is set, this returns None
. You can then
use the hikari.User.default_avatar_url
attribute instead to fetch
the displayed URL.
PARAMETER | DESCRIPTION |
---|---|
ext |
The ext to use for this URL.
Supports If |
size |
The size to set for the URL.
Can be any power of two between
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Optional[URL]
|
The URL to the avatar, or |
RAISES | DESCRIPTION |
---|---|
ValueError
|
If |
make_banner_url
#
Generate the banner URL for this user, if set.
If no custom banner is set, this returns None
.
PARAMETER | DESCRIPTION |
---|---|
ext |
The ext to use for this URL.
Supports If |
size |
The size to set for the URL.
Can be any power of two between
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Optional[URL]
|
The URL to the banner, or |
RAISES | DESCRIPTION |
---|---|
ValueError
|
If |
make_guild_avatar_url
#
Generate the guild specific avatar url for this member, if set.
If no guild avatar is set, this returns None
.
PARAMETER | DESCRIPTION |
---|---|
ext |
The ext to use for this URL.
Supports Will be ignored for default avatars which can only be If |
size |
The size to set for the URL.
Can be any power of two between
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Optional[URL]
|
The URL to the avatar, or |
RAISES | DESCRIPTION |
---|---|
ValueError
|
If |
remove_role
async
#
remove_role(
role: SnowflakeishOr[PartialRole],
*,
reason: UndefinedOr[str] = undefined.UNDEFINED
) -> None
Remove a role from the member.
PARAMETER | DESCRIPTION |
---|---|
role |
The role to remove. This may be the object or the ID of an existing role.
TYPE:
|
PARAMETER | DESCRIPTION |
---|---|
reason |
If provided, the reason that will be recorded in the audit logs. Maximum of 512 characters.
TYPE:
|
RAISES | DESCRIPTION |
---|---|
ForbiddenError
|
If you are missing the |
UnauthorizedError
|
If you are unauthorized to make the request (invalid/missing token). |
NotFoundError
|
If the guild, user or role are not found. |
RateLimitTooLongError
|
Raised in the event that a rate limit occurs that is
longer than |
InternalServerError
|
If an internal error occurs on Discord while handling the request. |
send
async
#
send(
content: UndefinedOr[Any] = undefined.UNDEFINED,
*,
attachment: UndefinedOr[Resourceish] = undefined.UNDEFINED,
attachments: UndefinedOr[Sequence[Resourceish]] = undefined.UNDEFINED,
component: UndefinedOr[ComponentBuilder] = undefined.UNDEFINED,
components: UndefinedOr[Sequence[ComponentBuilder]] = undefined.UNDEFINED,
embed: UndefinedOr[Embed] = undefined.UNDEFINED,
embeds: UndefinedOr[Sequence[Embed]] = undefined.UNDEFINED,
tts: UndefinedOr[bool] = undefined.UNDEFINED,
reply: UndefinedOr[SnowflakeishOr[PartialMessage]] = undefined.UNDEFINED,
reply_must_exist: UndefinedOr[bool] = undefined.UNDEFINED,
mentions_everyone: UndefinedOr[bool] = undefined.UNDEFINED,
mentions_reply: UndefinedOr[bool] = undefined.UNDEFINED,
user_mentions: UndefinedOr[
Union[SnowflakeishSequence[PartialUser], bool]
] = undefined.UNDEFINED,
role_mentions: UndefinedOr[
Union[SnowflakeishSequence[PartialRole], bool]
] = undefined.UNDEFINED,
flags: Union[UndefinedType, int, MessageFlag] = undefined.UNDEFINED
) -> Message
Send a message to this user in DM's.
PARAMETER | DESCRIPTION |
---|---|
content |
If provided, the message contents. If
If this is a Likewise, if this is a
TYPE:
|
PARAMETER | DESCRIPTION |
---|---|
attachment |
If provided, the message attachment. This can be a resource, or string of a path on your computer or a URL. Attachments can be passed as many different things, to aid in convenience.
TYPE:
|
attachments |
If provided, the message attachments. These can be resources, or strings consisting of paths on your computer or URLs.
TYPE:
|
component |
If provided, builder object of the component to include in this message.
TYPE:
|
components |
If provided, a sequence of the component builder objects to include in this message.
TYPE:
|
embed |
If provided, the message embed.
TYPE:
|
embeds |
If provided, the message embeds.
TYPE:
|
tts |
If provided, whether the message will be read out by a screen reader using Discord's TTS (text-to-speech) system.
TYPE:
|
reply |
If provided, the message to reply to.
TYPE:
|
reply_must_exist |
If provided, whether to error if the message being replied to does not exist instead of sending as a normal (non-reply) message. This will not do anything if not being used with
TYPE:
|
mentions_everyone |
If provided, whether the message should parse @everyone/@here mentions.
TYPE:
|
mentions_reply |
If provided, whether to mention the author of the message that is being replied to. This will not do anything if not being used with
TYPE:
|
user_mentions |
If provided, and
TYPE:
|
role_mentions |
If provided, and
TYPE:
|
flags |
If provided, optional flags to set on the message. If
Note that some flags may not be able to be set. Currently the only
flags that can be set are
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Message
|
The created message. |
RAISES | DESCRIPTION |
---|---|
ValueError
|
If more than 100 unique objects/entities are passed for
|
TypeError
|
If both |
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; |
UnauthorizedError
|
If you are unauthorized to make the request (invalid/missing token). |
ForbiddenError
|
If you are missing the |
NotFoundError
|
If the user is not found. |
RateLimitTooLongError
|
Raised in the event that a rate limit occurs that is
longer than |
InternalServerError
|
If an internal error occurs on Discord while handling the request. |
unban
async
#
unban(*, reason: UndefinedOr[str] = undefined.UNDEFINED) -> None
Unban this member from the guild.
PARAMETER | DESCRIPTION |
---|---|
reason |
If provided, the reason that will be recorded in the audit logs. Maximum of 512 characters.
TYPE:
|
RAISES | DESCRIPTION |
---|---|
BadRequestError
|
If any of the fields that are passed have an invalid value. |
ForbiddenError
|
If you are missing the |
UnauthorizedError
|
If you are unauthorized to make the request (invalid/missing token). |
NotFoundError
|
If the guild or user are not found. |
RateLimitTooLongError
|
Raised in the event that a rate limit occurs that is
longer than |
InternalServerError
|
If an internal error occurs on Discord while handling the request. |
InteractionType
#
Bases: int
, Enum
The type of an interaction.
APPLICATION_COMMAND
class-attribute
instance-attribute
#
An interaction triggered by a user calling an application command.
AUTOCOMPLETE
class-attribute
instance-attribute
#
An interaction triggered by a user typing in a slash command option.
MESSAGE_COMPONENT
class-attribute
instance-attribute
#
An interaction triggered by a user calling a message component.
MODAL_SUBMIT
class-attribute
instance-attribute
#
An interaction triggered by a user submitting a modal.
MessageResponseMixin
#
Bases: PartialInteraction
, Generic[_CommandResponseTypesT]
Mixin' class for all interaction types which can be responded to with a message.
app
class-attribute
instance-attribute
#
Client application that models may use for procedures.
application_id
class-attribute
instance-attribute
#
ID of the application this interaction belongs to.
id
class-attribute
instance-attribute
#
ID of this entity.
token
class-attribute
instance-attribute
#
The interaction's token.
type
class-attribute
instance-attribute
#
type: Union[InteractionType, int] = field(eq=False, repr=True)
The type of interaction this is.
version
class-attribute
instance-attribute
#
Version of the interaction system this interaction is under.
create_initial_response
async
#
create_initial_response(
response_type: _CommandResponseTypesT,
content: UndefinedOr[Any] = undefined.UNDEFINED,
*,
flags: Union[int, MessageFlag, UndefinedType] = undefined.UNDEFINED,
tts: UndefinedOr[bool] = undefined.UNDEFINED,
attachment: UndefinedNoneOr[Resourceish] = undefined.UNDEFINED,
attachments: UndefinedNoneOr[Sequence[Resourceish]] = undefined.UNDEFINED,
component: UndefinedNoneOr[ComponentBuilder] = undefined.UNDEFINED,
components: UndefinedNoneOr[
Sequence[ComponentBuilder]
] = undefined.UNDEFINED,
embed: UndefinedNoneOr[Embed] = undefined.UNDEFINED,
embeds: UndefinedNoneOr[Sequence[Embed]] = undefined.UNDEFINED,
mentions_everyone: UndefinedOr[bool] = undefined.UNDEFINED,
user_mentions: UndefinedOr[
Union[SnowflakeishSequence[PartialUser], bool]
] = undefined.UNDEFINED,
role_mentions: UndefinedOr[
Union[SnowflakeishSequence[PartialRole], bool]
] = undefined.UNDEFINED
) -> None
Create the initial response for this interaction.
Warning
Calling this on an interaction which already has an initial
response will result in this raising a hikari.errors.NotFoundError
.
This includes if the REST interaction server has already responded
to the request.
PARAMETER | DESCRIPTION |
---|---|
response_type |
The type of interaction response this is.
TYPE:
|
PARAMETER | DESCRIPTION |
---|---|
content |
If provided, the message contents. If
If this is a
TYPE:
|
attachment |
If provided, the message attachment. This can be a resource, or string of a path on your computer or a URL.
TYPE:
|
attachments |
If provided, the message attachments. These can be resources, or strings consisting of paths on your computer or URLs.
TYPE:
|
component |
If provided, builder object of the component to include in this message.
TYPE:
|
components |
If provided, a sequence of the component builder objects to include in this message.
TYPE:
|
embed |
If provided, the message embed.
TYPE:
|
embeds |
If provided, the message embeds.
TYPE:
|
flags |
If provided, the message flags this response should have. As of writing the only message flags which can be set here are
TYPE:
|
tts |
If provided, whether the message will be read out by a screen reader using Discord's TTS (text-to-speech) system.
TYPE:
|
mentions_everyone |
If provided, whether the message should parse @everyone/@here mentions.
TYPE:
|
user_mentions |
If provided, and
TYPE:
|
role_mentions |
If provided, and
TYPE:
|
RAISES | DESCRIPTION |
---|---|
ValueError
|
If more than 100 unique objects/entities are passed for
|
TypeError
|
If both |
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 |
InternalServerError
|
If an internal error occurs on Discord while handling the request. |
delete_initial_response
async
#
Delete the initial response of this interaction.
RAISES | DESCRIPTION |
---|---|
UnauthorizedError
|
If you are unauthorized to make the request (invalid/missing token). |
NotFoundError
|
If the interaction or response is not found. |
RateLimitTooLongError
|
Raised in the event that a rate limit occurs that is
longer than |
InternalServerError
|
If an internal error occurs on Discord while handling the request. |
delete_message
async
#
delete_message(message: SnowflakeishOr[Message]) -> None
Delete a given message in a given channel.
PARAMETER | DESCRIPTION |
---|---|
message |
The message to delete. This may be the object or the ID of an existing message.
TYPE:
|
RAISES | DESCRIPTION |
---|---|
ValueError
|
If |
UnauthorizedError
|
If you are unauthorized to make the request (invalid/missing token). |
NotFoundError
|
If the webhook or the message are not found. |
RateLimitTooLongError
|
Raised in the event that a rate limit occurs that is
longer than |
InternalServerError
|
If an internal error occurs on Discord while handling the request. |
edit_initial_response
async
#
edit_initial_response(
content: UndefinedNoneOr[Any] = undefined.UNDEFINED,
*,
attachment: UndefinedNoneOr[
Union[Resourceish, Attachment]
] = undefined.UNDEFINED,
attachments: UndefinedNoneOr[
Sequence[Union[Resourceish, Attachment]]
] = undefined.UNDEFINED,
component: UndefinedNoneOr[ComponentBuilder] = undefined.UNDEFINED,
components: UndefinedNoneOr[
Sequence[ComponentBuilder]
] = undefined.UNDEFINED,
embed: UndefinedNoneOr[Embed] = undefined.UNDEFINED,
embeds: UndefinedNoneOr[Sequence[Embed]] = undefined.UNDEFINED,
mentions_everyone: UndefinedOr[bool] = undefined.UNDEFINED,
user_mentions: UndefinedOr[
Union[SnowflakeishSequence[PartialUser], bool]
] = undefined.UNDEFINED,
role_mentions: UndefinedOr[
Union[SnowflakeishSequence[PartialRole], bool]
] = undefined.UNDEFINED
) -> Message
Edit the initial response of this command interaction.
Note
Mentioning everyone, roles, or users in message edits currently will not send a push notification showing a new mention to people on Discord. It will still highlight in their chat as if they were mentioned, however.
Warning
If you specify a text content
, mentions_everyone
,
mentions_reply
, user_mentions
, and role_mentions
will default
to False
as the message will be re-parsed for mentions. This will
also occur if only one of the four are specified
This is a limitation of Discord's design. If in doubt, specify all four of them each time.
PARAMETER | DESCRIPTION |
---|---|
content |
If provided, the message contents. If
If this is a Likewise, if this is a
TYPE:
|
attachment |
If provided, the attachment to set on the message. If
TYPE:
|
attachments |
If provided, the attachments to set on the message. If
TYPE:
|
component |
If provided, builder object of the component to set for this message.
This component will replace any previously set components and passing
TYPE:
|
components |
If provided, a sequence of the component builder objects set for
this message. These components will replace any previously set
components and passing
TYPE:
|
embed |
If provided, the embed to set on the message. If
TYPE:
|
embeds |
If provided, the embeds to set on the message. If
TYPE:
|
mentions_everyone |
If provided, whether the message should parse @everyone/@here mentions.
TYPE:
|
user_mentions |
If provided, and
TYPE:
|
role_mentions |
If provided, and
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Message
|
The edited message. |
RAISES | DESCRIPTION |
---|---|
ValueError
|
If more than 100 unique objects/entities are passed for
|
TypeError
|
If both |
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). |
NotFoundError
|
If the interaction or the message are not found. |
RateLimitTooLongError
|
Raised in the event that a rate limit occurs that is
longer than |
InternalServerError
|
If an internal error occurs on Discord while handling the request. |
edit_message
async
#
edit_message(
message: SnowflakeishOr[Message],
content: UndefinedNoneOr[Any] = undefined.UNDEFINED,
*,
attachment: UndefinedNoneOr[
Union[Resourceish, Attachment]
] = undefined.UNDEFINED,
attachments: UndefinedNoneOr[
Sequence[Union[Resourceish, Attachment]]
] = undefined.UNDEFINED,
component: UndefinedNoneOr[ComponentBuilder] = undefined.UNDEFINED,
components: UndefinedNoneOr[
Sequence[ComponentBuilder]
] = undefined.UNDEFINED,
embed: UndefinedNoneOr[Embed] = undefined.UNDEFINED,
embeds: UndefinedNoneOr[Sequence[Embed]] = undefined.UNDEFINED,
mentions_everyone: UndefinedOr[bool] = undefined.UNDEFINED,
user_mentions: UndefinedOr[
Union[SnowflakeishSequence[PartialUser], bool]
] = undefined.UNDEFINED,
role_mentions: UndefinedOr[
Union[SnowflakeishSequence[PartialRole], bool]
] = undefined.UNDEFINED
) -> Message
Edit a message sent by a webhook.
Note
Mentioning everyone, roles, or users in message edits currently will not send a push notification showing a new mention to people on Discord. It will still highlight in their chat as if they were mentioned, however.
Warning
If you specify a text content
, mentions_everyone
,
mentions_reply
, user_mentions
, and role_mentions
will default
to False
as the message will be re-parsed for mentions. This will
also occur if only one of the four are specified
This is a limitation of Discord's design. If in doubt, specify all four of them each time.
PARAMETER | DESCRIPTION |
---|---|
message |
The message to delete. This may be the object or the ID of an existing message.
TYPE:
|
content |
If provided, the message contents. If
If this is a Likewise, if this is a
TYPE:
|
PARAMETER | DESCRIPTION |
---|---|
attachment |
If provided, the attachment to set on the message. If
TYPE:
|
attachments |
If provided, the attachments to set on the message. If
TYPE:
|
component |
If provided, builder object of the component to set for this message.
This component will replace any previously set components and passing
TYPE:
|
components |
If provided, a sequence of the component builder objects set for
this message. These components will replace any previously set
components and passing
TYPE:
|
embed |
If provided, the embed to set on the message. If
TYPE:
|
embeds |
If provided, the embeds to set on the message. If
TYPE:
|
mentions_everyone |
If provided, sanitation for
TYPE:
|
user_mentions |
If provided, and
TYPE:
|
role_mentions |
If provided, and
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Message
|
The edited message. |
RAISES | DESCRIPTION |
---|---|
ValueError
|
If more than 100 unique objects/entities are passed for
|
TypeError
|
If both |
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; too many components. |
UnauthorizedError
|
If you are unauthorized to make the request (invalid/missing token). |
NotFoundError
|
If the webhook or the message are not found. |
RateLimitTooLongError
|
Raised in the event that a rate limit occurs that is
longer than |
InternalServerError
|
If an internal error occurs on Discord while handling the request. |
execute
async
#
execute(
content: UndefinedOr[Any] = undefined.UNDEFINED,
*,
username: UndefinedOr[str] = undefined.UNDEFINED,
avatar_url: Union[UndefinedType, str, URL] = undefined.UNDEFINED,
tts: UndefinedOr[bool] = undefined.UNDEFINED,
attachment: UndefinedOr[Resourceish] = undefined.UNDEFINED,
attachments: UndefinedOr[Sequence[Resourceish]] = undefined.UNDEFINED,
component: UndefinedOr[ComponentBuilder] = undefined.UNDEFINED,
components: UndefinedOr[Sequence[ComponentBuilder]] = undefined.UNDEFINED,
embed: UndefinedOr[Embed] = undefined.UNDEFINED,
embeds: UndefinedOr[Sequence[Embed]] = undefined.UNDEFINED,
mentions_everyone: UndefinedOr[bool] = undefined.UNDEFINED,
user_mentions: UndefinedOr[
Union[SnowflakeishSequence[PartialUser], bool]
] = undefined.UNDEFINED,
role_mentions: UndefinedOr[
Union[SnowflakeishSequence[PartialRole], bool]
] = undefined.UNDEFINED,
flags: Union[UndefinedType, int, MessageFlag] = undefined.UNDEFINED
) -> Message
Execute the webhook to create a message.
Warning
At the time of writing, username
and avatar_url
are ignored for
interaction webhooks.
Additionally, hikari.messages.MessageFlag.SUPPRESS_EMBEDS
, hikari.messages.MessageFlag.SUPPRESS_NOTIFICATIONS
and hikari.messages.MessageFlag.EPHEMERAL
are the only flags that can be set, with hikari.messages.MessageFlag.EPHEMERAL
being limited to
interaction webhooks.
PARAMETER | DESCRIPTION |
---|---|
content |
If provided, the message contents. If
If this is a Likewise, if this is a
TYPE:
|
PARAMETER | DESCRIPTION |
---|---|
username |
If provided, the username to override the webhook's username for this request.
TYPE:
|
avatar_url |
If provided, the url of an image to override the webhook's avatar with for this request.
TYPE:
|
tts |
If provided, whether the message will be sent as a TTS message.
TYPE:
|
attachment |
If provided, the message attachment. This can be a resource, or string of a path on your computer or a URL.
TYPE:
|
attachments |
If provided, the message attachments. These can be resources, or strings consisting of paths on your computer or URLs.
TYPE:
|
component |
If provided, builder object of the component to include in this message.
TYPE:
|
components |
If provided, a sequence of the component builder objects to include in this message.
TYPE:
|
embed |
If provided, the message embed.
TYPE:
|
embeds |
If provided, the message embeds.
TYPE:
|
mentions_everyone |
If provided, whether the message should parse @everyone/@here mentions.
TYPE:
|
user_mentions |
If provided, and
TYPE:
|
role_mentions |
If provided, and
TYPE:
|
flags |
The flags to set for this webhook message.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Message
|
The created message object. |
RAISES | DESCRIPTION |
---|---|
NotFoundError
|
If the current webhook is not found. |
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 |
UnauthorizedError
|
If you pass a token that's invalid for the target webhook. |
ValueError
|
If |
TypeError
|
If both |
fetch_initial_response
async
#
fetch_initial_response() -> Message
Fetch the initial response of this interaction.
RETURNS | DESCRIPTION |
---|---|
Message
|
Message object of the initial response. |
RAISES | DESCRIPTION |
---|---|
ForbiddenError
|
If you cannot access the target interaction. |
NotFoundError
|
If the initial response isn't found. |
UnauthorizedError
|
If you are unauthorized to make the request (invalid/missing token). |
RateLimitTooLongError
|
Raised in the event that a rate limit occurs that is
longer than |
InternalServerError
|
If an internal error occurs on Discord while handling the request. |
fetch_message
async
#
fetch_message(message: SnowflakeishOr[Message]) -> Message
Fetch an old message sent by the webhook.
PARAMETER | DESCRIPTION |
---|---|
message |
The message to fetch. This may be the object or the ID of an existing channel.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Message
|
The requested message. |
RAISES | DESCRIPTION |
---|---|
ValueError
|
If |
UnauthorizedError
|
If you are unauthorized to make the request (invalid/missing token). |
NotFoundError
|
If the webhook is not found or the webhook's message wasn't found. |
RateLimitTooLongError
|
Raised in the event that a rate limit occurs that is
longer than |
InternalServerError
|
If an internal error occurs on Discord while handling the request. |
ModalResponseMixin
#
Bases: PartialInteraction
Mixin' class for all interaction types which can be responded to with a modal.
app
class-attribute
instance-attribute
#
Client application that models may use for procedures.
application_id
class-attribute
instance-attribute
#
ID of the application this interaction belongs to.
id
class-attribute
instance-attribute
#
ID of this entity.
token
class-attribute
instance-attribute
#
The interaction's token.
type
class-attribute
instance-attribute
#
type: Union[InteractionType, int] = field(eq=False, repr=True)
The type of interaction this is.
version
class-attribute
instance-attribute
#
Version of the interaction system this interaction is under.
build_modal_response
#
build_modal_response(title: str, custom_id: str) -> InteractionModalBuilder
Create a builder for a modal interaction response.
PARAMETER | DESCRIPTION |
---|---|
title |
The title that will show up in the modal.
TYPE:
|
custom_id |
Developer set custom ID used for identifying interactions with this modal.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
InteractionModalBuilder
|
The interaction modal response builder object. |
create_modal_response
async
#
create_modal_response(
title: str,
custom_id: str,
component: UndefinedOr[ComponentBuilder] = undefined.UNDEFINED,
components: UndefinedOr[Sequence[ComponentBuilder]] = undefined.UNDEFINED,
) -> None
Create a response by sending a modal.
PARAMETER | DESCRIPTION |
---|---|
title |
The title that will show up in the modal.
TYPE:
|
custom_id |
Developer set custom ID used for identifying interactions with this modal.
TYPE:
|
PARAMETER | DESCRIPTION |
---|---|
component |
A component builder to send in this modal.
TYPE:
|
components |
A sequence of component builders to send in this modal.
TYPE:
|
RAISES | DESCRIPTION |
---|---|
ValueError
|
If both |
delete_message
async
#
delete_message(message: SnowflakeishOr[Message]) -> None
Delete a given message in a given channel.
PARAMETER | DESCRIPTION |
---|---|
message |
The message to delete. This may be the object or the ID of an existing message.
TYPE:
|
RAISES | DESCRIPTION |
---|---|
ValueError
|
If |
UnauthorizedError
|
If you are unauthorized to make the request (invalid/missing token). |
NotFoundError
|
If the webhook or the message are not found. |
RateLimitTooLongError
|
Raised in the event that a rate limit occurs that is
longer than |
InternalServerError
|
If an internal error occurs on Discord while handling the request. |
edit_message
async
#
edit_message(
message: SnowflakeishOr[Message],
content: UndefinedNoneOr[Any] = undefined.UNDEFINED,
*,
attachment: UndefinedNoneOr[
Union[Resourceish, Attachment]
] = undefined.UNDEFINED,
attachments: UndefinedNoneOr[
Sequence[Union[Resourceish, Attachment]]
] = undefined.UNDEFINED,
component: UndefinedNoneOr[ComponentBuilder] = undefined.UNDEFINED,
components: UndefinedNoneOr[
Sequence[ComponentBuilder]
] = undefined.UNDEFINED,
embed: UndefinedNoneOr[Embed] = undefined.UNDEFINED,
embeds: UndefinedNoneOr[Sequence[Embed]] = undefined.UNDEFINED,
mentions_everyone: UndefinedOr[bool] = undefined.UNDEFINED,
user_mentions: UndefinedOr[
Union[SnowflakeishSequence[PartialUser], bool]
] = undefined.UNDEFINED,
role_mentions: UndefinedOr[
Union[SnowflakeishSequence[PartialRole], bool]
] = undefined.UNDEFINED
) -> Message
Edit a message sent by a webhook.
Note
Mentioning everyone, roles, or users in message edits currently will not send a push notification showing a new mention to people on Discord. It will still highlight in their chat as if they were mentioned, however.
Warning
If you specify a text content
, mentions_everyone
,
mentions_reply
, user_mentions
, and role_mentions
will default
to False
as the message will be re-parsed for mentions. This will
also occur if only one of the four are specified
This is a limitation of Discord's design. If in doubt, specify all four of them each time.
PARAMETER | DESCRIPTION |
---|---|
message |
The message to delete. This may be the object or the ID of an existing message.
TYPE:
|
content |
If provided, the message contents. If
If this is a Likewise, if this is a
TYPE:
|
PARAMETER | DESCRIPTION |
---|---|
attachment |
If provided, the attachment to set on the message. If
TYPE:
|
attachments |
If provided, the attachments to set on the message. If
TYPE:
|
component |
If provided, builder object of the component to set for this message.
This component will replace any previously set components and passing
TYPE:
|
components |
If provided, a sequence of the component builder objects set for
this message. These components will replace any previously set
components and passing
TYPE:
|
embed |
If provided, the embed to set on the message. If
TYPE:
|
embeds |
If provided, the embeds to set on the message. If
TYPE:
|
mentions_everyone |
If provided, sanitation for
TYPE:
|
user_mentions |
If provided, and
TYPE:
|
role_mentions |
If provided, and
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Message
|
The edited message. |
RAISES | DESCRIPTION |
---|---|
ValueError
|
If more than 100 unique objects/entities are passed for
|
TypeError
|
If both |
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; too many components. |
UnauthorizedError
|
If you are unauthorized to make the request (invalid/missing token). |
NotFoundError
|
If the webhook or the message are not found. |
RateLimitTooLongError
|
Raised in the event that a rate limit occurs that is
longer than |
InternalServerError
|
If an internal error occurs on Discord while handling the request. |
execute
async
#
execute(
content: UndefinedOr[Any] = undefined.UNDEFINED,
*,
username: UndefinedOr[str] = undefined.UNDEFINED,
avatar_url: Union[UndefinedType, str, URL] = undefined.UNDEFINED,
tts: UndefinedOr[bool] = undefined.UNDEFINED,
attachment: UndefinedOr[Resourceish] = undefined.UNDEFINED,
attachments: UndefinedOr[Sequence[Resourceish]] = undefined.UNDEFINED,
component: UndefinedOr[ComponentBuilder] = undefined.UNDEFINED,
components: UndefinedOr[Sequence[ComponentBuilder]] = undefined.UNDEFINED,
embed: UndefinedOr[Embed] = undefined.UNDEFINED,
embeds: UndefinedOr[Sequence[Embed]] = undefined.UNDEFINED,
mentions_everyone: UndefinedOr[bool] = undefined.UNDEFINED,
user_mentions: UndefinedOr[
Union[SnowflakeishSequence[PartialUser], bool]
] = undefined.UNDEFINED,
role_mentions: UndefinedOr[
Union[SnowflakeishSequence[PartialRole], bool]
] = undefined.UNDEFINED,
flags: Union[UndefinedType, int, MessageFlag] = undefined.UNDEFINED
) -> Message
Execute the webhook to create a message.
Warning
At the time of writing, username
and avatar_url
are ignored for
interaction webhooks.
Additionally, hikari.messages.MessageFlag.SUPPRESS_EMBEDS
, hikari.messages.MessageFlag.SUPPRESS_NOTIFICATIONS
and hikari.messages.MessageFlag.EPHEMERAL
are the only flags that can be set, with hikari.messages.MessageFlag.EPHEMERAL
being limited to
interaction webhooks.
PARAMETER | DESCRIPTION |
---|---|
content |
If provided, the message contents. If
If this is a Likewise, if this is a
TYPE:
|
PARAMETER | DESCRIPTION |
---|---|
username |
If provided, the username to override the webhook's username for this request.
TYPE:
|
avatar_url |
If provided, the url of an image to override the webhook's avatar with for this request.
TYPE:
|
tts |
If provided, whether the message will be sent as a TTS message.
TYPE:
|
attachment |
If provided, the message attachment. This can be a resource, or string of a path on your computer or a URL.
TYPE:
|
attachments |
If provided, the message attachments. These can be resources, or strings consisting of paths on your computer or URLs.
TYPE:
|
component |
If provided, builder object of the component to include in this message.
TYPE:
|
components |
If provided, a sequence of the component builder objects to include in this message.
TYPE:
|
embed |
If provided, the message embed.
TYPE:
|
embeds |
If provided, the message embeds.
TYPE:
|
mentions_everyone |
If provided, whether the message should parse @everyone/@here mentions.
TYPE:
|
user_mentions |
If provided, and
TYPE:
|
role_mentions |
If provided, and
TYPE:
|
flags |
The flags to set for this webhook message.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Message
|
The created message object. |
RAISES | DESCRIPTION |
---|---|
NotFoundError
|
If the current webhook is not found. |
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 |
UnauthorizedError
|
If you pass a token that's invalid for the target webhook. |
ValueError
|
If |
TypeError
|
If both |
fetch_message
async
#
fetch_message(message: SnowflakeishOr[Message]) -> Message
Fetch an old message sent by the webhook.
PARAMETER | DESCRIPTION |
---|---|
message |
The message to fetch. This may be the object or the ID of an existing channel.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Message
|
The requested message. |
RAISES | DESCRIPTION |
---|---|
ValueError
|
If |
UnauthorizedError
|
If you are unauthorized to make the request (invalid/missing token). |
NotFoundError
|
If the webhook is not found or the webhook's message wasn't found. |
RateLimitTooLongError
|
Raised in the event that a rate limit occurs that is
longer than |
InternalServerError
|
If an internal error occurs on Discord while handling the request. |
PartialInteraction
#
Bases: Unique
, ExecutableWebhook
The base model for all interaction models.
app
class-attribute
instance-attribute
#
Client application that models may use for procedures.
application_id
class-attribute
instance-attribute
#
ID of the application this interaction belongs to.
id
class-attribute
instance-attribute
#
ID of this entity.
token
class-attribute
instance-attribute
#
The interaction's token.
type
class-attribute
instance-attribute
#
type: Union[InteractionType, int] = field(eq=False, repr=True)
The type of interaction this is.
version
class-attribute
instance-attribute
#
Version of the interaction system this interaction is under.
delete_message
async
#
delete_message(message: SnowflakeishOr[Message]) -> None
Delete a given message in a given channel.
PARAMETER | DESCRIPTION |
---|---|
message |
The message to delete. This may be the object or the ID of an existing message.
TYPE:
|
RAISES | DESCRIPTION |
---|---|
ValueError
|
If |
UnauthorizedError
|
If you are unauthorized to make the request (invalid/missing token). |
NotFoundError
|
If the webhook or the message are not found. |
RateLimitTooLongError
|
Raised in the event that a rate limit occurs that is
longer than |
InternalServerError
|
If an internal error occurs on Discord while handling the request. |
edit_message
async
#
edit_message(
message: SnowflakeishOr[Message],
content: UndefinedNoneOr[Any] = undefined.UNDEFINED,
*,
attachment: UndefinedNoneOr[
Union[Resourceish, Attachment]
] = undefined.UNDEFINED,
attachments: UndefinedNoneOr[
Sequence[Union[Resourceish, Attachment]]
] = undefined.UNDEFINED,
component: UndefinedNoneOr[ComponentBuilder] = undefined.UNDEFINED,
components: UndefinedNoneOr[
Sequence[ComponentBuilder]
] = undefined.UNDEFINED,
embed: UndefinedNoneOr[Embed] = undefined.UNDEFINED,
embeds: UndefinedNoneOr[Sequence[Embed]] = undefined.UNDEFINED,
mentions_everyone: UndefinedOr[bool] = undefined.UNDEFINED,
user_mentions: UndefinedOr[
Union[SnowflakeishSequence[PartialUser], bool]
] = undefined.UNDEFINED,
role_mentions: UndefinedOr[
Union[SnowflakeishSequence[PartialRole], bool]
] = undefined.UNDEFINED
) -> Message
Edit a message sent by a webhook.
Note
Mentioning everyone, roles, or users in message edits currently will not send a push notification showing a new mention to people on Discord. It will still highlight in their chat as if they were mentioned, however.
Warning
If you specify a text content
, mentions_everyone
,
mentions_reply
, user_mentions
, and role_mentions
will default
to False
as the message will be re-parsed for mentions. This will
also occur if only one of the four are specified
This is a limitation of Discord's design. If in doubt, specify all four of them each time.
PARAMETER | DESCRIPTION |
---|---|
message |
The message to delete. This may be the object or the ID of an existing message.
TYPE:
|
content |
If provided, the message contents. If
If this is a Likewise, if this is a
TYPE:
|
PARAMETER | DESCRIPTION |
---|---|
attachment |
If provided, the attachment to set on the message. If
TYPE:
|
attachments |
If provided, the attachments to set on the message. If
TYPE:
|
component |
If provided, builder object of the component to set for this message.
This component will replace any previously set components and passing
TYPE:
|
components |
If provided, a sequence of the component builder objects set for
this message. These components will replace any previously set
components and passing
TYPE:
|
embed |
If provided, the embed to set on the message. If
TYPE:
|
embeds |
If provided, the embeds to set on the message. If
TYPE:
|
mentions_everyone |
If provided, sanitation for
TYPE:
|
user_mentions |
If provided, and
TYPE:
|
role_mentions |
If provided, and
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Message
|
The edited message. |
RAISES | DESCRIPTION |
---|---|
ValueError
|
If more than 100 unique objects/entities are passed for
|
TypeError
|
If both |
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; too many components. |
UnauthorizedError
|
If you are unauthorized to make the request (invalid/missing token). |
NotFoundError
|
If the webhook or the message are not found. |
RateLimitTooLongError
|
Raised in the event that a rate limit occurs that is
longer than |
InternalServerError
|
If an internal error occurs on Discord while handling the request. |
execute
async
#
execute(
content: UndefinedOr[Any] = undefined.UNDEFINED,
*,
username: UndefinedOr[str] = undefined.UNDEFINED,
avatar_url: Union[UndefinedType, str, URL] = undefined.UNDEFINED,
tts: UndefinedOr[bool] = undefined.UNDEFINED,
attachment: UndefinedOr[Resourceish] = undefined.UNDEFINED,
attachments: UndefinedOr[Sequence[Resourceish]] = undefined.UNDEFINED,
component: UndefinedOr[ComponentBuilder] = undefined.UNDEFINED,
components: UndefinedOr[Sequence[ComponentBuilder]] = undefined.UNDEFINED,
embed: UndefinedOr[Embed] = undefined.UNDEFINED,
embeds: UndefinedOr[Sequence[Embed]] = undefined.UNDEFINED,
mentions_everyone: UndefinedOr[bool] = undefined.UNDEFINED,
user_mentions: UndefinedOr[
Union[SnowflakeishSequence[PartialUser], bool]
] = undefined.UNDEFINED,
role_mentions: UndefinedOr[
Union[SnowflakeishSequence[PartialRole], bool]
] = undefined.UNDEFINED,
flags: Union[UndefinedType, int, MessageFlag] = undefined.UNDEFINED
) -> Message
Execute the webhook to create a message.
Warning
At the time of writing, username
and avatar_url
are ignored for
interaction webhooks.
Additionally, hikari.messages.MessageFlag.SUPPRESS_EMBEDS
, hikari.messages.MessageFlag.SUPPRESS_NOTIFICATIONS
and hikari.messages.MessageFlag.EPHEMERAL
are the only flags that can be set, with hikari.messages.MessageFlag.EPHEMERAL
being limited to
interaction webhooks.
PARAMETER | DESCRIPTION |
---|---|
content |
If provided, the message contents. If
If this is a Likewise, if this is a
TYPE:
|
PARAMETER | DESCRIPTION |
---|---|
username |
If provided, the username to override the webhook's username for this request.
TYPE:
|
avatar_url |
If provided, the url of an image to override the webhook's avatar with for this request.
TYPE:
|
tts |
If provided, whether the message will be sent as a TTS message.
TYPE:
|
attachment |
If provided, the message attachment. This can be a resource, or string of a path on your computer or a URL.
TYPE:
|
attachments |
If provided, the message attachments. These can be resources, or strings consisting of paths on your computer or URLs.
TYPE:
|
component |
If provided, builder object of the component to include in this message.
TYPE:
|
components |
If provided, a sequence of the component builder objects to include in this message.
TYPE:
|
embed |
If provided, the message embed.
TYPE:
|
embeds |
If provided, the message embeds.
TYPE:
|
mentions_everyone |
If provided, whether the message should parse @everyone/@here mentions.
TYPE:
|
user_mentions |
If provided, and
TYPE:
|
role_mentions |
If provided, and
TYPE:
|
flags |
The flags to set for this webhook message.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Message
|
The created message object. |
RAISES | DESCRIPTION |
---|---|
NotFoundError
|
If the current webhook is not found. |
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 |
UnauthorizedError
|
If you pass a token that's invalid for the target webhook. |
ValueError
|
If |
TypeError
|
If both |
fetch_message
async
#
fetch_message(message: SnowflakeishOr[Message]) -> Message
Fetch an old message sent by the webhook.
PARAMETER | DESCRIPTION |
---|---|
message |
The message to fetch. This may be the object or the ID of an existing channel.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Message
|
The requested message. |
RAISES | DESCRIPTION |
---|---|
ValueError
|
If |
UnauthorizedError
|
If you are unauthorized to make the request (invalid/missing token). |
NotFoundError
|
If the webhook is not found or the webhook's message wasn't found. |
RateLimitTooLongError
|
Raised in the event that a rate limit occurs that is
longer than |
InternalServerError
|
If an internal error occurs on Discord while handling the request. |
PremiumResponseMixin
#
Bases: PartialInteraction
Mixin' class for all interaction types which can be responded to with a premium upsell.
app
class-attribute
instance-attribute
#
Client application that models may use for procedures.
application_id
class-attribute
instance-attribute
#
ID of the application this interaction belongs to.
id
class-attribute
instance-attribute
#
ID of this entity.
token
class-attribute
instance-attribute
#
The interaction's token.
type
class-attribute
instance-attribute
#
type: Union[InteractionType, int] = field(eq=False, repr=True)
The type of interaction this is.
version
class-attribute
instance-attribute
#
Version of the interaction system this interaction is under.
create_premium_required_response
async
#
Create a response by sending a premium upsell.
RAISES | DESCRIPTION |
---|---|
ForbiddenError
|
If you cannot access the target interaction. |
NotFoundError
|
If the initial response isn't found. |
UnauthorizedError
|
If you are unauthorized to make the request (invalid/missing token). |
RateLimitTooLongError
|
Raised in the event that a rate limit occurs that is
longer than |
InternalServerError
|
If an internal error occurs on Discord while handling the request. |
delete_message
async
#
delete_message(message: SnowflakeishOr[Message]) -> None
Delete a given message in a given channel.
PARAMETER | DESCRIPTION |
---|---|
message |
The message to delete. This may be the object or the ID of an existing message.
TYPE:
|
RAISES | DESCRIPTION |
---|---|
ValueError
|
If |
UnauthorizedError
|
If you are unauthorized to make the request (invalid/missing token). |
NotFoundError
|
If the webhook or the message are not found. |
RateLimitTooLongError
|
Raised in the event that a rate limit occurs that is
longer than |
InternalServerError
|
If an internal error occurs on Discord while handling the request. |
edit_message
async
#
edit_message(
message: SnowflakeishOr[Message],
content: UndefinedNoneOr[Any] = undefined.UNDEFINED,
*,
attachment: UndefinedNoneOr[
Union[Resourceish, Attachment]
] = undefined.UNDEFINED,
attachments: UndefinedNoneOr[
Sequence[Union[Resourceish, Attachment]]
] = undefined.UNDEFINED,
component: UndefinedNoneOr[ComponentBuilder] = undefined.UNDEFINED,
components: UndefinedNoneOr[
Sequence[ComponentBuilder]
] = undefined.UNDEFINED,
embed: UndefinedNoneOr[Embed] = undefined.UNDEFINED,
embeds: UndefinedNoneOr[Sequence[Embed]] = undefined.UNDEFINED,
mentions_everyone: UndefinedOr[bool] = undefined.UNDEFINED,
user_mentions: UndefinedOr[
Union[SnowflakeishSequence[PartialUser], bool]
] = undefined.UNDEFINED,
role_mentions: UndefinedOr[
Union[SnowflakeishSequence[PartialRole], bool]
] = undefined.UNDEFINED
) -> Message
Edit a message sent by a webhook.
Note
Mentioning everyone, roles, or users in message edits currently will not send a push notification showing a new mention to people on Discord. It will still highlight in their chat as if they were mentioned, however.
Warning
If you specify a text content
, mentions_everyone
,
mentions_reply
, user_mentions
, and role_mentions
will default
to False
as the message will be re-parsed for mentions. This will
also occur if only one of the four are specified
This is a limitation of Discord's design. If in doubt, specify all four of them each time.
PARAMETER | DESCRIPTION |
---|---|
message |
The message to delete. This may be the object or the ID of an existing message.
TYPE:
|
content |
If provided, the message contents. If
If this is a Likewise, if this is a
TYPE:
|
PARAMETER | DESCRIPTION |
---|---|
attachment |
If provided, the attachment to set on the message. If
TYPE:
|
attachments |
If provided, the attachments to set on the message. If
TYPE:
|
component |
If provided, builder object of the component to set for this message.
This component will replace any previously set components and passing
TYPE:
|
components |
If provided, a sequence of the component builder objects set for
this message. These components will replace any previously set
components and passing
TYPE:
|
embed |
If provided, the embed to set on the message. If
TYPE:
|
embeds |
If provided, the embeds to set on the message. If
TYPE:
|
mentions_everyone |
If provided, sanitation for
TYPE:
|
user_mentions |
If provided, and
TYPE:
|
role_mentions |
If provided, and
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Message
|
The edited message. |
RAISES | DESCRIPTION |
---|---|
ValueError
|
If more than 100 unique objects/entities are passed for
|
TypeError
|
If both |
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; too many components. |
UnauthorizedError
|
If you are unauthorized to make the request (invalid/missing token). |
NotFoundError
|
If the webhook or the message are not found. |
RateLimitTooLongError
|
Raised in the event that a rate limit occurs that is
longer than |
InternalServerError
|
If an internal error occurs on Discord while handling the request. |
execute
async
#
execute(
content: UndefinedOr[Any] = undefined.UNDEFINED,
*,
username: UndefinedOr[str] = undefined.UNDEFINED,
avatar_url: Union[UndefinedType, str, URL] = undefined.UNDEFINED,
tts: UndefinedOr[bool] = undefined.UNDEFINED,
attachment: UndefinedOr[Resourceish] = undefined.UNDEFINED,
attachments: UndefinedOr[Sequence[Resourceish]] = undefined.UNDEFINED,
component: UndefinedOr[ComponentBuilder] = undefined.UNDEFINED,
components: UndefinedOr[Sequence[ComponentBuilder]] = undefined.UNDEFINED,
embed: UndefinedOr[Embed] = undefined.UNDEFINED,
embeds: UndefinedOr[Sequence[Embed]] = undefined.UNDEFINED,
mentions_everyone: UndefinedOr[bool] = undefined.UNDEFINED,
user_mentions: UndefinedOr[
Union[SnowflakeishSequence[PartialUser], bool]
] = undefined.UNDEFINED,
role_mentions: UndefinedOr[
Union[SnowflakeishSequence[PartialRole], bool]
] = undefined.UNDEFINED,
flags: Union[UndefinedType, int, MessageFlag] = undefined.UNDEFINED
) -> Message
Execute the webhook to create a message.
Warning
At the time of writing, username
and avatar_url
are ignored for
interaction webhooks.
Additionally, hikari.messages.MessageFlag.SUPPRESS_EMBEDS
, hikari.messages.MessageFlag.SUPPRESS_NOTIFICATIONS
and hikari.messages.MessageFlag.EPHEMERAL
are the only flags that can be set, with hikari.messages.MessageFlag.EPHEMERAL
being limited to
interaction webhooks.
PARAMETER | DESCRIPTION |
---|---|
content |
If provided, the message contents. If
If this is a Likewise, if this is a
TYPE:
|
PARAMETER | DESCRIPTION |
---|---|
username |
If provided, the username to override the webhook's username for this request.
TYPE:
|
avatar_url |
If provided, the url of an image to override the webhook's avatar with for this request.
TYPE:
|
tts |
If provided, whether the message will be sent as a TTS message.
TYPE:
|
attachment |
If provided, the message attachment. This can be a resource, or string of a path on your computer or a URL.
TYPE:
|
attachments |
If provided, the message attachments. These can be resources, or strings consisting of paths on your computer or URLs.
TYPE:
|
component |
If provided, builder object of the component to include in this message.
TYPE:
|
components |
If provided, a sequence of the component builder objects to include in this message.
TYPE:
|
embed |
If provided, the message embed.
TYPE:
|
embeds |
If provided, the message embeds.
TYPE:
|
mentions_everyone |
If provided, whether the message should parse @everyone/@here mentions.
TYPE:
|
user_mentions |
If provided, and
TYPE:
|
role_mentions |
If provided, and
TYPE:
|
flags |
The flags to set for this webhook message.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Message
|
The created message object. |
RAISES | DESCRIPTION |
---|---|
NotFoundError
|
If the current webhook is not found. |
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 |
UnauthorizedError
|
If you pass a token that's invalid for the target webhook. |
ValueError
|
If |
TypeError
|
If both |
fetch_message
async
#
fetch_message(message: SnowflakeishOr[Message]) -> Message
Fetch an old message sent by the webhook.
PARAMETER | DESCRIPTION |
---|---|
message |
The message to fetch. This may be the object or the ID of an existing channel.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Message
|
The requested message. |
RAISES | DESCRIPTION |
---|---|
ValueError
|
If |
UnauthorizedError
|
If you are unauthorized to make the request (invalid/missing token). |
NotFoundError
|
If the webhook is not found or the webhook's message wasn't found. |
RateLimitTooLongError
|
Raised in the event that a rate limit occurs that is
longer than |
InternalServerError
|
If an internal error occurs on Discord while handling the request. |
ResolvedOptionData
#
Represents the resolved objects of entities referenced in a command's options.
attachments
class-attribute
instance-attribute
#
Mapping of snowflake IDs to the attachment objects.
channels
class-attribute
instance-attribute
#
channels: Mapping[Snowflake, InteractionChannel] = field(repr=False)
Mapping of snowflake IDs to the resolved option partial channel objects.
members
class-attribute
instance-attribute
#
members: Mapping[Snowflake, InteractionMember] = field(repr=False)
Mapping of snowflake IDs to the resolved option member objects.
messages
class-attribute
instance-attribute
#
Mapping of snowflake IDs to the resolved option partial message objects.
roles
class-attribute
instance-attribute
#
Mapping of snowflake IDs to the resolved option role objects.
ResponseType
#
Bases: int
, Enum
The type of an interaction response.
AUTOCOMPLETE
class-attribute
instance-attribute
#
Respond to an autocomplete interaction with suggested choices.
This is valid for the following interaction types:
DEFERRED_MESSAGE_CREATE
class-attribute
instance-attribute
#
Acknowledge an interaction with the intention to edit in a message response later.
The user will see a loading state when this type is used until this interaction expires or a message response is edited in over REST.
This is valid for the following interaction types:
DEFERRED_MESSAGE_UPDATE
class-attribute
instance-attribute
#
Acknowledge an interaction with the intention to edit its message later.
This is valid for the following interaction types:
MESSAGE_CREATE
class-attribute
instance-attribute
#
An immediate message response to an interaction.
MESSAGE_UPDATE
class-attribute
instance-attribute
#
An immediate interaction response with instructions on how to update its message.
This is valid for the following interaction types:
MODAL
class-attribute
instance-attribute
#
An immediate interaction response with instructions to display a modal.
This is valid for the following interaction types:
PREMIUM_REQUIRED
class-attribute
instance-attribute
#
An immediate interaction response with a premium upsell button Only available for apps with monetization enabled.
This is valid for the following interaction types:
InteractionType.APPLICATION_COMMAND
InteractionType.MESSAGE_COMPONENT
InteractionType.MODAL_SUBMIT