hikari.api.rest#
Provides an interface for REST API implementations to follow.
RESTClient #
Bases: NetworkSettingsAware, ABC
Interface for functionality that a REST API implementation provides.
entity_factory abstractmethod property #
entity_factory: EntityFactory
Entity factory used by this REST client.
token_type abstractmethod property #
Type of token this client is using for most requests.
If this is None then this client will likely only work for some endpoints such as public and webhook ones.
add_reaction abstractmethod async #
add_reaction(
channel: SnowflakeishOr[TextableChannel],
message: SnowflakeishOr[PartialMessage],
emoji: str | Emoji,
emoji_id: UndefinedOr[
SnowflakeishOr[CustomEmoji]
] = UNDEFINED,
) -> None
Add a reaction emoji to a message in a given channel.
| PARAMETER | DESCRIPTION |
|---|---|
channel | The channel where the message to add the reaction to is. This may be a TYPE: |
message | The message to add a reaction to. This may be the object or the ID of an existing message. TYPE: |
emoji | Object or name of the emoji to react with. |
emoji_id | ID of the custom emoji to react with. This should only be provided when a custom emoji's name is passed for TYPE: |
| RAISES | DESCRIPTION |
|---|---|
BadRequestError | If an invalid unicode emoji is given, or if the given custom emoji does not exist. |
UnauthorizedError | If you are unauthorized to make the request (invalid/missing token). |
ForbiddenError | If you are missing the |
NotFoundError | If the channel or message 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. |
add_role_to_member abstractmethod async #
add_role_to_member(
guild: SnowflakeishOr[PartialGuild],
user: SnowflakeishOr[PartialUser],
role: SnowflakeishOr[PartialRole],
*,
reason: UndefinedOr[str] = UNDEFINED,
) -> None
Add a role to a member.
| PARAMETER | DESCRIPTION |
|---|---|
guild | The guild where the member is in. This may be the object or the ID of an existing guild. TYPE: |
user | The user to add the role to. This may be the object or the ID of an existing user. TYPE: |
role | The role to add. This may be the object or the ID of an existing role. TYPE: |
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. |
add_thread_member abstractmethod async #
add_thread_member(
channel: SnowflakeishOr[GuildThreadChannel],
user: SnowflakeishOr[PartialUser],
) -> None
Add a user to a thread channel.
| PARAMETER | DESCRIPTION |
|---|---|
channel | Object or ID of the thread channel to add a member to. TYPE: |
user | Object or ID of the user to add to the thread. TYPE: |
| RAISES | DESCRIPTION |
|---|---|
BadRequestError | If any of the fields that are passed have an invalid value. |
ForbiddenError | If you cannot add a user to this thread. |
NotFoundError | If the thread channel doesn't exist. |
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. |
add_user_to_guild abstractmethod async #
add_user_to_guild(
access_token: str | PartialOAuth2Token,
guild: SnowflakeishOr[PartialGuild],
user: SnowflakeishOr[PartialUser],
*,
nickname: UndefinedOr[str] = UNDEFINED,
roles: UndefinedOr[
SnowflakeishSequence[PartialRole]
] = UNDEFINED,
mute: UndefinedOr[bool] = UNDEFINED,
deaf: UndefinedOr[bool] = UNDEFINED,
) -> Member | None
Add a user to a guild.
Note
This requires the access_token to have the hikari.applications.OAuth2Scope.GUILDS_JOIN scope enabled along with the authorization of a Bot which has hikari.permissions.Permissions.CREATE_INSTANT_INVITE permission within the target guild.
| PARAMETER | DESCRIPTION |
|---|---|
access_token | Object or string of the access token to use for this request. TYPE: |
guild | The guild to add the user to. This may be the object or the ID of an existing guild. TYPE: |
user | The user to add to the guild. This may be the object or the ID of an existing user. TYPE: |
nickname | If provided, the nick to add to the user when he joins the guild. Requires the TYPE: |
roles | If provided, the roles to add to the user when he joins the guild. This may be a collection objects or IDs of existing roles. Requires the TYPE: |
mute | If provided, the mute state to add the user when he joins the guild. Requires the TYPE: |
deaf | If provided, the deaf state to add the user when he joins the guild. Requires the TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
Optional[Member] |
|
| RAISES | DESCRIPTION |
|---|---|
BadRequestError | If any of the fields that are passed have an invalid value. |
ForbiddenError | If you are not part of the guild you want to add the user to, if you are missing permissions to do one of the things you specified, if you are using an access token for another user, if the token is bound to another bot or if the access token doesn't have the |
UnauthorizedError | If you are unauthorized to make the request (invalid/missing token). |
NotFoundError | If you own the guild or 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. |
authorize_access_token abstractmethod async #
authorize_access_token(
client: SnowflakeishOr[PartialApplication],
client_secret: str,
code: str,
redirect_uri: str,
*,
code_verifier: UndefinedOr[str] = UNDEFINED,
) -> OAuth2AuthorizationToken
Authorize an OAuth2 token using the authorize code grant type.
| PARAMETER | DESCRIPTION |
|---|---|
client | Object or ID of the application to authorize with. TYPE: |
client_secret | Secret of the application to authorize with. TYPE: |
code | The authorization code to exchange for an OAuth2 access token. TYPE: |
redirect_uri | The redirect uri that was included in the authorization request. TYPE: |
code_verifier | If provided, the random string generated for PKCE, required to securely validate the authorization code exchange. TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
OAuth2AuthorizationToken | Object of the authorized OAuth2 token. |
| RAISES | DESCRIPTION |
|---|---|
BadRequestError | If an invalid redirect uri or code is passed. |
UnauthorizedError | When an client or client secret is passed. |
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. |
authorize_client_credentials_token abstractmethod async #
authorize_client_credentials_token(
client: SnowflakeishOr[PartialApplication],
client_secret: str,
scopes: Sequence[OAuth2Scope | str],
) -> PartialOAuth2Token
Authorize a client credentials token for an application.
| PARAMETER | DESCRIPTION |
|---|---|
client | Object or ID of the application to authorize as. TYPE: |
client_secret | Secret of the application to authorize as. TYPE: |
scopes | The scopes to authorize for. TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
PartialOAuth2Token | Object of the authorized partial OAuth2 token. |
| RAISES | DESCRIPTION |
|---|---|
BadRequestError | If invalid any invalid or malformed scopes are passed. |
UnauthorizedError | When an client or client secret is passed. |
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_member abstractmethod async #
ban_member(
guild: SnowflakeishOr[PartialGuild],
user: SnowflakeishOr[PartialUser],
*,
delete_message_seconds: UndefinedOr[
Intervalish
] = UNDEFINED,
reason: UndefinedOr[str] = UNDEFINED,
) -> None
Alias of hikari.api.rest.RESTClient.ban_user.
ban_user abstractmethod async #
ban_user(
guild: SnowflakeishOr[PartialGuild],
user: SnowflakeishOr[PartialUser],
*,
delete_message_seconds: UndefinedOr[
Intervalish
] = UNDEFINED,
reason: UndefinedOr[str] = UNDEFINED,
) -> None
Ban the given user from this guild.
| PARAMETER | DESCRIPTION |
|---|---|
guild | The guild to ban the member from. This may be the object or the ID of an existing guild. TYPE: |
user | The user to kick. This may be the object or the ID of an existing user. TYPE: |
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. |
begin_guild_prune abstractmethod async #
begin_guild_prune(
guild: SnowflakeishOr[PartialGuild],
*,
days: UndefinedOr[int] = UNDEFINED,
compute_prune_count: UndefinedOr[bool] = UNDEFINED,
include_roles: UndefinedOr[
SnowflakeishSequence[PartialRole]
] = UNDEFINED,
reason: UndefinedOr[str] = UNDEFINED,
) -> int | None
Begin the guild prune.
| PARAMETER | DESCRIPTION |
|---|---|
guild | The guild to begin the guild prune in. This may be the object or the ID of an existing guild. TYPE: |
days | If provided, number of days to count prune for. TYPE: |
compute_prune_count | If provided, whether to return the prune count. This is discouraged for large guilds. TYPE: |
include_roles | If provided, the role(s) to include. By default, this endpoint will not count users with roles. Providing roles using this attribute will make members with the specified roles also get included into the count. TYPE: |
reason | If provided, the reason that will be recorded in the audit logs. Maximum of 512 characters. TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
Optional[int] |
| RAISES | DESCRIPTION |
|---|---|
BadRequestError | If any of the fields that are passed have an invalid value. |
UnauthorizedError | If you are unauthorized to make the request (invalid/missing token). |
ForbiddenError | If you are missing the |
NotFoundError | If the guild 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. |
build_message_action_row abstractmethod #
build_message_action_row() -> MessageActionRowBuilder
Build a message action row message component for use in message create and REST calls.
| RETURNS | DESCRIPTION |
|---|---|
MessageActionRowBuilder | The initialised action row builder. |
build_modal_action_row abstractmethod #
build_modal_action_row() -> ModalActionRowBuilder
Build an action row modal component for use in interactions and REST calls.
| RETURNS | DESCRIPTION |
|---|---|
ModalActionRowBuilder | The initialised action row builder. |
bulk_ban_users abstractmethod async #
bulk_ban_users(
guild: SnowflakeishOr[PartialGuild],
users: SnowflakeishSequence[PartialUser],
*,
delete_message_seconds: UndefinedOr[
Intervalish
] = UNDEFINED,
reason: UndefinedOr[str] = UNDEFINED,
) -> BulkBanResponse
Ban up to 200 users from a guild at once.
| PARAMETER | DESCRIPTION |
|---|---|
guild | The guild to ban the users from. This may be the object or the ID of an existing guild. TYPE: |
users | The users to ban. These may be the objects or the IDs of existing users. A maximum of 200 users can be banned at once. TYPE: |
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: |
| RETURNS | DESCRIPTION |
|---|---|
BulkBanResponse | The IDs of the users which were banned and of those which were not. |
| RAISES | DESCRIPTION |
|---|---|
BadRequestError | If any of the fields that are passed have an invalid value, or if none of the users could be banned. |
ForbiddenError | If you are missing the |
UnauthorizedError | If you are unauthorized to make the request (invalid/missing token). |
NotFoundError | If the guild 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. |
consume_entitlement abstractmethod async #
consume_entitlement(
application: SnowflakeishOr[PartialApplication],
entitlement: SnowflakeishOr[Entitlement],
) -> None
Mark a one-time purchase consumable entitlement as consumed.
| PARAMETER | DESCRIPTION |
|---|---|
application | The application the entitlement belongs to. TYPE: |
entitlement | The entitlement to consume. TYPE: |
| RAISES | DESCRIPTION |
|---|---|
BadRequestError | If the entitlement is not consumable. |
UnauthorizedError | If you are unauthorized to make the request (invalid/missing token). |
NotFoundError | If the entitlement was 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. |
context_menu_command_builder abstractmethod #
context_menu_command_builder(
type: CommandType | int, name: str
) -> ContextMenuCommandBuilder
Create a command builder to use in hikari.api.rest.RESTClient.set_application_commands.
| PARAMETER | DESCRIPTION |
|---|---|
type | The commands's type. TYPE: |
name | The command's name. TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
ContextMenuCommandBuilder | The created command builder object. |
create_application_emoji abstractmethod async #
create_application_emoji(
application: SnowflakeishOr[PartialApplication],
name: str,
image: Resourceish,
) -> KnownCustomEmoji
Create an application emoji.
| PARAMETER | DESCRIPTION |
|---|---|
application | The application to create the emoji for. This can be an application object or the ID of an existing application. TYPE: |
name | The name for the emoji. TYPE: |
image | The 128x128 image for the emoji. Maximum upload size is 256kb. This can be a still or an animated image. TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
KnownCustomEmoji | The created emoji. |
| RAISES | DESCRIPTION |
|---|---|
BadRequestError | If any of the fields that are passed have an invalid value or if there is no more spaces for the emoji in the application. |
ForbiddenError | If you are trying to create an emoji for an application that is not yours. |
NotFoundError | If the application is not 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. |
create_auto_mod_rule abstractmethod async #
create_auto_mod_rule(
guild: SnowflakeishOr[PartialGuild],
*,
name: str,
event_type: AutoModEventType | int,
trigger: AutoModTriggerBuilder,
actions: Sequence[AutoModActionBuilder],
enabled: UndefinedOr[bool] = True,
exempt_roles: UndefinedOr[
SnowflakeishSequence[PartialRole]
] = UNDEFINED,
exempt_channels: UndefinedOr[
SnowflakeishSequence[PartialChannel]
] = UNDEFINED,
reason: UndefinedOr[str] = UNDEFINED,
) -> AutoModRule
Create an auto-moderation rule.
| PARAMETER | DESCRIPTION |
|---|---|
guild | Object or ID of the guild to create the auto-moderation rules in. TYPE: |
name | The rule's name. TYPE: |
event_type | The type of user content creation event this rule should trigger on. TYPE: |
trigger | The trigger builder to create the rule from. TYPE: |
actions | Sequence of the actions to execute when this rule is triggered. TYPE: |
enabled | Whether this auto-moderation rule should be enabled. TYPE: |
exempt_channels | Sequence of up to 50 objects and IDs of channels which are not effected by the rule. TYPE: |
exempt_roles | Sequence of up to 20 objects and IDs of roles which are not effected by the rule. TYPE: |
reason | If provided, the reason that will be recorded in the audit logs. Maximum of 512 characters. TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
AutoModRule | The created auto-moderation rule. |
| 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 was 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. |
create_autocomplete_response abstractmethod async #
create_autocomplete_response(
interaction: SnowflakeishOr[PartialInteraction],
token: str,
choices: Sequence[AutocompleteChoiceBuilder],
) -> InteractionCallbackResponse
Create the initial response for an autocomplete interaction.
| PARAMETER | DESCRIPTION |
|---|---|
interaction | Object or ID of the interaction this response is for. TYPE: |
token | The interaction's token. TYPE: |
choices | The autocomplete choices themselves. |
| RETURNS | DESCRIPTION |
|---|---|
InteractionCallbackResponse | The interaction callback response. |
| RAISES | DESCRIPTION |
|---|---|
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. |
create_context_menu_command abstractmethod async #
create_context_menu_command(
application: SnowflakeishOr[PartialApplication],
type: CommandType | int,
name: str,
*,
guild: UndefinedOr[
SnowflakeishOr[PartialGuild]
] = UNDEFINED,
name_localizations: UndefinedOr[
Mapping[Locale | str, str]
] = UNDEFINED,
default_member_permissions: UndefinedType
| int
| Permissions = UNDEFINED,
nsfw: UndefinedOr[bool] = UNDEFINED,
) -> ContextMenuCommand
Create an application context menu command.
| PARAMETER | DESCRIPTION |
|---|---|
application | Object or ID of the application to create a command for. TYPE: |
type | The type of menu command to make. Only USER and MESSAGE are valid here. TYPE: |
name | The command's name. TYPE: |
guild | Object or ID of the specific guild this should be made for. If left as TYPE: |
name_localizations | The name localizations for this command. TYPE: |
default_member_permissions | Member permissions necessary to utilize this command by default. If TYPE: |
nsfw | Whether this command should be age-restricted. TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
ContextMenuCommand | Object of the created command. |
| RAISES | DESCRIPTION |
|---|---|
ForbiddenError | If you cannot access the provided application's commands. |
NotFoundError | If the provided application isn't found. |
BadRequestError | If any of the fields that are passed have an invalid value. |
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. |
create_dm_channel abstractmethod async #
create_dm_channel(
user: SnowflakeishOr[PartialUser],
) -> DMChannel
Create a DM channel with a user.
| PARAMETER | DESCRIPTION |
|---|---|
user | The user to create the DM channel with. This may be the object or the ID of an existing user. TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
DMChannel | The created DM channel. |
| RAISES | DESCRIPTION |
|---|---|
BadRequestError | If the user is not 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. |
create_emoji abstractmethod async #
create_emoji(
guild: SnowflakeishOr[PartialGuild],
name: str,
image: Resourceish,
*,
roles: UndefinedOr[
SnowflakeishSequence[PartialRole]
] = UNDEFINED,
reason: UndefinedOr[str] = UNDEFINED,
) -> KnownCustomEmoji
Create an emoji in a guild.
| PARAMETER | DESCRIPTION |
|---|---|
guild | The guild to create the emoji on. This can be a guild object or the ID of an existing guild. TYPE: |
name | The name for the emoji. TYPE: |
image | The 128x128 image for the emoji. Maximum upload size is 256kb. This can be a still or an animated image. TYPE: |
roles | If provided, a collection of the roles that will be able to use this emoji. This can be a TYPE: |
reason | If provided, the reason that will be recorded in the audit logs. Maximum of 512 characters. TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
KnownCustomEmoji | The created emoji. |
| RAISES | DESCRIPTION |
|---|---|
BadRequestError | If any of the fields that are passed have an invalid value or if there are no more spaces for the type of emoji in the guild. |
ForbiddenError | If you are missing |
NotFoundError | If the guild is not 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. |
create_external_event abstractmethod async #
create_external_event(
guild: SnowflakeishOr[PartialGuild],
name: str,
/,
location: str,
start_time: datetime,
end_time: datetime,
*,
description: UndefinedOr[str] = UNDEFINED,
image: UndefinedOr[Resourceish] = UNDEFINED,
privacy_level: int | EventPrivacyLevel = GUILD_ONLY,
reason: UndefinedOr[str] = UNDEFINED,
) -> ScheduledExternalEvent
Create a scheduled external event.
| PARAMETER | DESCRIPTION |
|---|---|
guild | The guild to create the event in. TYPE: |
name | The name of the event. TYPE: |
location | The location the event. TYPE: |
start_time | When the event is scheduled to start. TYPE: |
end_time | When the event is scheduled to end. TYPE: |
description | The event's description. TYPE: |
image | The event's display image. TYPE: |
privacy_level | The event's privacy level. This effects who can view and subscribe to the event. TYPE: |
reason | If provided, the reason that will be recorded in the audit logs. Maximum of 512 characters. TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
ScheduledExternalEvent | The created scheduled external event. |
| RAISES | DESCRIPTION |
|---|---|
BadRequestError | If any of the fields that are passed have an invalid value. |
UnauthorizedError | If you are unauthorized to make the request (invalid/missing token). |
ForbiddenError | If you are missing the |
NotFoundError | If the guild or event 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. |
create_forum_post abstractmethod async #
create_forum_post(
channel: SnowflakeishOr[PermissibleGuildChannel],
name: str,
/,
content: UndefinedOr[Any] = UNDEFINED,
*,
attachment: UndefinedOr[Resourceish] = UNDEFINED,
attachments: UndefinedOr[
Sequence[Resourceish]
] = UNDEFINED,
component: UndefinedOr[ComponentBuilder] = UNDEFINED,
components: UndefinedOr[
Sequence[ComponentBuilder]
] = UNDEFINED,
embed: UndefinedOr[Embed] = UNDEFINED,
embeds: UndefinedOr[Sequence[Embed]] = UNDEFINED,
poll: UndefinedOr[PollBuilder] = UNDEFINED,
sticker: UndefinedOr[
SnowflakeishOr[PartialSticker]
] = UNDEFINED,
stickers: UndefinedOr[
SnowflakeishSequence[PartialSticker]
] = UNDEFINED,
tts: UndefinedOr[bool] = UNDEFINED,
mentions_everyone: UndefinedOr[bool] = UNDEFINED,
mentions_reply: UndefinedOr[bool] = UNDEFINED,
user_mentions: UndefinedOr[
SnowflakeishSequence[PartialUser] | bool
] = UNDEFINED,
role_mentions: UndefinedOr[
SnowflakeishSequence[PartialRole] | bool
] = UNDEFINED,
flags: UndefinedType | int | MessageFlag = UNDEFINED,
auto_archive_duration: UndefinedOr[
Intervalish
] = timedelta(days=1),
rate_limit_per_user: UndefinedOr[
Intervalish
] = UNDEFINED,
tags: UndefinedOr[Sequence[Snowflake]] = UNDEFINED,
reason: UndefinedOr[str] = UNDEFINED,
) -> GuildPublicThread
Create a post in a forum or media channel.
| PARAMETER | DESCRIPTION |
|---|---|
channel | Object or ID of the forum or media channel to create a post in. |
name | Name of the post. TYPE: |
content | If provided, the message contents. If If this is a Likewise, 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. 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: |
poll | If provided, the message poll. TYPE: |
sticker | If provided, the object or ID of a sticker to send on the message. As of writing, bots can only send custom stickers from the current guild. TYPE: |
stickers | If provided, a sequence of the objects and IDs of up to 3 stickers to send on the message. As of writing, bots can only send custom stickers from the current guild. 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: |
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: |
auto_archive_duration | If provided, how long the post should remain inactive until it's archived. This should be either 60, 1440, 4320 or 10080 minutes and, as of writing, ignores the parent channel's set default_auto_archive_duration when passed as TYPE: |
rate_limit_per_user | If provided, the amount of seconds a user has to wait before being able to send another message in the channel. Maximum 21600 seconds. TYPE: |
tags | If provided, the tags to add to the created post. TYPE: |
reason | If provided, the reason that will be recorded in the audit logs. Maximum of 512 characters. TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
GuildPublicThread | The created post. |
| 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). |
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. |
create_guild_category abstractmethod async #
create_guild_category(
guild: SnowflakeishOr[PartialGuild],
name: str,
*,
position: UndefinedOr[int] = UNDEFINED,
permission_overwrites: UndefinedOr[
Sequence[PermissionOverwrite]
] = UNDEFINED,
reason: UndefinedOr[str] = UNDEFINED,
) -> GuildCategory
Create a category in a guild.
| PARAMETER | DESCRIPTION |
|---|---|
guild | The guild to create the channel in. This may be the object or the ID of an existing guild. TYPE: |
name | The channels name. Must be between 2 and 1000 characters. TYPE: |
position | If provided, the position of the category. TYPE: |
permission_overwrites | If provided, the permission overwrites for the category. TYPE: |
reason | If provided, the reason that will be recorded in the audit logs. Maximum of 512 characters. TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
GuildCategory | The created category. |
| 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 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. |
create_guild_forum_channel abstractmethod async #
create_guild_forum_channel(
guild: SnowflakeishOr[PartialGuild],
name: str,
*,
position: UndefinedOr[int] = UNDEFINED,
category: UndefinedOr[
SnowflakeishOr[GuildCategory]
] = UNDEFINED,
permission_overwrites: UndefinedOr[
Sequence[PermissionOverwrite]
] = UNDEFINED,
topic: UndefinedOr[str] = UNDEFINED,
nsfw: UndefinedOr[bool] = UNDEFINED,
rate_limit_per_user: UndefinedOr[
Intervalish
] = UNDEFINED,
default_auto_archive_duration: UndefinedOr[
Intervalish
] = UNDEFINED,
default_thread_rate_limit_per_user: UndefinedOr[
Intervalish
] = UNDEFINED,
default_forum_layout: UndefinedOr[
ForumLayoutType | int
] = UNDEFINED,
default_sort_order: UndefinedOr[
ForumSortOrderType | int
] = UNDEFINED,
available_tags: UndefinedOr[
Sequence[ForumTag]
] = UNDEFINED,
default_reaction_emoji: str
| Emoji
| UndefinedType
| Snowflake = UNDEFINED,
reason: UndefinedOr[str] = UNDEFINED,
) -> GuildForumChannel
Create a forum channel in a guild.
| PARAMETER | DESCRIPTION |
|---|---|
guild | The guild to create the channel in. This may be the object or the ID of an existing guild. TYPE: |
name | The channels name. Must be between 2 and 1000 characters. TYPE: |
position | If provided, the position of the category. TYPE: |
category | The category to create the channel under. This may be the object or the ID of an existing category. TYPE: |
permission_overwrites | If provided, the permission overwrites for the category. TYPE: |
topic | If provided, the channels topic. Maximum 1024 characters. TYPE: |
nsfw | If provided, whether to mark the channel as NSFW. TYPE: |
rate_limit_per_user | If provided, the amount of seconds a user has to wait before being able to send another message in the channel. Maximum 21600 seconds. TYPE: |
default_auto_archive_duration | If provided, the auto archive duration Discord's end user client should default to when creating threads in this channel. This should be either 60, 1440, 4320 or 10080 minutes and, as of writing, ignores the parent channel's set default_auto_archive_duration when passed as TYPE: |
default_thread_rate_limit_per_user | If provided, the ratelimit that should be set in threads created from the forum. TYPE: |
default_forum_layout | If provided, the default forum layout to show in the client. TYPE: |
default_sort_order | If provided, the default sort order to show in the client. TYPE: |
available_tags | If provided, the available tags to select from when creating a thread. TYPE: |
default_reaction_emoji | If provided, the new default reaction emoji for threads created in a forum channel. TYPE: |
reason | If provided, the reason that will be recorded in the audit logs. Maximum of 512 characters. TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
GuildForumChannel | The created forum channel. |
| 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 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. |
create_guild_media_channel abstractmethod async #
create_guild_media_channel(
guild: SnowflakeishOr[PartialGuild],
name: str,
*,
position: UndefinedOr[int] = UNDEFINED,
category: UndefinedOr[
SnowflakeishOr[GuildCategory]
] = UNDEFINED,
permission_overwrites: UndefinedOr[
Sequence[PermissionOverwrite]
] = UNDEFINED,
topic: UndefinedOr[str] = UNDEFINED,
nsfw: UndefinedOr[bool] = UNDEFINED,
rate_limit_per_user: UndefinedOr[
Intervalish
] = UNDEFINED,
default_auto_archive_duration: UndefinedOr[
Intervalish
] = UNDEFINED,
default_thread_rate_limit_per_user: UndefinedOr[
Intervalish
] = UNDEFINED,
default_forum_layout: UndefinedOr[
ForumLayoutType | int
] = UNDEFINED,
default_sort_order: UndefinedOr[
ForumSortOrderType | int
] = UNDEFINED,
available_tags: UndefinedOr[
Sequence[ForumTag]
] = UNDEFINED,
default_reaction_emoji: str
| Emoji
| UndefinedType
| Snowflake = UNDEFINED,
reason: UndefinedOr[str] = UNDEFINED,
) -> GuildMediaChannel
Create a media channel in a guild.
| PARAMETER | DESCRIPTION |
|---|---|
guild | The guild to create the channel in. This may be the object or the ID of an existing guild. TYPE: |
name | The channels name. Must be between 2 and 1000 characters. TYPE: |
position | If provided, the position of the category. TYPE: |
category | The category to create the channel under. This may be the object or the ID of an existing category. TYPE: |
permission_overwrites | If provided, the permission overwrites for the category. TYPE: |
topic | If provided, the channels topic. Maximum 1024 characters. TYPE: |
nsfw | If provided, whether to mark the channel as NSFW. TYPE: |
rate_limit_per_user | If provided, the amount of seconds a user has to wait before being able to send another message in the channel. Maximum 21600 seconds. TYPE: |
default_auto_archive_duration | If provided, the auto archive duration Discord's end user client should default to when creating threads in this channel. This should be either 60, 1440, 4320 or 10080 minutes and, as of writing, ignores the parent channel's set default_auto_archive_duration when passed as TYPE: |
default_thread_rate_limit_per_user | If provided, the ratelimit that should be set in threads created from the forum. TYPE: |
default_forum_layout | If provided, the default forum layout to show in the client. TYPE: |
default_sort_order | If provided, the default sort order to show in the client. TYPE: |
available_tags | If provided, the available tags to select from when creating a thread. TYPE: |
default_reaction_emoji | If provided, the new default reaction emoji for threads created in the media channel. TYPE: |
reason | If provided, the reason that will be recorded in the audit logs. Maximum of 512 characters. TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
GuildMediaChannel | The created media channel. |
| 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 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. |
create_guild_news_channel abstractmethod async #
create_guild_news_channel(
guild: SnowflakeishOr[PartialGuild],
name: str,
*,
position: UndefinedOr[int] = UNDEFINED,
topic: UndefinedOr[str] = UNDEFINED,
nsfw: UndefinedOr[bool] = UNDEFINED,
rate_limit_per_user: UndefinedOr[
Intervalish
] = UNDEFINED,
permission_overwrites: UndefinedOr[
Sequence[PermissionOverwrite]
] = UNDEFINED,
category: UndefinedOr[
SnowflakeishOr[GuildCategory]
] = UNDEFINED,
default_auto_archive_duration: UndefinedOr[
Intervalish
] = UNDEFINED,
reason: UndefinedOr[str] = UNDEFINED,
) -> GuildNewsChannel
Create a news channel in a guild.
| PARAMETER | DESCRIPTION |
|---|---|
guild | The guild to create the channel in. This may be the object or the ID of an existing guild. TYPE: |
name | The channels name. Must be between 2 and 1000 characters. TYPE: |
position | If provided, the position of the channel (relative to the category, if any). TYPE: |
topic | If provided, the channels topic. Maximum 1024 characters. TYPE: |
nsfw | If provided, whether to mark the channel as NSFW. TYPE: |
rate_limit_per_user | If provided, the amount of seconds a user has to wait before being able to send another message in the channel. Maximum 21600 seconds. TYPE: |
permission_overwrites | If provided, the permission overwrites for the channel. TYPE: |
category | The category to create the channel under. This may be the object or the ID of an existing category. TYPE: |
default_auto_archive_duration | If provided, the auto archive duration Discord's end user client should default to when creating threads in this channel. This should be either 60, 1440, 4320 or 10080 minutes and, as of writing, ignores the parent channel's set default_auto_archive_duration when passed as TYPE: |
reason | If provided, the reason that will be recorded in the audit logs. Maximum of 512 characters. TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
GuildNewsChannel | The created channel. |
| 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 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. |
create_guild_stage_channel abstractmethod async #
create_guild_stage_channel(
guild: SnowflakeishOr[PartialGuild],
name: str,
*,
position: UndefinedOr[int] = UNDEFINED,
user_limit: UndefinedOr[int] = UNDEFINED,
bitrate: UndefinedOr[int] = UNDEFINED,
permission_overwrites: UndefinedOr[
Sequence[PermissionOverwrite]
] = UNDEFINED,
region: UndefinedOr[VoiceRegion | str] = UNDEFINED,
category: UndefinedOr[
SnowflakeishOr[GuildCategory]
] = UNDEFINED,
reason: UndefinedOr[str] = UNDEFINED,
) -> GuildStageChannel
Create a stage channel in a guild.
| PARAMETER | DESCRIPTION |
|---|---|
guild | The guild to create the channel in. This may be the object or the ID of an existing guild. TYPE: |
name | The channel's name. Must be between 2 and 1000 characters. TYPE: |
position | If provided, the position of the channel (relative to the category, if any). TYPE: |
user_limit | If provided, the maximum users in the channel at once. Must be between 0 and 99 with 0 meaning no limit. TYPE: |
bitrate | If provided, the bitrate for the channel. Must be between 8000 and 96000 or 8000 and 128000 for VIP servers. TYPE: |
permission_overwrites | If provided, the permission overwrites for the channel. TYPE: |
region | If provided, the voice region to for this channel. Passing TYPE: |
category | The category to create the channel under. This may be the object or the ID of an existing category. TYPE: |
reason | If provided, the reason that will be recorded in the audit logs. Maximum of 512 characters. TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
GuildStageChannel | The created channel. |
| 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 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. |
create_guild_text_channel abstractmethod async #
create_guild_text_channel(
guild: SnowflakeishOr[PartialGuild],
name: str,
*,
position: UndefinedOr[int] = UNDEFINED,
topic: UndefinedOr[str] = UNDEFINED,
nsfw: UndefinedOr[bool] = UNDEFINED,
rate_limit_per_user: UndefinedOr[
Intervalish
] = UNDEFINED,
permission_overwrites: UndefinedOr[
Sequence[PermissionOverwrite]
] = UNDEFINED,
category: UndefinedOr[
SnowflakeishOr[GuildCategory]
] = UNDEFINED,
default_auto_archive_duration: UndefinedOr[
Intervalish
] = UNDEFINED,
reason: UndefinedOr[str] = UNDEFINED,
) -> GuildTextChannel
Create a text channel in a guild.
| PARAMETER | DESCRIPTION |
|---|---|
guild | The guild to create the channel in. This may be the object or the ID of an existing guild. TYPE: |
name | The channels name. Must be between 2 and 1000 characters. TYPE: |
position | If provided, the position of the channel (relative to the category, if any). TYPE: |
topic | If provided, the channels topic. Maximum 1024 characters. TYPE: |
nsfw | If provided, whether to mark the channel as NSFW. TYPE: |
rate_limit_per_user | If provided, the amount of seconds a user has to wait before being able to send another message in the channel. Maximum 21600 seconds. TYPE: |
permission_overwrites | If provided, the permission overwrites for the channel. TYPE: |
category | The category to create the channel under. This may be the object or the ID of an existing category. TYPE: |
default_auto_archive_duration | If provided, the auto archive duration Discord's end user client should default to when creating threads in this channel. This should be either 60, 1440, 4320 or 10080 minutes and, as of writing, ignores the parent channel's set default_auto_archive_duration when passed as TYPE: |
reason | If provided, the reason that will be recorded in the audit logs. Maximum of 512 characters. TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
GuildTextChannel | The created channel. |
| 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 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. |
create_guild_voice_channel abstractmethod async #
create_guild_voice_channel(
guild: SnowflakeishOr[PartialGuild],
name: str,
*,
position: UndefinedOr[int] = UNDEFINED,
user_limit: UndefinedOr[int] = UNDEFINED,
bitrate: UndefinedOr[int] = UNDEFINED,
video_quality_mode: UndefinedOr[
VideoQualityMode | int
] = UNDEFINED,
permission_overwrites: UndefinedOr[
Sequence[PermissionOverwrite]
] = UNDEFINED,
region: UndefinedOr[VoiceRegion | str] = UNDEFINED,
category: UndefinedOr[
SnowflakeishOr[GuildCategory]
] = UNDEFINED,
reason: UndefinedOr[str] = UNDEFINED,
) -> GuildVoiceChannel
Create a voice channel in a guild.
| PARAMETER | DESCRIPTION |
|---|---|
guild | The guild to create the channel in. This may be the object or the ID of an existing guild. TYPE: |
name | The channels name. Must be between 2 and 1000 characters. TYPE: |
position | If provided, the position of the channel (relative to the category, if any). TYPE: |
user_limit | If provided, the maximum users in the channel at once. Must be between 0 and 99 with 0 meaning no limit. TYPE: |
bitrate | If provided, the bitrate for the channel. Must be between 8000 and 96000 or 8000 and 128000 for VIP servers. TYPE: |
video_quality_mode | If provided, the new video quality mode for the channel. TYPE: |
permission_overwrites | If provided, the permission overwrites for the channel. TYPE: |
region | If provided, the voice region to for this channel. Passing TYPE: |
category | The category to create the channel under. This may be the object or the ID of an existing category. TYPE: |
reason | If provided, the reason that will be recorded in the audit logs. Maximum of 512 characters. TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
GuildVoiceChannel | The created channel. |
| 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 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. |
create_interaction_response abstractmethod async #
create_interaction_response(
interaction: SnowflakeishOr[PartialInteraction],
token: str,
response_type: int | ResponseType,
content: UndefinedOr[Any] = UNDEFINED,
*,
flags: int | MessageFlag | UndefinedType = UNDEFINED,
tts: UndefinedOr[bool] = UNDEFINED,
attachment: UndefinedNoneOr[Resourceish] = UNDEFINED,
attachments: UndefinedNoneOr[
Sequence[Resourceish]
] = UNDEFINED,
component: UndefinedNoneOr[
ComponentBuilder
] = UNDEFINED,
components: UndefinedNoneOr[
Sequence[ComponentBuilder]
] = UNDEFINED,
embed: UndefinedNoneOr[Embed] = UNDEFINED,
embeds: UndefinedNoneOr[Sequence[Embed]] = UNDEFINED,
poll: UndefinedOr[PollBuilder] = UNDEFINED,
mentions_everyone: UndefinedOr[bool] = UNDEFINED,
user_mentions: UndefinedOr[
SnowflakeishSequence[PartialUser] | bool
] = UNDEFINED,
role_mentions: UndefinedOr[
SnowflakeishSequence[PartialRole] | bool
] = UNDEFINED,
) -> InteractionCallbackResponse
Create the initial response for a interaction.
Warning
Calling this with 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 |
|---|---|
interaction | Object or ID of the interaction this response is for. TYPE: |
token | The interaction's token. TYPE: |
response_type | The type of interaction response this is. TYPE: |
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: |
poll | If provided, the poll to add to the message. 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: |
| RETURNS | DESCRIPTION |
|---|---|
InteractionCallbackResponse | The interaction callback response. |
| 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. |
create_interaction_voice_message_response abstractmethod async #
create_interaction_voice_message_response(
interaction: SnowflakeishOr[PartialInteraction],
token: str,
attachment: Resourceish,
waveform: str,
duration: float,
*,
flags: int | MessageFlag | UndefinedType = UNDEFINED,
) -> InteractionCallbackResponse
Create the a initial voice message response for a interaction.
Warning
Calling this with 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 |
|---|---|
interaction | Object or ID of the interaction this response is for. TYPE: |
token | The interaction's token. TYPE: |
attachment | The audio attachment used as source for the voice message. This can be a resource, or string of a path on your computer or a URL. The Content-Type of the attachment has to start with TYPE: |
waveform | The waveform of the entire voice message, with 1 byte per datapoint encoded in base64. Official clients sample the recording at most once per 100 milliseconds, but will downsample so that no more than 256 datapoints are in the waveform. Note Discord states that this is implementation detail and might change without notice. You have been warned! TYPE: |
duration | The duration of the voice message in seconds. This is intended to be a float. 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: |
| RETURNS | DESCRIPTION |
|---|---|
InteractionCallbackResponse | The interaction callback response. |
| RAISES | DESCRIPTION |
|---|---|
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. |
create_invite abstractmethod async #
create_invite(
channel: SnowflakeishOr[GuildChannel],
*,
max_age: UndefinedOr[Intervalish] = UNDEFINED,
max_uses: UndefinedOr[int] = UNDEFINED,
temporary: UndefinedOr[bool] = UNDEFINED,
unique: UndefinedOr[bool] = UNDEFINED,
target_type: UndefinedOr[TargetType] = UNDEFINED,
target_user: UndefinedOr[
SnowflakeishOr[PartialUser]
] = UNDEFINED,
target_application: UndefinedOr[
SnowflakeishOr[PartialApplication]
] = UNDEFINED,
reason: UndefinedOr[str] = UNDEFINED,
) -> InviteWithMetadata
Create an invite to the given guild channel.
| PARAMETER | DESCRIPTION |
|---|---|
channel | The channel to create a invite for. This may be the object or the ID of an existing channel. TYPE: |
max_age | If provided, the duration of the invite before expiry. TYPE: |
max_uses | If provided, the max uses the invite can have. TYPE: |
temporary | If provided, whether the invite only grants temporary membership. TYPE: |
unique | If provided, whether the invite should be unique. TYPE: |
target_type | If provided, the target type of this invite. TYPE: |
target_user | If provided, the target user id for this invite. This may be the object or the ID of an existing user. Note This is required if TYPE: |
target_application | If provided, the target application id for this invite. This may be the object or the ID of an existing application. Note This is required if TYPE: |
reason | If provided, the reason that will be recorded in the audit logs. Maximum of 512 characters. TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
InviteWithMetadata | The invite to the given guild channel. |
| RAISES | DESCRIPTION |
|---|---|
BadRequestError | If any of the fields that are passed have an invalid value. |
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, or if the target user does not exist, if provided. |
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. |
create_message abstractmethod async #
create_message(
channel: SnowflakeishOr[TextableChannel],
content: UndefinedOr[Any] = UNDEFINED,
*,
attachment: UndefinedOr[Resourceish] = UNDEFINED,
attachments: UndefinedOr[
Sequence[Resourceish]
] = UNDEFINED,
component: UndefinedOr[ComponentBuilder] = UNDEFINED,
components: UndefinedOr[
Sequence[ComponentBuilder]
] = UNDEFINED,
embed: UndefinedOr[Embed] = UNDEFINED,
embeds: UndefinedOr[Sequence[Embed]] = UNDEFINED,
poll: UndefinedOr[PollBuilder] = UNDEFINED,
sticker: UndefinedOr[
SnowflakeishOr[PartialSticker]
] = UNDEFINED,
stickers: UndefinedOr[
SnowflakeishSequence[PartialSticker]
] = UNDEFINED,
tts: UndefinedOr[bool] = UNDEFINED,
nonce: UndefinedOr[str] = UNDEFINED,
reply: UndefinedOr[
SnowflakeishOr[PartialMessage]
] = UNDEFINED,
reply_must_exist: UndefinedOr[bool] = UNDEFINED,
mentions_everyone: UndefinedOr[bool] = UNDEFINED,
mentions_reply: UndefinedOr[bool] = UNDEFINED,
user_mentions: UndefinedOr[
SnowflakeishSequence[PartialUser] | bool
] = UNDEFINED,
role_mentions: UndefinedOr[
SnowflakeishSequence[PartialRole] | bool
] = UNDEFINED,
flags: UndefinedType | int | MessageFlag = UNDEFINED,
) -> Message
Create a message in the given channel.
| PARAMETER | DESCRIPTION |
|---|---|
channel | The channel to create the message in. TYPE: |
content | If provided, the message contents. If If this is a Likewise, 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. 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: |
poll | If provided, the poll to create. TYPE: |
sticker | If provided, the object or ID of a sticker to send on the message. As of writing, bots can only send custom stickers from the current guild. TYPE: |
stickers | If provided, a sequence of the objects and IDs of up to 3 stickers to send on the message. As of writing, bots can only send custom stickers from the current guild. TYPE: |
tts | If provided, whether the message will be read out by a screen reader using Discord's TTS (text-to-speech) system. TYPE: |
nonce | An arbitrary identifier to associate with the message. This can be used to identify it later in received events. If provided, this must be less than 32 bytes. If not provided, then a null value is placed on the message instead. All users can see this value. 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 [hikari.messages.MessageFlag.SUPPRESS_NOTIFICATIONS] and [hikari.messages.MessageFlag.SUPPRESS_EMBEDS]. TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
Message | The created message. |
| RAISES | DESCRIPTION |
|---|---|
ValueError | If more than 100 unique objects/entities are passed for |
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; if |
UnauthorizedError | If you are unauthorized to make the request (invalid/missing token). |
ForbiddenError | If you are missing the [hikari.permissions.Permissions.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 |
InternalServerError | If an internal error occurs on Discord while handling the request. |
create_message_thread abstractmethod async #
create_message_thread(
channel: SnowflakeishOr[PermissibleGuildChannel],
message: SnowflakeishOr[PartialMessage],
name: str,
/,
*,
auto_archive_duration: UndefinedOr[
Intervalish
] = timedelta(days=1),
rate_limit_per_user: UndefinedOr[
Intervalish
] = UNDEFINED,
reason: UndefinedOr[str] = UNDEFINED,
) -> GuildPublicThread | GuildNewsThread
Create a public or news thread on a message in a guild channel.
Note
This call may create a public or news thread dependent on the target channel's type and cannot create private threads.
| PARAMETER | DESCRIPTION |
|---|---|
channel | Object or ID of the guild news or text channel to create a public thread in. |
message | Object or ID of the message to attach the created thread to. TYPE: |
name | Name of the thread channel. TYPE: |
auto_archive_duration | If provided, how long the thread should remain inactive until it's archived. This should be either 60, 1440, 4320 or 10080 minutes and, as of writing, ignores the parent channel's set default_auto_archive_duration when passed as TYPE: |
rate_limit_per_user | If provided, the amount of seconds a user has to wait before being able to send another message in the channel. Maximum 21600 seconds. TYPE: |
reason | If provided, the reason that will be recorded in the audit logs. Maximum of 512 characters. TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
Union[GuildPublicThread, GuildNewsThread] | The created public or news thread channel. |
| 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). |
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. |
create_modal_response abstractmethod async #
create_modal_response(
interaction: SnowflakeishOr[PartialInteraction],
token: str,
*,
title: str,
custom_id: str,
component: UndefinedOr[ComponentBuilder] = UNDEFINED,
components: UndefinedOr[
Sequence[ComponentBuilder]
] = UNDEFINED,
) -> InteractionCallbackResponse
Create a response by sending a modal.
| PARAMETER | DESCRIPTION |
|---|---|
interaction | Object or ID of the interaction this response is for. TYPE: |
token | The interaction's token. TYPE: |
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: |
component | A component builders to send in this modal. TYPE: |
components | A sequence of component builders to send in this modal. TYPE: |
| RAISES | DESCRIPTION |
|---|---|
ValueError | If both |
create_role abstractmethod async #
create_role(
guild: SnowflakeishOr[PartialGuild],
*,
name: UndefinedOr[str] = UNDEFINED,
permissions: UndefinedOr[Permissions] = NONE,
color: UndefinedOr[
Colorish | ColorGradient
] = UNDEFINED,
colour: UndefinedOr[
Colorish | ColorGradient
] = UNDEFINED,
hoist: UndefinedOr[bool] = UNDEFINED,
icon: UndefinedOr[Resourceish] = UNDEFINED,
unicode_emoji: UndefinedOr[str] = UNDEFINED,
mentionable: UndefinedOr[bool] = UNDEFINED,
reason: UndefinedOr[str] = UNDEFINED,
) -> Role
Create a role.
| PARAMETER | DESCRIPTION |
|---|---|
guild | The guild to create the role in. This may be the object or the ID of an existing guild. TYPE: |
name | If provided, the name for the role. TYPE: |
permissions | The permissions to give the role. This will default to setting NO permissions if left as the default value. This is in contrast to default behaviour on Discord where some random permissions will be set by default. TYPE: |
color | If provided, the role's color. Passing a Gradient and holographic styles can only be used if the guild has the Note When the gradient's tertiary color is provided, the API enforces the role color to be the holographic style, which can be built with TYPE: |
colour | An alias for TYPE: |
hoist | If provided, whether to hoist the role. TYPE: |
icon | If provided, the role icon. Must be a 64x64 image under 256kb. TYPE: |
unicode_emoji | If provided, the standard emoji to set as the role icon. TYPE: |
mentionable | If provided, whether to make the role mentionable. TYPE: |
reason | If provided, the reason that will be recorded in the audit logs. Maximum of 512 characters. TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
Role | The created role. |
| RAISES | DESCRIPTION |
|---|---|
TypeError | If both |
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 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. |
create_slash_command abstractmethod async #
create_slash_command(
application: SnowflakeishOr[PartialApplication],
name: str,
description: str,
*,
guild: UndefinedOr[
SnowflakeishOr[PartialGuild]
] = UNDEFINED,
options: UndefinedOr[
Sequence[CommandOption]
] = UNDEFINED,
name_localizations: UndefinedOr[
Mapping[Locale | str, str]
] = UNDEFINED,
description_localizations: UndefinedOr[
Mapping[Locale | str, str]
] = UNDEFINED,
default_member_permissions: UndefinedType
| int
| Permissions = UNDEFINED,
nsfw: UndefinedOr[bool] = UNDEFINED,
) -> SlashCommand
Create an application slash command.
| PARAMETER | DESCRIPTION |
|---|---|
application | Object or ID of the application to create a command for. TYPE: |
name | The command's name. This should match the regex TYPE: |
description | The description to set for the command. This should be inclusively between 1-100 characters in length. TYPE: |
guild | Object or ID of the specific guild this should be made for. If left as TYPE: |
options | A sequence of up to 10 options for this command. TYPE: |
name_localizations | The name localizations for this command. TYPE: |
description_localizations | The description localizations for this command. TYPE: |
default_member_permissions | Member permissions necessary to utilize this command by default. If TYPE: |
nsfw | Whether this command should be age-restricted. TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
SlashCommand | Object of the created command. |
| RAISES | DESCRIPTION |
|---|---|
ForbiddenError | If you cannot access the provided application's commands. |
NotFoundError | If the provided application isn't found. |
BadRequestError | If any of the fields that are passed have an invalid value. |
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. |
create_stage_event abstractmethod async #
create_stage_event(
guild: SnowflakeishOr[PartialGuild],
channel: SnowflakeishOr[PartialChannel],
name: str,
/,
start_time: datetime,
*,
description: UndefinedOr[str] = UNDEFINED,
end_time: UndefinedOr[datetime] = UNDEFINED,
image: UndefinedOr[Resourceish] = UNDEFINED,
privacy_level: int | EventPrivacyLevel = GUILD_ONLY,
reason: UndefinedOr[str] = UNDEFINED,
) -> ScheduledStageEvent
Create a scheduled stage event.
| PARAMETER | DESCRIPTION |
|---|---|
guild | The guild to create the event in. TYPE: |
channel | The stage channel to create the event in. TYPE: |
name | The name of the event. TYPE: |
start_time | When the event is scheduled to start. TYPE: |
description | The event's description. TYPE: |
end_time | When the event should be scheduled to end. TYPE: |
image | The event's display image. TYPE: |
privacy_level | The event's privacy level. This effects who can view and subscribe to the event. TYPE: |
reason | If provided, the reason that will be recorded in the audit logs. Maximum of 512 characters. TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
ScheduledStageEvent | The created scheduled stage event. |
| RAISES | DESCRIPTION |
|---|---|
BadRequestError | If any of the fields that are passed have an invalid value. |
UnauthorizedError | If you are unauthorized to make the request (invalid/missing token). |
ForbiddenError | If you are missing permissions to create the scheduled event. You need the following permissions in the target stage channel: |
NotFoundError | If the guild or event 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. |
create_stage_instance abstractmethod async #
create_stage_instance(
channel: SnowflakeishOr[GuildStageChannel],
*,
topic: str,
privacy_level: UndefinedOr[
int | StageInstancePrivacyLevel
],
send_start_notification: UndefinedOr[bool] = UNDEFINED,
scheduled_event_id: UndefinedOr[
SnowflakeishOr[ScheduledEvent]
] = UNDEFINED,
reason: UndefinedOr[str] = UNDEFINED,
) -> StageInstance
Create a stage instance in guild stage channel.
| PARAMETER | DESCRIPTION |
|---|---|
channel | The channel to use for the stage instance creation. TYPE: |
topic | The topic for the stage instance. TYPE: |
privacy_level | The privacy level for the stage instance. TYPE: |
send_start_notification | Whether to send a notification to all server members that the stage instance has started. TYPE: |
scheduled_event_id | The ID of the scheduled event to associate with the stage instance. TYPE: |
reason | If provided, the reason that will be recorded in the audit logs. Maximum of 512 characters. TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
StageInstance | The created stage instance. |
| 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 |
RateLimitedError | Usually, Hikari will handle and retry on hitting rate-limits automatically. This includes most bucket-specific rate-limits and global rate-limits. In some rare edge cases, however, Discord implements other undocumented rules for rate-limiting, such as limits per attribute. These cannot be detected or handled normally by Hikari due to their undocumented nature, and will trigger this exception if they occur. |
InternalServerError | If an internal error occurs on Discord while handling the request. |
create_sticker abstractmethod async #
create_sticker(
guild: SnowflakeishOr[PartialGuild],
name: str,
tag: str,
image: Resourceish,
*,
description: UndefinedOr[str] = UNDEFINED,
reason: UndefinedOr[str] = UNDEFINED,
) -> GuildSticker
Create a sticker in a guild.
| PARAMETER | DESCRIPTION |
|---|---|
guild | The guild to create the sticker on. This can be a guild object or the ID of an existing guild. TYPE: |
name | The name for the sticker. TYPE: |
tag | The tag for the sticker. TYPE: |
image | The 320x320 image for the sticker. Maximum upload size is 500kb. This can be a still PNG, an animated PNG, a Lottie, or a GIF. Note Lottie support is only available for verified and partnered servers. TYPE: |
description | If provided, the description of the sticker. TYPE: |
reason | If provided, the reason that will be recorded in the audit logs. Maximum of 512 characters. TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
GuildSticker | The created sticker. |
| RAISES | DESCRIPTION |
|---|---|
BadRequestError | If any of the fields that are passed have an invalid value or if there are no more spaces for the sticker in the guild. |
ForbiddenError | If you are missing |
NotFoundError | If the guild is not 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. |
create_template abstractmethod async #
create_template(
guild: SnowflakeishOr[PartialGuild],
name: str,
*,
description: UndefinedNoneOr[str] = UNDEFINED,
) -> Template
Create a guild template.
| PARAMETER | DESCRIPTION |
|---|---|
guild | The guild to create a template from. TYPE: |
name | The name to use for the created template. TYPE: |
description | The description to set for the template. TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
Template | The object of the created template. |
| RAISES | DESCRIPTION |
|---|---|
ForbiddenError | If you are not part of the guild. |
NotFoundError | If the guild is not found or you are missing the |
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. |
create_test_entitlement abstractmethod async #
create_test_entitlement(
application: SnowflakeishOr[PartialApplication],
/,
*,
sku: SnowflakeishOr[SKU],
owner_id: Snowflakeish,
owner_type: EntitlementOwnerType,
) -> Entitlement
Create a test entitlement for a given SKU.
.. note:: The created entitlement is only partial and the subscription_id, starts_at and ends_at fields will be None.
| PARAMETER | DESCRIPTION |
|---|---|
application | The application to create the entitlement for. TYPE: |
sku | The SKU to create a test entitlement for. TYPE: |
owner_id | The ID of the owner of the entitlement. TYPE: |
owner_type | The type of the owner of the entitlement. TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
Entitlement | The created partial entitlement. |
| RAISES | DESCRIPTION |
|---|---|
BadRequestError | If any of the fields that are passed have an invalid value. |
UnauthorizedError | If you are unauthorized to make the request (invalid/missing token). |
NotFoundError | If the SKU or owner was 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. |
create_thread abstractmethod async #
create_thread(
channel: SnowflakeishOr[PermissibleGuildChannel],
type: ChannelType | int,
name: str,
/,
*,
auto_archive_duration: UndefinedOr[
Intervalish
] = timedelta(days=1),
invitable: UndefinedOr[bool] = UNDEFINED,
rate_limit_per_user: UndefinedOr[
Intervalish
] = UNDEFINED,
reason: UndefinedOr[str] = UNDEFINED,
) -> GuildThreadChannel
Create a thread in a guild channel.
Warning
Private and public threads can only be made in guild text channels, and news threads can only be made in guild news channels.
| PARAMETER | DESCRIPTION |
|---|---|
channel | Object or ID of the guild news or text channel to create a thread in. |
type | The thread type to create. TYPE: |
name | Name of the thread channel. TYPE: |
auto_archive_duration | If provided, how long the thread should remain inactive until it's archived. This should be either 60, 1440, 4320 or 10080 minutes and, as of writing, ignores the parent channel's set default_auto_archive_duration when passed as TYPE: |
invitable | If provided, whether non-moderators should be able to add other non-moderators to the thread. This only applies to private threads. TYPE: |
rate_limit_per_user | If provided, the amount of seconds a user has to wait before being able to send another message in the channel. Maximum 21600 seconds. TYPE: |
reason | If provided, the reason that will be recorded in the audit logs. Maximum of 512 characters. TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
GuildThreadChannel | The created thread channel. |
| 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). |
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. |
create_voice_event abstractmethod async #
create_voice_event(
guild: SnowflakeishOr[PartialGuild],
channel: SnowflakeishOr[PartialChannel],
name: str,
/,
start_time: datetime,
*,
description: UndefinedOr[str] = UNDEFINED,
end_time: UndefinedOr[datetime] = UNDEFINED,
image: UndefinedOr[Resourceish] = UNDEFINED,
privacy_level: int | EventPrivacyLevel = GUILD_ONLY,
reason: UndefinedOr[str] = UNDEFINED,
) -> ScheduledVoiceEvent
Create a scheduled voice event.
| PARAMETER | DESCRIPTION |
|---|---|
guild | The guild to create the event in. TYPE: |
channel | The voice channel to create the event in. TYPE: |
name | The name of the event. TYPE: |
start_time | When the event is scheduled to start. TYPE: |
description | The event's description. TYPE: |
end_time | When the event should be scheduled to end. TYPE: |
image | The event's display image. TYPE: |
privacy_level | The event's privacy level. This effects who can view and subscribe to the event. TYPE: |
reason | If provided, the reason that will be recorded in the audit logs. Maximum of 512 characters. TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
ScheduledVoiceEvent | The created scheduled voice event. |
| RAISES | DESCRIPTION |
|---|---|
BadRequestError | If any of the fields that are passed have an invalid value. |
UnauthorizedError | If you are unauthorized to make the request (invalid/missing token). |
ForbiddenError | If you are missing permissions to create the scheduled event. You need the following permissions in the target voice channel: |
NotFoundError | If the guild or event 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. |
create_voice_message abstractmethod async #
create_voice_message(
channel: SnowflakeishOr[TextableChannel],
attachment: Resourceish,
waveform: str,
duration: float,
*,
reply: UndefinedOr[
SnowflakeishOr[PartialMessage]
] = UNDEFINED,
reply_must_exist: UndefinedOr[bool] = UNDEFINED,
mentions_reply: UndefinedOr[bool] = UNDEFINED,
flags: UndefinedType | int | MessageFlag = UNDEFINED,
) -> Message
Create a voice message in the given channel.
| PARAMETER | DESCRIPTION |
|---|---|
channel | The channel to create the message in. TYPE: |
attachment | The audio attachment used as source for the voice message. This can be a resource, or string of a path on your computer or a URL. The Content-Type of the attachment has to start with Attachments can be passed as many different things, to aid in convenience.
TYPE: |
waveform | The waveform of the entire voice message, with 1 byte per datapoint encoded in base64. Official clients sample the recording at most once per 100 milliseconds, but will downsample so that no more than 256 datapoints are in the waveform. Note Discord states that this is implementation detail and might change without notice. You have been warned! TYPE: |
duration | The duration of the voice message in seconds. This is intended to be a float. 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_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: |
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 [hikari.messages.MessageFlag.SUPPRESS_NOTIFICATIONS]. TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
Message | The created voice message. |
| RAISES | DESCRIPTION |
|---|---|
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; if |
UnauthorizedError | If you are unauthorized to make the request (invalid/missing token). |
ForbiddenError | If you are missing the [hikari.permissions.Permissions.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 |
InternalServerError | If an internal error occurs on Discord while handling the request. |
create_webhook abstractmethod async #
create_webhook(
channel: SnowflakeishOr[WebhookChannelT],
name: str,
*,
avatar: UndefinedOr[Resourceish] = UNDEFINED,
reason: UndefinedOr[str] = UNDEFINED,
) -> IncomingWebhook
Create webhook in a channel.
| PARAMETER | DESCRIPTION |
|---|---|
channel | The channel where the webhook will be created. This may be the object or the ID of an existing channel. TYPE: |
name | The name for the webhook. This cannot be TYPE: |
avatar | If provided, the avatar for the webhook. TYPE: |
reason | If provided, the reason that will be recorded in the audit logs. Maximum of 512 characters. TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
IncomingWebhook | The created webhook. |
| RAISES | DESCRIPTION |
|---|---|
BadRequestError | If |
ForbiddenError | If you are missing the |
UnauthorizedError | If you are unauthorized to make the request (invalid/missing token). |
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. |
crosspost_message abstractmethod async #
crosspost_message(
channel: SnowflakeishOr[GuildNewsChannel],
message: SnowflakeishOr[PartialMessage],
) -> Message
Broadcast an announcement message.
| PARAMETER | DESCRIPTION |
|---|---|
channel | The object or ID of the news channel to crosspost a message in. TYPE: |
message | The object or ID of the message to crosspost. TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
Message | The message object that was crossposted. |
| RAISES | DESCRIPTION |
|---|---|
BadRequestError | If you tried to crosspost a message that has already been broadcast. |
UnauthorizedError | If you are unauthorized to make the request (invalid/missing token). |
ForbiddenError | If you try to crosspost a message by the current user without the |
NotFoundError | If the channel or message 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_all_reactions abstractmethod async #
delete_all_reactions(
channel: SnowflakeishOr[TextableChannel],
message: SnowflakeishOr[PartialMessage],
) -> None
Delete all reactions from a message.
| PARAMETER | DESCRIPTION |
|---|---|
channel | The channel where the message to delete all reactions from is. This may be the object or the ID of an existing channel. TYPE: |
message | The message to delete all reaction from. This may be the object or the ID of an existing message. TYPE: |
| RAISES | DESCRIPTION |
|---|---|
BadRequestError | If an invalid unicode emoji is given, or if the given custom emoji does not exist. |
ForbiddenError | If you are missing the |
UnauthorizedError | If you are unauthorized to make the request (invalid/missing token). |
NotFoundError | If the channel or message 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_all_reactions_for_emoji abstractmethod async #
delete_all_reactions_for_emoji(
channel: SnowflakeishOr[TextableChannel],
message: SnowflakeishOr[PartialMessage],
emoji: str | Emoji,
emoji_id: UndefinedOr[
SnowflakeishOr[CustomEmoji]
] = UNDEFINED,
) -> None
Delete all reactions for a single emoji on a given message.
| PARAMETER | DESCRIPTION |
|---|---|
channel | The channel where the message to delete the reactions from is. This may be the object or the ID of an existing channel. TYPE: |
message | The message to delete a reactions from. This may be the object or the ID of an existing message. TYPE: |
emoji | Object or name of the emoji to remove all the reactions for. |
emoji_id | ID of the custom emoji to remove all the reactions for. This should only be provided when a custom emoji's name is passed for TYPE: |
| RAISES | DESCRIPTION |
|---|---|
BadRequestError | If an invalid unicode emoji is given, or if the given custom emoji does not exist. |
ForbiddenError | If you are missing the |
UnauthorizedError | If you are unauthorized to make the request (invalid/missing token). |
NotFoundError | If the channel or message 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_application_command abstractmethod async #
delete_application_command(
application: SnowflakeishOr[PartialApplication],
command: SnowflakeishOr[PartialCommand],
guild: UndefinedOr[
SnowflakeishOr[PartialGuild]
] = UNDEFINED,
) -> None
Delete a registered application command.
| PARAMETER | DESCRIPTION |
|---|---|
application | Object or ID of the application to delete a command for. TYPE: |
command | Object or ID of the command to delete. TYPE: |
guild | Object or ID of the guild to delete a command for if this is a guild specific command. Leave this as TYPE: |
| RAISES | DESCRIPTION |
|---|---|
ForbiddenError | If you cannot access the provided application's commands. |
NotFoundError | If the provided application or command 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_application_emoji abstractmethod async #
delete_application_emoji(
application: SnowflakeishOr[PartialApplication],
emoji: SnowflakeishOr[CustomEmoji],
) -> None
Delete an application emoji.
| PARAMETER | DESCRIPTION |
|---|---|
application | The application to delete the emoji from. This can be a TYPE: |
emoji | The emoji to delete. This can be a TYPE: |
| RAISES | DESCRIPTION |
|---|---|
ForbiddenError | If you are trying to edit an emoji for an application that is not yours. |
NotFoundError | If the application or the emoji are not 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_auto_mod_rule abstractmethod async #
delete_auto_mod_rule(
guild: SnowflakeishOr[PartialGuild],
rule: SnowflakeishOr[AutoModRule],
*,
reason: UndefinedOr[str] = UNDEFINED,
) -> None
Delete an auto-moderation rule.
| PARAMETER | DESCRIPTION |
|---|---|
guild | Object or ID of the guild to delete the auto-moderation rules of. TYPE: |
rule | Object or ID of the auto-moderation rule to delete. 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 rule was 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_channel abstractmethod async #
delete_channel(
channel: SnowflakeishOr[PartialChannel],
reason: UndefinedOr[str] = UNDEFINED,
) -> 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.
| PARAMETER | DESCRIPTION |
|---|---|
channel | The channel to delete. This may be the object or the ID of an existing channel. TYPE: |
reason | If provided, the reason that will be recorded in the audit logs. Maximum of 512 characters. TYPE: |
| 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. |
delete_emoji abstractmethod async #
delete_emoji(
guild: SnowflakeishOr[PartialGuild],
emoji: SnowflakeishOr[CustomEmoji],
*,
reason: UndefinedOr[str] = UNDEFINED,
) -> None
Delete an emoji in a guild.
| PARAMETER | DESCRIPTION |
|---|---|
guild | The guild to delete the emoji on. This can be a guild object or the ID of an existing guild. TYPE: |
emoji | The emoji to delete. This can be a TYPE: |
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 |
NotFoundError | If the guild or the emoji are not 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_guild abstractmethod async #
delete_guild(guild: SnowflakeishOr[PartialGuild]) -> None
Delete a guild.
| PARAMETER | DESCRIPTION |
|---|---|
guild | The guild to delete. This may be the object or the ID of an existing guild. TYPE: |
| RAISES | DESCRIPTION |
|---|---|
ForbiddenError | If you are not the owner of the guild. |
UnauthorizedError | If you are unauthorized to make the request (invalid/missing token). |
NotFoundError | If you own the guild or if you are not in it. |
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_interaction_response abstractmethod async #
delete_interaction_response(
application: SnowflakeishOr[PartialApplication],
token: str,
) -> None
Delete the initial response of an interaction.
| PARAMETER | DESCRIPTION |
|---|---|
application | Object or ID of the application to delete a command response for. TYPE: |
token | The interaction's token. TYPE: |
| 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_invite abstractmethod async #
delete_invite(
invite: InviteCode | str,
reason: UndefinedOr[str] = UNDEFINED,
) -> Invite
Delete an existing invite.
| PARAMETER | DESCRIPTION |
|---|---|
invite | The invite to delete. This may be an invite object or the code of an existing invite. TYPE: |
reason | If provided, the reason that will be recorded in the audit logs. Maximum of 512 characters. TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
Invite | Object of the invite that was deleted. |
| RAISES | DESCRIPTION |
|---|---|
ForbiddenError | If you are missing the |
UnauthorizedError | If you are unauthorized to make the request (invalid/missing token). |
NotFoundError | If the invite 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 abstractmethod async #
delete_message(
channel: SnowflakeishOr[TextableChannel],
message: SnowflakeishOr[PartialMessage],
*,
reason: UndefinedOr[str] = UNDEFINED,
) -> None
Delete a given message in a given channel.
| PARAMETER | DESCRIPTION |
|---|---|
channel | The channel to delete the message in. This may be the object or the ID of an existing channel. TYPE: |
message | The message to delete. This may be the object or the ID of an existing message. TYPE: |
reason | If provided, the reason that will be recorded in the audit logs. Maximum of 512 characters. TYPE: |
| RAISES | DESCRIPTION |
|---|---|
UnauthorizedError | If you are unauthorized to make the request (invalid/missing token). |
ForbiddenError | If you are missing the |
NotFoundError | If the channel or message 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_messages abstractmethod async #
delete_messages(
channel: SnowflakeishOr[TextableChannel],
messages: SnowflakeishOr[PartialMessage]
| Iterable[SnowflakeishOr[PartialMessage]]
| AsyncIterable[SnowflakeishOr[PartialMessage]],
/,
*other_messages: SnowflakeishOr[PartialMessage],
reason: UndefinedOr[str] = UNDEFINED,
) -> None
Bulk-delete messages from the channel.
Note
This API endpoint will only be able to delete 100 messages at a time. For anything more than this, multiple requests will be executed one-after-the-other, since the rate limits for this endpoint do not favour more than one request per bucket.
If one message is left over from chunking per 100 messages, or only one message is passed to this coroutine function, then the logic is expected to defer to delete_message. The implication of this is that the delete_message endpoint is rate limited by a different bucket with different usage rates.
Warning
This endpoint is not atomic. If an error occurs midway through a bulk delete, you will not be able to revert any changes made up to this point.
Warning
Specifying any messages more than 14 days old will cause the call to fail, potentially with partial completion.
| PARAMETER | DESCRIPTION |
|---|---|
channel | The channel to bulk delete the messages in. This may be the object or the ID of an existing channel. TYPE: |
messages | Either the object/ID of an existing message to delete or an iterable (sync or async) of the objects and/or IDs of existing messages to delete. TYPE: |
*other_messages | The objects and/or IDs of other existing messages to delete. TYPE: |
reason | If provided, the reason that will be recorded in the audit logs. Maximum of 512 characters. TYPE: |
| RAISES | DESCRIPTION |
|---|---|
BulkDeleteError | An error containing the messages successfully deleted, and the messages that were not removed. The |
delete_my_reaction abstractmethod async #
delete_my_reaction(
channel: SnowflakeishOr[TextableChannel],
message: SnowflakeishOr[PartialMessage],
emoji: str | Emoji,
emoji_id: UndefinedOr[
SnowflakeishOr[CustomEmoji]
] = UNDEFINED,
) -> None
Delete a reaction that your application user created.
| PARAMETER | DESCRIPTION |
|---|---|
channel | The channel where the message to delete the reaction from is. This may be the object or the ID of an existing channel. TYPE: |
message | The message to delete a reaction from. This may be the object or the ID of an existing message. TYPE: |
emoji | Object or name of the emoji to remove your reaction for. |
emoji_id | ID of the custom emoji to remove your reaction for. This should only be provided when a custom emoji's name is passed for TYPE: |
| RAISES | DESCRIPTION |
|---|---|
BadRequestError | If an invalid unicode emoji is given, or if the given custom emoji does not exist. |
UnauthorizedError | If you are unauthorized to make the request (invalid/missing token). |
NotFoundError | If the channel or message 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_permission_overwrite abstractmethod async #
delete_permission_overwrite(
channel: SnowflakeishOr[GuildChannel],
target: PermissionOverwrite
| PartialRole
| PartialUser
| Snowflakeish,
reason: UndefinedOr[str] = UNDEFINED,
) -> None
Delete a custom permission for an entity in a given guild channel.
| PARAMETER | DESCRIPTION |
|---|---|
channel | The channel to delete a permission overwrite in. This may be the object, or the ID of an existing channel. TYPE: |
target | The channel overwrite to delete. TYPE: |
reason | If provided, the reason that will be recorded in the audit logs. Maximum of 512 characters. TYPE: |
| 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 or the target 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_reaction abstractmethod async #
delete_reaction(
channel: SnowflakeishOr[TextableChannel],
message: SnowflakeishOr[PartialMessage],
user: SnowflakeishOr[PartialUser],
emoji: str | Emoji,
emoji_id: UndefinedOr[
SnowflakeishOr[CustomEmoji]
] = UNDEFINED,
) -> None
Delete a reaction from a message.
If you are looking to delete your own applications reaction, use delete_my_reaction.
| PARAMETER | DESCRIPTION |
|---|---|
channel | The channel where the message to delete the reaction from is. This may be the object or the ID of an existing channel. TYPE: |
message | The message to delete a reaction from. This may be the object or the ID of an existing message. TYPE: |
user | Object or ID of the user to remove the reaction of. TYPE: |
emoji | Object or name of the emoji to react with. |
emoji_id | ID of the custom emoji to react with. This should only be provided when a custom emoji's name is passed for TYPE: |
| RAISES | DESCRIPTION |
|---|---|
BadRequestError | If an invalid unicode emoji is given, or if the given custom emoji does not exist. |
ForbiddenError | If you are missing the |
UnauthorizedError | If you are unauthorized to make the request (invalid/missing token). |
NotFoundError | If the channel or message 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_role abstractmethod async #
delete_role(
guild: SnowflakeishOr[PartialGuild],
role: SnowflakeishOr[PartialRole],
reason: UndefinedOr[str] = UNDEFINED,
) -> None
Delete a role.
| PARAMETER | DESCRIPTION |
|---|---|
guild | The guild to delete the role in. This may be the object or the ID of an existing guild. TYPE: |
role | The role to delete. This may be the object or the ID of an existing role. TYPE: |
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 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. |
delete_scheduled_event abstractmethod async #
delete_scheduled_event(
guild: SnowflakeishOr[PartialGuild],
event: SnowflakeishOr[ScheduledEvent],
) -> None
Delete a scheduled event.
| PARAMETER | DESCRIPTION |
|---|---|
guild | The guild to delete the event from. TYPE: |
event | The scheduled event to delete. TYPE: |
| RAISES | DESCRIPTION |
|---|---|
UnauthorizedError | If you are unauthorized to make the request (invalid/missing token). |
ForbiddenError | If you are missing the |
NotFoundError | If the guild or event 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_stage_instance abstractmethod async #
delete_stage_instance(
channel: SnowflakeishOr[GuildStageChannel],
reason: UndefinedOr[str] = UNDEFINED,
) -> None
Delete the stage instance.
| PARAMETER | DESCRIPTION |
|---|---|
channel | The guild stage channel to fetch the stage instance from. TYPE: |
reason | If provided, the reason that will be recorded in the audit logs. Maximum of 512 characters. TYPE: |
| 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 |
RateLimitedError | Usually, Hikari will handle and retry on hitting rate-limits automatically. This includes most bucket-specific rate-limits and global rate-limits. In some rare edge cases, however, Discord implements other undocumented rules for rate-limiting, such as limits per attribute. These cannot be detected or handled normally by Hikari due to their undocumented nature, and will trigger this exception if they occur. |
InternalServerError | If an internal error occurs on Discord while handling the request. |
delete_sticker abstractmethod async #
delete_sticker(
guild: SnowflakeishOr[PartialGuild],
sticker: SnowflakeishOr[PartialSticker],
*,
reason: UndefinedOr[str] = UNDEFINED,
) -> None
Delete a sticker in a guild.
| PARAMETER | DESCRIPTION |
|---|---|
guild | The guild to delete the sticker on. This can be a guild object or the ID of an existing guild. TYPE: |
sticker | The sticker to delete. This can be a sticker object or the ID of an existing sticker. TYPE: |
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 |
NotFoundError | If the guild or the sticker are not 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_template abstractmethod async #
delete_template(
guild: SnowflakeishOr[PartialGuild],
template: str | Template,
) -> Template
Delete a guild template.
| PARAMETER | DESCRIPTION |
|---|---|
guild | The guild to delete a template in. TYPE: |
template | Object or string code of the template to delete. |
| RETURNS | DESCRIPTION |
|---|---|
Template | The deleted template's object. |
| RAISES | DESCRIPTION |
|---|---|
ForbiddenError | If you are not part of the guild. |
NotFoundError | If the guild is not found or you are missing the |
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_test_entitlement abstractmethod async #
delete_test_entitlement(
application: SnowflakeishOr[PartialApplication],
entitlement: SnowflakeishOr[Entitlement],
) -> None
Delete a test entitlement.
| PARAMETER | DESCRIPTION |
|---|---|
application | The application to delete the entitlement from. TYPE: |
entitlement | The entitlement to delete. TYPE: |
| RAISES | DESCRIPTION |
|---|---|
BadRequestError | If any of the fields that are passed have an invalid value. |
UnauthorizedError | If you are unauthorized to make the request (invalid/missing token). |
NotFoundError | If the entitlement was 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_webhook abstractmethod async #
delete_webhook(
webhook: SnowflakeishOr[PartialWebhook],
*,
token: UndefinedOr[str] = UNDEFINED,
reason: UndefinedOr[str] = UNDEFINED,
) -> None
Delete a webhook.
| PARAMETER | DESCRIPTION |
|---|---|
webhook | The webhook to delete. This may be the object or the ID of an existing webhook. TYPE: |
token | If provided, the webhook token that will be used to delete the webhook instead of the token the client was initialized with. TYPE: |
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 webhook 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_webhook_message abstractmethod async #
delete_webhook_message(
webhook: ExecutableWebhook | Snowflakeish,
token: str,
message: SnowflakeishOr[Message],
*,
thread: UndefinedType
| SnowflakeishOr[GuildThreadChannel] = UNDEFINED,
) -> None
Delete a given message in a given channel.
| PARAMETER | DESCRIPTION |
|---|---|
webhook | The webhook to execute. This may be the object or the ID of an existing webhook. TYPE: |
token | The webhook token. TYPE: |
message | The message to delete. This may be the object or the ID of an existing message. TYPE: |
thread | If provided then the message will be deleted from the target thread within the webhook's channel, otherwise it will be deleted from the webhook's target channel. This is required when trying to delete a thread message. TYPE: |
| RAISES | DESCRIPTION |
|---|---|
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_application abstractmethod async #
edit_application(
*,
description: UndefinedOr[str] = UNDEFINED,
custom_install_url: UndefinedOr[str] = UNDEFINED,
role_connections_verification_url: UndefinedOr[
str
] = UNDEFINED,
install_params: UndefinedOr[
ApplicationInstallParameters
] = UNDEFINED,
integration_types_config: UndefinedOr[
Mapping[
ApplicationIntegrationType,
ApplicationIntegrationConfiguration,
]
] = UNDEFINED,
flags: UndefinedOr[ApplicationFlags] = UNDEFINED,
icon: UndefinedNoneOr[Resourceish] = UNDEFINED,
cover_image: UndefinedNoneOr[Resourceish] = UNDEFINED,
interactions_endpoint_url: UndefinedOr[str] = UNDEFINED,
tags: UndefinedOr[Sequence[str]] = UNDEFINED,
event_webhooks_url: UndefinedOr[str] = UNDEFINED,
event_webhooks_status: UndefinedOr[
ApplicationEventWebhookStatus
] = UNDEFINED,
event_webhooks_types: UndefinedOr[
Sequence[ApplicationEventWebhookType]
] = UNDEFINED,
) -> Application
Edit the token's associated application.
Warning
This endpoint can only be used with a Bot token. Using this with a Bearer token will result in a hikari.errors.UnauthorizedError.
| PARAMETER | DESCRIPTION |
|---|---|
description | If provided, the new description of the application. TYPE: |
custom_install_url | If provided, the new default custom authorization URL of the application. TYPE: |
role_connections_verification_url | If provided, the new role connection verification URL of the application. TYPE: |
install_params | If provided, the new settings of the application's default in-app authorization link. TYPE: |
integration_types_config | If provided, the new default scopes and permissions for each installation context the application supports. TYPE: |
flags | If provided, the new public flags of the application. Only the limited intent flags ( TYPE: |
icon | If provided, the new icon of the application. If TYPE: |
cover_image | If provided, the new default rich presence invite cover image of the application. If TYPE: |
interactions_endpoint_url | If provided, the new URL the application receives interactions on. Discord validates this URL before applying it by sending a TYPE: |
tags | If provided, the new tags describing the content and functionality of the application. A maximum of 5 tags of up to 20 characters each can be set. TYPE: |
event_webhooks_url | If provided, the new URL the application receives webhook events on. TYPE: |
event_webhooks_status | If provided, the new status of the application's event webhooks: TYPE: |
event_webhooks_types | If provided, the new webhook event types the application subscribes to. TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
Application | The updated application. |
| RAISES | DESCRIPTION |
|---|---|
BadRequestError | If any of the fields that are passed have an invalid value. |
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. |
edit_application_command abstractmethod async #
edit_application_command(
application: SnowflakeishOr[PartialApplication],
command: SnowflakeishOr[PartialCommand],
guild: UndefinedOr[
SnowflakeishOr[PartialGuild]
] = UNDEFINED,
*,
name: UndefinedOr[str] = UNDEFINED,
description: UndefinedOr[str] = UNDEFINED,
options: UndefinedOr[
Sequence[CommandOption]
] = UNDEFINED,
default_member_permissions: UndefinedType
| int
| Permissions = UNDEFINED,
) -> PartialCommand
Edit a registered application command.
| PARAMETER | DESCRIPTION |
|---|---|
application | Object or ID of the application to edit a command for. TYPE: |
command | Object or ID of the command to modify. TYPE: |
guild | Object or ID of the guild to edit a command for if this is a guild specific command. Leave this as TYPE: |
name | The name to set for the command. Leave as TYPE: |
description | The description to set for the command. Leave as TYPE: |
options | A sequence of up to 10 options to set for this command. Leave this as TYPE: |
default_member_permissions | Member permissions necessary to utilize this command by default. If TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
PartialCommand | The edited command object. |
| RAISES | DESCRIPTION |
|---|---|
ForbiddenError | If you cannot access the provided application's commands. |
NotFoundError | If the provided application or command isn't found. |
BadRequestError | If any of the fields that are passed have an invalid value. |
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. |
edit_application_emoji abstractmethod async #
edit_application_emoji(
application: SnowflakeishOr[PartialApplication],
emoji: SnowflakeishOr[CustomEmoji],
name: str,
) -> KnownCustomEmoji
Edit an application emoji.
| PARAMETER | DESCRIPTION |
|---|---|
application | The application to edit the emoji on. This can be a TYPE: |
emoji | The emoji to edit. This can be a TYPE: |
name | The new name for the emoji. TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
KnownCustomEmoji | The edited emoji. |
| RAISES | DESCRIPTION |
|---|---|
BadRequestError | If any of the fields that are passed have an invalid value. |
ForbiddenError | If you are trying to edit an emoji for an application that is not yours. |
NotFoundError | If the application or the emoji are not 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. |
edit_auto_mod_rule abstractmethod async #
edit_auto_mod_rule(
guild: SnowflakeishOr[PartialGuild],
rule: SnowflakeishOr[AutoModRule],
*,
name: UndefinedOr[str] = UNDEFINED,
event_type: UndefinedOr[
AutoModEventType | int
] = UNDEFINED,
trigger: UndefinedOr[AutoModTriggerBuilder] = UNDEFINED,
actions: UndefinedOr[
Sequence[AutoModActionBuilder]
] = UNDEFINED,
enabled: UndefinedOr[bool] = UNDEFINED,
exempt_roles: UndefinedOr[
SnowflakeishSequence[PartialRole]
] = UNDEFINED,
exempt_channels: UndefinedOr[
SnowflakeishSequence[PartialChannel]
] = UNDEFINED,
reason: UndefinedOr[str] = UNDEFINED,
) -> AutoModRule
Edit an auto-moderation rule.
| PARAMETER | DESCRIPTION |
|---|---|
guild | Object or ID of the guild to edit an auto-moderation rule in. TYPE: |
rule | Object or ID of the auto-moderation rule to edit. TYPE: |
name | If specified, the rule's new name. TYPE: |
event_type | The type of user content creation event this rule should trigger on. TYPE: |
trigger | The trigger builder to edit the trigger from. TYPE: |
actions | If specified, a sequence of the actions to execute when this rule is triggered. TYPE: |
enabled | If specified, whether this auto-moderation rule should be enabled. TYPE: |
exempt_channels | If specified, a sequence of up to 50 objects and IDs of channels which are not effected by the rule. TYPE: |
exempt_roles | If specified, a sequence of up to 20 objects and IDs of roles which are not effected by the rule. TYPE: |
reason | If provided, the reason that will be recorded in the audit logs. Maximum of 512 characters. TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
AutoModRule | The created auto-moderation rule. |
| 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 was 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_channel abstractmethod async #
edit_channel(
channel: SnowflakeishOr[GuildChannel],
/,
*,
name: UndefinedOr[str] = UNDEFINED,
flags: UndefinedOr[ChannelFlag] = UNDEFINED,
position: UndefinedOr[int] = UNDEFINED,
topic: UndefinedOr[str] = UNDEFINED,
nsfw: UndefinedOr[bool] = UNDEFINED,
bitrate: UndefinedOr[int] = UNDEFINED,
video_quality_mode: UndefinedOr[
VideoQualityMode | int
] = UNDEFINED,
user_limit: UndefinedOr[int] = UNDEFINED,
rate_limit_per_user: UndefinedOr[
Intervalish
] = UNDEFINED,
region: UndefinedNoneOr[VoiceRegion | str] = UNDEFINED,
permission_overwrites: UndefinedOr[
Sequence[PermissionOverwrite]
] = UNDEFINED,
parent_category: UndefinedOr[
SnowflakeishOr[GuildCategory]
] = UNDEFINED,
default_auto_archive_duration: UndefinedOr[
Intervalish
] = UNDEFINED,
default_thread_rate_limit_per_user: UndefinedOr[
Intervalish
] = UNDEFINED,
default_forum_layout: UndefinedOr[
ForumLayoutType | int
] = UNDEFINED,
default_sort_order: UndefinedOr[
ForumSortOrderType | int
] = UNDEFINED,
available_tags: UndefinedOr[
Sequence[ForumTag]
] = UNDEFINED,
default_reaction_emoji: str
| Emoji
| UndefinedType
| Snowflake
| None = UNDEFINED,
archived: UndefinedOr[bool] = UNDEFINED,
locked: UndefinedOr[bool] = UNDEFINED,
invitable: UndefinedOr[bool] = UNDEFINED,
auto_archive_duration: UndefinedOr[
Intervalish
] = UNDEFINED,
applied_tags: UndefinedOr[
SnowflakeishSequence[ForumTag]
] = UNDEFINED,
reason: UndefinedOr[str] = UNDEFINED,
) -> PartialChannel
Edit a channel.
| PARAMETER | DESCRIPTION |
|---|---|
channel | The channel to edit. This may be the object or the ID of an existing channel. TYPE: |
name | If provided, the new name for the channel. TYPE: |
flags | If provided, the new channel flags to use for the channel. This can only be used on a forum or media channel to apply TYPE: |
position | If provided, the new position for the channel. TYPE: |
topic | If provided, the new topic for the channel. TYPE: |
nsfw | If provided, whether the channel should be marked as NSFW or not. TYPE: |
bitrate | If provided, the new bitrate for the channel. TYPE: |
video_quality_mode | If provided, the new video quality mode for the channel. TYPE: |
user_limit | If provided, the new user limit in the channel. TYPE: |
rate_limit_per_user | If provided, the new rate limit per user in the channel. TYPE: |
region | If provided, the voice region to set for this channel. Passing TYPE: |
permission_overwrites | If provided, the new permission overwrites for the channel. TYPE: |
parent_category | If provided, the new guild category for the channel. TYPE: |
default_auto_archive_duration | If provided, the auto archive duration Discord's end user client should default to when creating threads in this channel. This should be either 60, 1440, 4320 or 10080 minutes and, as of writing, ignores the parent channel's set default_auto_archive_duration when passed as TYPE: |
default_thread_rate_limit_per_user | If provided, the ratelimit that should be set in threads derived from this channel. This only applies to forum and media channels. TYPE: |
default_forum_layout | If provided, the default forum layout to show in the client. TYPE: |
default_sort_order | If provided, the default sort order to show in the client. TYPE: |
available_tags | If provided, the new available tags to select from when creating a thread. This only applies to forum and media channels. TYPE: |
default_reaction_emoji | If provided, the new default reaction emoji for threads created in a forum or media channel. This only applies to forum and media channels. TYPE: |
archived | If provided, the new archived state for the thread. This only applies to threads. TYPE: |
locked | If provided, the new locked state for the thread. This only applies to threads. If it's locked then only people with TYPE: |
invitable | If provided, the new setting for whether non-moderators can invite new members to a private thread. This only applies to threads. TYPE: |
auto_archive_duration | If provided, the new auto archive duration for this thread. This only applies to threads. This should be either 60, 1440, 4320 or 10080 minutes, as of writing. TYPE: |
applied_tags | If provided, the new tags to apply to the thread. This only applies to threads in a forum or media channel. TYPE: |
reason | If provided, the reason that will be recorded in the audit logs. Maximum of 512 characters. TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
PartialChannel | The edited channel. |
| RAISES | DESCRIPTION |
|---|---|
BadRequestError | If any of the fields that are passed have an invalid value. |
UnauthorizedError | If you are unauthorized to make the request (invalid/missing token). |
ForbiddenError | If you are missing permissions to edit the channel. |
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. |
edit_emoji abstractmethod async #
edit_emoji(
guild: SnowflakeishOr[PartialGuild],
emoji: SnowflakeishOr[CustomEmoji],
*,
name: UndefinedOr[str] = UNDEFINED,
roles: UndefinedOr[
SnowflakeishSequence[PartialRole]
] = UNDEFINED,
reason: UndefinedOr[str] = UNDEFINED,
) -> KnownCustomEmoji
Edit an emoji in a guild.
| PARAMETER | DESCRIPTION |
|---|---|
guild | The guild to edit the emoji on. This can be a guild object or the ID of an existing guild. TYPE: |
emoji | The emoji to edit. This can be a TYPE: |
name | If provided, the new name for the emoji. TYPE: |
roles | If provided, the new collection of roles that will be able to use this emoji. This can be a TYPE: |
reason | If provided, the reason that will be recorded in the audit logs. Maximum of 512 characters. TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
KnownCustomEmoji | The edited emoji. |
| RAISES | DESCRIPTION |
|---|---|
BadRequestError | If any of the fields that are passed have an invalid value. |
ForbiddenError | If you are missing |
NotFoundError | If the guild or the emoji are not 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. |
edit_guild abstractmethod async #
edit_guild(
guild: SnowflakeishOr[PartialGuild],
*,
name: UndefinedOr[str] = UNDEFINED,
verification_level: UndefinedOr[
GuildVerificationLevel
] = UNDEFINED,
default_message_notifications: UndefinedOr[
GuildMessageNotificationsLevel
] = UNDEFINED,
explicit_content_filter_level: UndefinedOr[
GuildExplicitContentFilterLevel
] = UNDEFINED,
afk_channel: UndefinedOr[
SnowflakeishOr[GuildVoiceChannel]
] = UNDEFINED,
afk_timeout: UndefinedOr[Intervalish] = UNDEFINED,
icon: UndefinedNoneOr[Resourceish] = UNDEFINED,
owner: UndefinedOr[
SnowflakeishOr[PartialUser]
] = UNDEFINED,
splash: UndefinedNoneOr[Resourceish] = UNDEFINED,
discovery_splash: UndefinedNoneOr[
Resourceish
] = UNDEFINED,
banner: UndefinedNoneOr[Resourceish] = UNDEFINED,
system_channel: UndefinedNoneOr[
SnowflakeishOr[GuildTextChannel]
] = UNDEFINED,
system_channel_flags: UndefinedOr[
GuildSystemChannelFlag
] = UNDEFINED,
rules_channel: UndefinedNoneOr[
SnowflakeishOr[GuildTextChannel]
] = UNDEFINED,
public_updates_channel: UndefinedNoneOr[
SnowflakeishOr[GuildTextChannel]
] = UNDEFINED,
safety_alerts_channel: UndefinedNoneOr[
SnowflakeishOr[GuildTextChannel]
] = UNDEFINED,
preferred_locale: UndefinedOr[str | Locale] = UNDEFINED,
features: UndefinedOr[
Sequence[GuildFeature]
] = UNDEFINED,
description: UndefinedNoneOr[str] = UNDEFINED,
premium_progress_bar_enabled: UndefinedOr[
bool
] = UNDEFINED,
reason: UndefinedOr[str] = UNDEFINED,
) -> RESTGuild
Edit a guild.
| PARAMETER | DESCRIPTION |
|---|---|
guild | The guild to edit. This may be the object or the ID of an existing guild. TYPE: |
name | If provided, the new name for the guild. TYPE: |
verification_level | If provided, the new verification level. TYPE: |
default_message_notifications | If provided, the new default message notifications level. TYPE: |
explicit_content_filter_level | If provided, the new explicit content filter level. TYPE: |
afk_channel | If provided, the new afk channel. Requires TYPE: |
afk_timeout | If provided, the new afk timeout. TYPE: |
icon | If provided, the new guild icon. Must be a 1024x1024 image or can be an animated gif when the guild has the TYPE: |
owner | If provided, the new guild owner. Warning You need to be the owner of the server to use this. TYPE: |
splash | If provided, the new guild splash. Must be a 16:9 image and the guild must have the TYPE: |
discovery_splash | If provided, the new guild discovery splash. Must be a 16:9 image and the guild must have the TYPE: |
banner | If provided, the new guild banner. Must be a 16:9 image and the guild must have the TYPE: |
system_channel | If provided, the new system channel. TYPE: |
system_channel_flags | If provided, the new flags controlling which messages are suppressed in the system channel. TYPE: |
rules_channel | If provided, the new rules channel. TYPE: |
public_updates_channel | If provided, the new public updates channel. TYPE: |
safety_alerts_channel | If provided, the new channel that Discord sends safety alerts to. TYPE: |
preferred_locale | If provided, the new preferred locale. TYPE: |
features | If provided, the guild features to be enabled. Features not provided will be disabled. .. warning:: At the time of writing, Discord ignores non- TYPE: |
description | If provided, the new guild description. TYPE: |
premium_progress_bar_enabled | If provided, whether the guild should display its boost progress bar. TYPE: |
reason | If provided, the reason that will be recorded in the audit logs. Maximum of 512 characters. TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
RESTGuild | The edited guild. |
| RAISES | DESCRIPTION |
|---|---|
BadRequestError | If any of the fields that are passed have an invalid value. Or you are missing the |
ForbiddenError | If you are missing the |
UnauthorizedError | If you are unauthorized to make the request (invalid/missing token). |
NotFoundError | If the guild 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. |
edit_guild_onboarding abstractmethod async #
edit_guild_onboarding(
guild: SnowflakeishOr[PartialGuild],
*,
default_channel_ids: UndefinedOr[
SnowflakeishSequence[GuildChannel]
] = UNDEFINED,
enabled: UndefinedOr[bool] = UNDEFINED,
mode: UndefinedOr[GuildOnboardingMode] = UNDEFINED,
prompts: UndefinedOr[
Sequence[GuildOnboardingPromptBuilder]
] = UNDEFINED,
reason: UndefinedOr[str] = UNDEFINED,
) -> GuildOnboarding
Edit a guilds onboarding flow.
| PARAMETER | DESCRIPTION |
|---|---|
guild | Object or ID of the guild to fetch the onboarding object for. TYPE: |
default_channel_ids | Sequence of channel ids that a user get opted into by default. TYPE: |
enabled | If the onboarding flow should be enabled in this guild. TYPE: |
mode | The onboarding mode for the guild. For further information look at TYPE: |
prompts | The prompts of the onboarding flow. For further information look at TYPE: |
reason | If provided, the reason that will be recorded in the audit logs. Maximum of 512 characters. TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
GuildOnboarding | The requested onboarding object. |
| RAISES | DESCRIPTION |
|---|---|
NotFoundError | If the guild is not 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. |
edit_interaction_response abstractmethod async #
edit_interaction_response(
application: SnowflakeishOr[PartialApplication],
token: str,
content: UndefinedNoneOr[Any] = UNDEFINED,
*,
attachment: UndefinedNoneOr[
Resourceish | Attachment
] = UNDEFINED,
attachments: UndefinedNoneOr[
Sequence[Resourceish | Attachment]
] = UNDEFINED,
component: UndefinedNoneOr[
ComponentBuilder
] = UNDEFINED,
components: UndefinedNoneOr[
Sequence[ComponentBuilder]
] = UNDEFINED,
embed: UndefinedNoneOr[Embed] = UNDEFINED,
embeds: UndefinedNoneOr[Sequence[Embed]] = UNDEFINED,
mentions_everyone: UndefinedOr[bool] = UNDEFINED,
user_mentions: UndefinedOr[
SnowflakeishSequence[PartialUser] | bool
] = UNDEFINED,
role_mentions: UndefinedOr[
SnowflakeishSequence[PartialRole] | bool
] = UNDEFINED,
) -> Message
Edit the initial response to a 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.
Also important to note that 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 |
|---|---|
application | Object or ID of the application to edit a command response for. TYPE: |
token | The interaction's token. TYPE: |
content | If provided, the message content to update with. If Any other value will be cast to a 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 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_interaction_voice_message_response abstractmethod async #
edit_interaction_voice_message_response(
application: SnowflakeishOr[PartialApplication],
token: str,
attachment: Resourceish | Attachment,
waveform: str,
duration: float,
) -> Message
Edit the initial response to a voice message.
Note
Even though this edits the initial response, this only works for editing/responding to deferred responses. Voice messages can not be edited.
| PARAMETER | DESCRIPTION |
|---|---|
application | Object or ID of the application to edit a command response for. TYPE: |
token | The interaction's token. TYPE: |
attachment | The audio attachment used as source for the voice message. This can be a resource, or string of a path on your computer or a URL. The Content-Type of the attachment has to start with TYPE: |
waveform | The waveform of the entire voice message, with 1 byte per datapoint encoded in base64. Official clients sample the recording at most once per 100 milliseconds, but will downsample so that no more than 256 datapoints are in the waveform. Note Discord states that this is implementation detail and might change without notice. You have been warned! TYPE: |
duration | The duration of the voice message in seconds. This is intended to be a float. TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
Message | The edited message. |
| RAISES | DESCRIPTION |
|---|---|
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_member abstractmethod async #
edit_member(
guild: SnowflakeishOr[PartialGuild],
user: SnowflakeishOr[PartialUser],
*,
nickname: UndefinedNoneOr[str] = UNDEFINED,
roles: UndefinedOr[
SnowflakeishSequence[PartialRole]
] = UNDEFINED,
mute: UndefinedOr[bool] = UNDEFINED,
deaf: UndefinedOr[bool] = UNDEFINED,
voice_channel: UndefinedNoneOr[
SnowflakeishOr[GuildVoiceChannel]
] = UNDEFINED,
communication_disabled_until: UndefinedNoneOr[
datetime
] = UNDEFINED,
reason: UndefinedOr[str] = UNDEFINED,
) -> Member
Edit a guild member.
| PARAMETER | DESCRIPTION |
|---|---|
guild | The guild to edit. This may be the object or the ID of an existing guild. TYPE: |
user | The user to edit. This may be the object or the ID of an existing user. TYPE: |
nickname | If provided, the new nick for the member. If Requires the TYPE: |
roles | If provided, the new roles for the member. Requires the TYPE: |
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. |
edit_message abstractmethod async #
edit_message(
channel: SnowflakeishOr[TextableChannel],
message: SnowflakeishOr[PartialMessage],
content: UndefinedOr[Any] = UNDEFINED,
*,
attachment: UndefinedNoneOr[
Resourceish | Attachment
] = UNDEFINED,
attachments: UndefinedNoneOr[
Sequence[Resourceish | Attachment]
] = UNDEFINED,
component: UndefinedNoneOr[
ComponentBuilder
] = UNDEFINED,
components: UndefinedNoneOr[
Sequence[ComponentBuilder]
] = UNDEFINED,
embed: UndefinedNoneOr[Embed] = UNDEFINED,
embeds: UndefinedNoneOr[Sequence[Embed]] = UNDEFINED,
mentions_everyone: UndefinedOr[bool] = UNDEFINED,
mentions_reply: UndefinedOr[bool] = UNDEFINED,
user_mentions: UndefinedOr[
SnowflakeishSequence[PartialUser] | bool
] = UNDEFINED,
role_mentions: UndefinedOr[
SnowflakeishSequence[PartialRole] | bool
] = UNDEFINED,
flags: UndefinedOr[MessageFlag] = UNDEFINED,
) -> Message
Edit an existing message in a given channel.
Warning
If the message was not sent by your user, the only parameter you may provide to this call is the flags parameter. Anything else will result in a hikari.errors.ForbiddenError being raised.
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.
Also important to note that 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 |
|---|---|
channel | The channel to create the message in. This may be the object or the ID of an existing channel. TYPE: |
message | The message to edit. This may be the object or the ID of an existing message. TYPE: |
content | If provided, the message content to update with. If Any other value will be cast to a 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: |
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 edited message. |
| RAISES | DESCRIPTION |
|---|---|
ValueError | 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). |
ForbiddenError | If you are missing the |
NotFoundError | If the channel or message 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. |
edit_my_member abstractmethod async #
edit_my_member(
guild: SnowflakeishOr[PartialGuild],
*,
nickname: UndefinedNoneOr[str] = UNDEFINED,
avatar: UndefinedNoneOr[Resourceish] = UNDEFINED,
banner: UndefinedNoneOr[Resourceish] = UNDEFINED,
bio: UndefinedNoneOr[str] = UNDEFINED,
reason: UndefinedOr[str] = UNDEFINED,
) -> Member
Edit the current user's member in a guild.
| PARAMETER | DESCRIPTION |
|---|---|
guild | The guild to edit the member in. This may be the object or the ID of an existing guild. TYPE: |
nickname | If provided, the new nickname for the member. If Requires the TYPE: |
avatar | If provided, the new guild specific avatar for the member. If, TYPE: |
banner | If provided, the new guild specific banner for the member. If, TYPE: |
bio | If provided, the new guild specific bio for the member. If, 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 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. |
edit_my_user abstractmethod async #
edit_my_user(
*,
username: UndefinedOr[str] = UNDEFINED,
avatar: UndefinedNoneOr[Resourceish] = UNDEFINED,
banner: UndefinedNoneOr[Resourceish] = UNDEFINED,
) -> OwnUser
Edit the token's associated user.
| PARAMETER | DESCRIPTION |
|---|---|
username | If provided, the new username. TYPE: |
avatar | If provided, the new avatar. If TYPE: |
banner | If provided, the new banner. If TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
OwnUser | The edited token's associated user. |
| RAISES | DESCRIPTION |
|---|---|
BadRequestError | If any of the fields that are passed have an invalid value. Discord also returns this on a rate limit: https://github.com/discord/discord-api-docs/issues/1462 |
UnauthorizedError | If you are unauthorized to make the request (invalid/missing token). |
InternalServerError | If an internal error occurs on Discord while handling the request. |
edit_my_voice_state abstractmethod async #
edit_my_voice_state(
guild: SnowflakeishOr[PartialGuild],
channel: SnowflakeishOr[GuildStageChannel],
*,
suppress: UndefinedOr[bool] = UNDEFINED,
request_to_speak: UndefinedType
| bool
| datetime = UNDEFINED,
) -> None
Edit the current user's voice state in a stage channel.
Note
The current user has to have already joined the target stage channel before any calls can be made to this endpoint.
| PARAMETER | DESCRIPTION |
|---|---|
guild | Object or Id of the guild to edit a voice state in. TYPE: |
channel | Object or Id of the channel to edit a voice state in. TYPE: |
suppress | If specified, whether the user should be allowed to become a speaker in the target stage channel with TYPE: |
request_to_speak | Whether to request to speak. This may be one of the following:
TYPE: |
| RAISES | DESCRIPTION |
|---|---|
BadRequestError | If you try to target a non-staging channel. |
UnauthorizedError | If you are unauthorized to make the request (invalid/missing token). |
ForbiddenError | If you are missing the |
NotFoundError | If the channel, message or voice state 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. |
edit_permission_overwrite abstractmethod async #
edit_permission_overwrite(
channel: SnowflakeishOr[GuildChannel],
target: PermissionOverwrite | PartialUser | PartialRole,
*,
allow: UndefinedOr[Permissions] = UNDEFINED,
deny: UndefinedOr[Permissions] = UNDEFINED,
reason: UndefinedOr[str] = UNDEFINED,
) -> None
edit_permission_overwrite(
channel: SnowflakeishOr[GuildChannel],
target: Snowflakeish,
*,
target_type: PermissionOverwriteType | int,
allow: UndefinedOr[Permissions] = UNDEFINED,
deny: UndefinedOr[Permissions] = UNDEFINED,
reason: UndefinedOr[str] = UNDEFINED,
) -> None
edit_permission_overwrite(
channel: SnowflakeishOr[GuildChannel],
target: Snowflakeish
| PartialUser
| PartialRole
| PermissionOverwrite,
*,
target_type: UndefinedOr[
PermissionOverwriteType | int
] = UNDEFINED,
allow: UndefinedOr[Permissions] = UNDEFINED,
deny: UndefinedOr[Permissions] = UNDEFINED,
reason: UndefinedOr[str] = UNDEFINED,
) -> None
Edit permissions for a specific entity in the given guild channel.
| PARAMETER | DESCRIPTION |
|---|---|
channel | The channel to edit a permission overwrite in. This may be the object, or the ID of an existing channel. TYPE: |
target | The channel overwrite to edit. This may be the object or the ID of an existing overwrite. TYPE: |
target_type | If provided, the type of the target to update. If unset, will attempt to get the type from TYPE: |
allow | If provided, the new value of all allowed permissions. TYPE: |
deny | If provided, the new value of all disallowed permissions. TYPE: |
reason | If provided, the reason that will be recorded in the audit logs. Maximum of 512 characters. TYPE: |
| RAISES | DESCRIPTION |
|---|---|
TypeError | If |
BadRequestError | If any of the fields that are passed have an invalid value. |
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 or the target is not found if it is a role. |
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_role abstractmethod async #
edit_role(
guild: SnowflakeishOr[PartialGuild],
role: SnowflakeishOr[PartialRole],
*,
name: UndefinedOr[str] = UNDEFINED,
permissions: UndefinedOr[Permissions] = UNDEFINED,
color: UndefinedOr[
Colorish | ColorGradient
] = UNDEFINED,
colour: UndefinedOr[
Colorish | ColorGradient
] = UNDEFINED,
hoist: UndefinedOr[bool] = UNDEFINED,
icon: UndefinedNoneOr[Resourceish] = UNDEFINED,
unicode_emoji: UndefinedNoneOr[str] = UNDEFINED,
mentionable: UndefinedOr[bool] = UNDEFINED,
reason: UndefinedOr[str] = UNDEFINED,
) -> Role
Edit a role.
| PARAMETER | DESCRIPTION |
|---|---|
guild | The guild to edit the role in. This may be the object or the ID of an existing guild. TYPE: |
role | The role to edit. This may be the object or the ID of an existing role. TYPE: |
name | If provided, the new name for the role. TYPE: |
permissions | If provided, the new permissions for the role. TYPE: |
color | If provided, the new color for the role. Passing a Gradient and holographic styles can only be used if the guild has the Note When the gradient's tertiary color is provided, the API enforces the role color to be the holographic style, which can be built with TYPE: |
colour | An alias for TYPE: |
hoist | If provided, whether to hoist the role. TYPE: |
icon | If provided, the new role icon. Must be a 64x64 image under 256kb. TYPE: |
unicode_emoji | If provided, the new unicode emoji to set as the role icon. TYPE: |
mentionable | If provided, whether to make the role mentionable. TYPE: |
reason | If provided, the reason that will be recorded in the audit logs. Maximum of 512 characters. TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
Role | The edited role. |
| RAISES | DESCRIPTION |
|---|---|
TypeError | If both |
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 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. |
edit_scheduled_event abstractmethod async #
edit_scheduled_event(
guild: SnowflakeishOr[PartialGuild],
event: SnowflakeishOr[ScheduledEvent],
/,
*,
channel: UndefinedNoneOr[
SnowflakeishOr[PartialChannel]
] = UNDEFINED,
description: UndefinedNoneOr[str] = UNDEFINED,
entity_type: UndefinedOr[
int | ScheduledEventType
] = UNDEFINED,
image: UndefinedOr[Resourceish] = UNDEFINED,
location: UndefinedOr[str] = UNDEFINED,
name: UndefinedOr[str] = UNDEFINED,
privacy_level: UndefinedOr[
int | EventPrivacyLevel
] = UNDEFINED,
start_time: UndefinedOr[datetime] = UNDEFINED,
end_time: UndefinedNoneOr[datetime] = UNDEFINED,
status: UndefinedOr[
int | ScheduledEventStatus
] = UNDEFINED,
reason: UndefinedOr[str] = UNDEFINED,
) -> ScheduledEvent
Edit a scheduled event.
| PARAMETER | DESCRIPTION |
|---|---|
guild | The guild to edit the event in. TYPE: |
event | The scheduled event to edit. TYPE: |
channel | The channel a TYPE: |
description | The event's description. TYPE: |
entity_type | The type of entity the event should target. TYPE: |
image | The event's display image. TYPE: |
location | The location of an Must be passed when changing an event to TYPE: |
name | The event's name. TYPE: |
privacy_level | The event's privacy level. This effects who can view and subscribe to the event. TYPE: |
start_time | When the event should be scheduled to start. TYPE: |
end_time | When the event should be scheduled to end. This can only be set to TYPE: |
status | The event's new status.
TYPE: |
reason | If provided, the reason that will be recorded in the audit logs. Maximum of 512 characters. TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
ScheduledEvent | The edited scheduled event. |
| RAISES | DESCRIPTION |
|---|---|
BadRequestError | If any of the fields that are passed have an invalid value. |
UnauthorizedError | If you are unauthorized to make the request (invalid/missing token). |
ForbiddenError | If you are missing permissions to edit the scheduled event. For For |
NotFoundError | If the guild or event 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. |
edit_stage_instance abstractmethod async #
edit_stage_instance(
channel: SnowflakeishOr[GuildStageChannel],
*,
topic: UndefinedOr[str] = UNDEFINED,
privacy_level: UndefinedOr[
int | StageInstancePrivacyLevel
] = UNDEFINED,
reason: UndefinedOr[str] = UNDEFINED,
) -> StageInstance
Edit the stage instance in a guild stage channel.
| PARAMETER | DESCRIPTION |
|---|---|
channel | The channel that the stage instance is associated with. TYPE: |
topic | The topic for the stage instance. TYPE: |
privacy_level | The privacy level for the stage instance. TYPE: |
reason | If provided, the reason that will be recorded in the audit logs. Maximum of 512 characters. TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
StageInstance | The edited stage instance. |
| RAISES | DESCRIPTION |
|---|---|
UnauthorizedError | If you are unauthorized to make the request (invalid/missing token or you are not a moderator of the stage instance). |
NotFoundError | If the interaction or response is not found. |
RateLimitTooLongError | Raised in the event that a rate limit occurs that is longer than |
RateLimitedError | Usually, Hikari will handle and retry on hitting rate-limits automatically. This includes most bucket-specific rate-limits and global rate-limits. In some rare edge cases, however, Discord implements other undocumented rules for rate-limiting, such as limits per attribute. These cannot be detected or handled normally by Hikari due to their undocumented nature, and will trigger this exception if they occur. |
InternalServerError | If an internal error occurs on Discord while handling the request. |
edit_sticker abstractmethod async #
edit_sticker(
guild: SnowflakeishOr[PartialGuild],
sticker: SnowflakeishOr[PartialSticker],
*,
name: UndefinedOr[str] = UNDEFINED,
description: UndefinedOr[str] = UNDEFINED,
tag: UndefinedOr[str] = UNDEFINED,
reason: UndefinedOr[str] = UNDEFINED,
) -> GuildSticker
Edit a sticker in a guild.
| PARAMETER | DESCRIPTION |
|---|---|
guild | The guild to edit the sticker on. This can be a guild object or the ID of an existing guild. TYPE: |
sticker | The sticker to edit. This can be a sticker object or the ID of an existing sticker. TYPE: |
name | If provided, the new name for the sticker. TYPE: |
description | If provided, the new description for the sticker. TYPE: |
tag | If provided, the new sticker tag. TYPE: |
reason | If provided, the reason that will be recorded in the audit logs. Maximum of 512 characters. TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
GuildSticker | The edited sticker. |
| RAISES | DESCRIPTION |
|---|---|
BadRequestError | If any of the fields that are passed have an invalid value. |
ForbiddenError | If you are missing |
NotFoundError | If the guild or the sticker are not 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. |
edit_template abstractmethod async #
edit_template(
guild: SnowflakeishOr[PartialGuild],
template: Template | str,
*,
name: UndefinedOr[str] = UNDEFINED,
description: UndefinedNoneOr[str] = UNDEFINED,
) -> Template
Modify a guild template.
| PARAMETER | DESCRIPTION |
|---|---|
guild | The guild to edit a template in. TYPE: |
template | Object or string code of the template to modify. |
name | The name to set for this template. TYPE: |
description | The description to set for the template. TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
Template | The object of the edited template. |
| RAISES | DESCRIPTION |
|---|---|
ForbiddenError | If you are not part of the guild. |
NotFoundError | If the guild is not found or you are missing the |
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. |
edit_voice_state abstractmethod async #
edit_voice_state(
guild: SnowflakeishOr[PartialGuild],
channel: SnowflakeishOr[GuildStageChannel],
user: SnowflakeishOr[PartialUser],
*,
suppress: UndefinedOr[bool] = UNDEFINED,
) -> None
Edit an existing voice state in a stage channel.
Note
The target user must already be present in the stage channel before any calls are made to this endpoint.
| PARAMETER | DESCRIPTION |
|---|---|
guild | Object or ID of the guild to edit a voice state in. TYPE: |
channel | Object or ID of the channel to edit a voice state in. TYPE: |
user | Object or ID of the user to edit the voice state of. TYPE: |
suppress | If defined, whether the user should be allowed to become a speaker in the target stage channel. TYPE: |
| RAISES | DESCRIPTION |
|---|---|
BadRequestError | If you try to target a non-staging channel. |
UnauthorizedError | If you are unauthorized to make the request (invalid/missing token). |
ForbiddenError | If you are missing the |
NotFoundError | If the channel, message or voice state 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. |
edit_webhook abstractmethod async #
edit_webhook(
webhook: SnowflakeishOr[PartialWebhook],
*,
token: UndefinedOr[str] = UNDEFINED,
name: UndefinedOr[str] = UNDEFINED,
avatar: UndefinedNoneOr[Resourceish] = UNDEFINED,
channel: UndefinedOr[
SnowflakeishOr[WebhookChannelT]
] = UNDEFINED,
reason: UndefinedOr[str] = UNDEFINED,
) -> PartialWebhook
Edit a webhook.
| PARAMETER | DESCRIPTION |
|---|---|
webhook | The webhook to edit. This may be the object or the ID of an existing webhook. TYPE: |
token | If provided, the webhook token that will be used to edit the webhook instead of the token the client was initialized with. TYPE: |
name | If provided, the new webhook name. TYPE: |
avatar | If provided, the new webhook avatar. If TYPE: |
channel | If provided, the text channel to move the webhook to. TYPE: |
reason | If provided, the reason that will be recorded in the audit logs. Maximum of 512 characters. TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
PartialWebhook | The edited webhook. |
| RAISES | DESCRIPTION |
|---|---|
ForbiddenError | If you are missing the |
UnauthorizedError | If you are unauthorized to make the request (invalid/missing token). |
NotFoundError | If the webhook 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. |
edit_webhook_message abstractmethod async #
edit_webhook_message(
webhook: ExecutableWebhook | Snowflakeish,
token: str,
message: SnowflakeishOr[Message],
content: UndefinedNoneOr[Any] = UNDEFINED,
*,
thread: UndefinedType
| SnowflakeishOr[GuildThreadChannel] = UNDEFINED,
attachment: UndefinedNoneOr[
Resourceish | Attachment
] = UNDEFINED,
attachments: UndefinedNoneOr[
Sequence[Resourceish | Attachment]
] = UNDEFINED,
component: UndefinedNoneOr[
ComponentBuilder
] = UNDEFINED,
components: UndefinedNoneOr[
Sequence[ComponentBuilder]
] = UNDEFINED,
embed: UndefinedNoneOr[Embed] = UNDEFINED,
embeds: UndefinedNoneOr[Sequence[Embed]] = UNDEFINED,
mentions_everyone: UndefinedOr[bool] = UNDEFINED,
user_mentions: UndefinedOr[
SnowflakeishSequence[PartialUser] | bool
] = UNDEFINED,
role_mentions: UndefinedOr[
SnowflakeishSequence[PartialRole] | bool
] = 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.
Also important to note that 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 |
|---|---|
webhook | The webhook to execute. This may be the object or the ID of an existing webhook. TYPE: |
token | The webhook token. TYPE: |
message | The message to delete. This may be the object or the ID of an existing message. TYPE: |
content | If provided, the message content to update with. If Any other value will be cast to a If this is a TYPE: |
thread | If provided then the message will be edited in the target thread within the webhook's channel, otherwise it will be edited in the webhook's target channel. This is required when trying to edit a thread message. 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, 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 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 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_welcome_screen abstractmethod async #
edit_welcome_screen(
guild: SnowflakeishOr[PartialGuild],
*,
description: UndefinedNoneOr[str] = UNDEFINED,
enabled: UndefinedOr[bool] = UNDEFINED,
channels: UndefinedNoneOr[
Sequence[WelcomeChannel]
] = UNDEFINED,
) -> WelcomeScreen
Edit the welcome screen of a community guild.
| PARAMETER | DESCRIPTION |
|---|---|
guild | ID or object of the guild to edit the welcome screen for. TYPE: |
description | If provided, the description to set for the guild's welcome screen. This may be TYPE: |
enabled | If provided, Whether the guild's welcome screen should be enabled. TYPE: |
channels | If provided, a sequence of up to 5 public channels to set in this guild's welcome screen. This may be passed as Note Custom emojis may only be included in a guild's welcome channels if it's boost status is tier 2 or above. TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
WelcomeScreen | The edited guild welcome screen. |
| RAISES | DESCRIPTION |
|---|---|
BadRequestError | If more than 5 welcome channels are provided or if a custom emoji is included on a welcome channel in a guild that doesn't have tier 2 of above boost status or if a private channel is included as a welcome channel. |
ForbiddenError | If you are missing the |
NotFoundError | If the guild is not 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. |
edit_widget abstractmethod async #
edit_widget(
guild: SnowflakeishOr[PartialGuild],
*,
channel: UndefinedNoneOr[
SnowflakeishOr[GuildChannel]
] = UNDEFINED,
enabled: UndefinedOr[bool] = UNDEFINED,
reason: UndefinedOr[str] = UNDEFINED,
) -> GuildWidget
Fetch a guilds's widget.
| PARAMETER | DESCRIPTION |
|---|---|
guild | The guild to edit the widget in. This can be the object or the ID of an existing guild. TYPE: |
channel | If provided, the channel to set the widget to. If TYPE: |
enabled | If provided, whether to enable the widget. TYPE: |
reason | If provided, the reason that will be recorded in the audit logs. Maximum of 512 characters. TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
GuildWidget | The edited guild widget. |
| RAISES | DESCRIPTION |
|---|---|
ForbiddenError | If you are missing the |
NotFoundError | If the guild is not 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. |
end_poll abstractmethod async #
end_poll(
channel: SnowflakeishOr[TextableChannel],
message: SnowflakeishOr[PartialMessage],
) -> Message
End a poll.
| PARAMETER | DESCRIPTION |
|---|---|
channel | The channel the poll is in. TYPE: |
message | The message the poll is in. TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
Message | The message that had its poll ended. |
| RAISES | DESCRIPTION |
|---|---|
BadRequestError | If any of the fields that are passed have an invalid value. |
UnauthorizedError | If you are unauthorized to make the request (invalid/missing token). |
NotFoundError | If the entitlement was 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. |
estimate_guild_prune_count abstractmethod async #
estimate_guild_prune_count(
guild: SnowflakeishOr[PartialGuild],
*,
days: UndefinedOr[int] = UNDEFINED,
include_roles: UndefinedOr[
SnowflakeishSequence[PartialRole]
] = UNDEFINED,
) -> int
Estimate the guild prune count.
| PARAMETER | DESCRIPTION |
|---|---|
guild | The guild to estimate the guild prune count for. This may be the object or the ID of an existing guild. TYPE: |
days | If provided, number of days to count prune for. TYPE: |
include_roles | If provided, the role(s) to include. By default, this endpoint will not count users with roles. Providing roles using this attribute will make members with the specified roles also get included into the count. TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
int | The estimated guild prune count. |
| RAISES | DESCRIPTION |
|---|---|
BadRequestError | If any of the fields that are passed have an invalid value. |
UnauthorizedError | If you are unauthorized to make the request (invalid/missing token). |
ForbiddenError | If you are missing the |
NotFoundError | If the guild 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. |
execute_webhook abstractmethod async #
execute_webhook(
webhook: ExecutableWebhook | Snowflakeish,
token: str,
content: UndefinedOr[Any] = UNDEFINED,
*,
thread: UndefinedType
| SnowflakeishOr[GuildThreadChannel] = UNDEFINED,
username: UndefinedOr[str] = UNDEFINED,
avatar_url: UndefinedType | str | URL = UNDEFINED,
attachment: UndefinedOr[Resourceish] = UNDEFINED,
attachments: UndefinedOr[
Sequence[Resourceish]
] = UNDEFINED,
component: UndefinedOr[ComponentBuilder] = UNDEFINED,
components: UndefinedOr[
Sequence[ComponentBuilder]
] = UNDEFINED,
embed: UndefinedOr[Embed] = UNDEFINED,
embeds: UndefinedOr[Sequence[Embed]] = UNDEFINED,
poll: UndefinedOr[PollBuilder] = UNDEFINED,
tts: UndefinedOr[bool] = UNDEFINED,
mentions_everyone: UndefinedOr[bool] = UNDEFINED,
user_mentions: UndefinedOr[
SnowflakeishSequence[PartialUser] | bool
] = UNDEFINED,
role_mentions: UndefinedOr[
SnowflakeishSequence[PartialRole] | bool
] = UNDEFINED,
flags: UndefinedType | int | MessageFlag = UNDEFINED,
) -> Message
Execute a webhook.
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 limited to interaction webhooks.
| PARAMETER | DESCRIPTION |
|---|---|
webhook | The webhook to execute. This may be the object or the ID of an existing webhook. TYPE: |
token | The webhook token. TYPE: |
content | If provided, the message contents. If If this is a Likewise, if this is a TYPE: |
thread | If provided then the message will be created in the target thread within the webhook's channel, otherwise it will be created in the webhook's target channel. This is required when trying to create a thread message. TYPE: |
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: |
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: |
poll | If provided, the message poll. 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: |
flags | The flags to set for this webhook message. TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
Message | The created message. |
| RAISES | DESCRIPTION |
|---|---|
ValueError | If more than 100 unique objects/entities are passed for |
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 webhook 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. |
execute_webhook_voice_message abstractmethod async #
execute_webhook_voice_message(
webhook: ExecutableWebhook | Snowflakeish,
token: str,
attachment: Resourceish,
waveform: str,
duration: float,
*,
thread: UndefinedType
| SnowflakeishOr[GuildThreadChannel] = UNDEFINED,
username: UndefinedOr[str] = UNDEFINED,
avatar_url: UndefinedType | str | URL = UNDEFINED,
flags: UndefinedType | int | MessageFlag = UNDEFINED,
) -> Message
Execute a webhook, by sending a voice 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 limited to interaction webhooks.
| PARAMETER | DESCRIPTION |
|---|---|
webhook | The webhook to execute. This may be the object or the ID of an existing webhook. TYPE: |
token | The webhook token. TYPE: |
attachment | The audio attachment used as source for the voice message. This can be a resource, or string of a path on your computer or a URL. The Content-Type of the attachment has to start with Attachments can be passed as many different things, to aid in convenience.
TYPE: |
waveform | The waveform of the entire voice message, with 1 byte per datapoint encoded in base64. Official clients sample the recording at most once per 100 milliseconds, but will downsample so that no more than 256 datapoints are in the waveform. Note Discord states that this is implementation detail and might change without notice. You have been warned! TYPE: |
duration | The duration of the voice message in seconds. This is intended to be a float. TYPE: |
thread | If provided then the message will be created in the target thread within the webhook's channel, otherwise it will be created in the webhook's target channel. This is required when trying to create a thread message. TYPE: |
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: |
flags | The flags to set for this webhook message. TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
Message | The created message. |
| RAISES | DESCRIPTION |
|---|---|
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 webhook 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_active_threads abstractmethod async #
fetch_active_threads(
guild: SnowflakeishOr[Guild],
) -> Sequence[GuildThreadChannel]
Fetch a guild's active threads.
| PARAMETER | DESCRIPTION |
|---|---|
guild | Object or ID of the guild to fetch the active threads of. TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
Sequence[GuildThreadChannel] | A sequence of the guild's active threads. |
| RAISES | DESCRIPTION |
|---|---|
BadRequestError | If any of the fields that are passed have an invalid value. |
ForbiddenError | If you access the guild's active threads. |
NotFoundError | If the guild doesn't exist. |
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_activity_instance abstractmethod async #
fetch_activity_instance(
application: SnowflakeishOr[PartialApplication],
instance_id: str,
) -> ActivityInstance
Fetch a live activity instance for a given application.
| PARAMETER | DESCRIPTION |
|---|---|
application | The application to fetch the activity instance for. TYPE: |
instance_id | The ID of the activity instance to fetch. TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
ActivityInstance | The requested activity instance. |
| RAISES | DESCRIPTION |
|---|---|
UnauthorizedError | If you are unauthorized to make the request (invalid/missing token). |
NotFoundError | If the application or activity instance was 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_application abstractmethod async #
fetch_application() -> Application
Fetch the token's associated application.
Warning
This endpoint can only be used with a Bot token. Using this with a Bearer token will result in a hikari.errors.UnauthorizedError.
| RETURNS | DESCRIPTION |
|---|---|
Application | The token's associated application. |
| RAISES | DESCRIPTION |
|---|---|
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_application_command abstractmethod async #
fetch_application_command(
application: SnowflakeishOr[PartialApplication],
command: SnowflakeishOr[PartialCommand],
guild: UndefinedOr[
SnowflakeishOr[PartialGuild]
] = UNDEFINED,
) -> PartialCommand
Fetch a command set for an application.
| PARAMETER | DESCRIPTION |
|---|---|
application | Object or ID of the application to fetch a command for. TYPE: |
command | Object or ID of the command to fetch. TYPE: |
guild | Object or ID of the guild to fetch the command for. If left as TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
PartialCommand | Object of the fetched command. |
| RAISES | DESCRIPTION |
|---|---|
ForbiddenError | If you cannot access the target command. |
NotFoundError | If the command 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_application_command_permissions abstractmethod async #
fetch_application_command_permissions(
application: SnowflakeishOr[PartialApplication],
guild: SnowflakeishOr[PartialGuild],
command: SnowflakeishOr[PartialCommand],
) -> GuildCommandPermissions
Fetch the permissions registered for a specific command in a guild.
| PARAMETER | DESCRIPTION |
|---|---|
application | Object or ID of the application to fetch the command permissions for. TYPE: |
guild | Object or ID of the guild to fetch the command permissions for. TYPE: |
command | Object or ID of the command to fetch the command permissions for. TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
GuildCommandPermissions | Object of the command permissions set for the specified command. |
| RAISES | DESCRIPTION |
|---|---|
ForbiddenError | If you cannot access the provided application's commands or guild. |
NotFoundError | If the provided application or command 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_application_commands abstractmethod async #
fetch_application_commands(
application: SnowflakeishOr[PartialApplication],
guild: UndefinedOr[
SnowflakeishOr[PartialGuild]
] = UNDEFINED,
) -> Sequence[PartialCommand]
Fetch the commands set for an application.
| PARAMETER | DESCRIPTION |
|---|---|
application | Object or ID of the application to fetch the commands for. TYPE: |
guild | Object or ID of the guild to fetch the commands for. If left as TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
Sequence[PartialCommand] | A sequence of the commands declared for the provided application. This will exclusively either contain the commands set for a specific guild if |
| RAISES | DESCRIPTION |
|---|---|
ForbiddenError | If you cannot access the target guild. |
NotFoundError | If the provided application 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_application_emoji abstractmethod async #
fetch_application_emoji(
application: SnowflakeishOr[PartialApplication],
emoji: SnowflakeishOr[CustomEmoji],
) -> KnownCustomEmoji
Fetch an application emoji.
| PARAMETER | DESCRIPTION |
|---|---|
application | The application to fetch the emoji from. This can be a TYPE: |
emoji | The emoji to fetch. This can be a TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
KnownCustomEmoji | The requested application emoji. |
| RAISES | DESCRIPTION |
|---|---|
NotFoundError | If the emoji or the application is not 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. |
ForbiddenError | If you are not allowed to access the emoji from this application. |
fetch_application_emojis abstractmethod async #
fetch_application_emojis(
application: SnowflakeishOr[PartialApplication],
) -> Sequence[KnownCustomEmoji]
Fetch the emojis of an application.
| PARAMETER | DESCRIPTION |
|---|---|
application | The application to fetch the emojis from. This can be a TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
Sequence[KnownCustomEmoji] | The requested emojis. |
| RAISES | DESCRIPTION |
|---|---|
NotFoundError | If the application is not 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. |
ForbiddenError | If you are not allowed to access emojis from this application. |
fetch_application_guild_commands_permissions abstractmethod async #
fetch_application_guild_commands_permissions(
application: SnowflakeishOr[PartialApplication],
guild: SnowflakeishOr[PartialGuild],
) -> Sequence[GuildCommandPermissions]
Fetch the command permissions registered in a guild.
| PARAMETER | DESCRIPTION |
|---|---|
application | Object or ID of the application to fetch the command permissions for. TYPE: |
guild | Object or ID of the guild to fetch the command permissions for. TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
Sequence[GuildCommandPermissions] | Sequence of the guild command permissions set for the specified guild. |
| RAISES | DESCRIPTION |
|---|---|
ForbiddenError | If you cannot access the provided application's commands or guild. |
NotFoundError | If the provided application 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_application_role_connection_metadata_records abstractmethod async #
fetch_application_role_connection_metadata_records(
application: SnowflakeishOr[PartialApplication],
) -> Sequence[ApplicationRoleConnectionMetadataRecord]
Fetch the application role connection metadata records.
Note
This requires the token to have the hikari.applications.OAuth2Scope.ROLE_CONNECTIONS_WRITE scope enabled.
| PARAMETER | DESCRIPTION |
|---|---|
application | The application to fetch the application role connection metadata records for. TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
Sequence[ApplicationRoleConnectionMetadataRecord] | The requested application role connection metadata records. |
| RAISES | DESCRIPTION |
|---|---|
UnauthorizedError | If you are unauthorized to make the request (invalid/missing token). |
NotFoundError | If the application 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_audit_log abstractmethod #
fetch_audit_log(
guild: SnowflakeishOr[PartialGuild],
*,
before: UndefinedOr[
SearchableSnowflakeishOr[Unique]
] = UNDEFINED,
user: UndefinedOr[
SnowflakeishOr[PartialUser]
] = UNDEFINED,
event_type: UndefinedOr[
AuditLogEventType | int
] = UNDEFINED,
) -> LazyIterator[AuditLog]
Fetch pages of the guild's audit log.
Note
This call is not a coroutine function, it returns a special type of lazy iterator that will perform API calls as you iterate across it, thus any errors documented below will happen then.
See hikari.iterators for the full API for this iterator type.
| PARAMETER | DESCRIPTION |
|---|---|
guild | The guild to fetch the audit logs from. This can be a guild object or the ID of an existing guild. TYPE: |
before | If provided, filter to only actions before this snowflake. If you provide a datetime object, it will be transformed into a snowflake. This may be any other Discord entity that has an ID. In this case, the date the object was first created will be used. TYPE: |
user | If provided, the user to filter for. TYPE: |
event_type | If provided, the event type to filter for. TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
LazyIterator[AuditLog] | The guild's audit log. |
| 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). |
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_authorization abstractmethod async #
fetch_authorization() -> AuthorizationInformation
Fetch the token's authorization information.
Warning
This endpoint can only be used with a Bearer token. Using this with a Bot token will result in a hikari.errors.UnauthorizedError.
| RETURNS | DESCRIPTION |
|---|---|
AuthorizationInformation | The token's authorization information. |
| RAISES | DESCRIPTION |
|---|---|
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_auto_mod_rule abstractmethod async #
fetch_auto_mod_rule(
guild: SnowflakeishOr[PartialGuild],
rule: SnowflakeishOr[AutoModRule],
) -> AutoModRule
Fetch an auto-moderation rule.
| PARAMETER | DESCRIPTION |
|---|---|
guild | Object or ID of the guild to fetch the auto-moderation rules of. TYPE: |
rule | Object or ID of the auto-moderation rule to fetch. TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
AutoModRule | The fetched auto-moderation rule. |
| 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 rule was 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_auto_mod_rules abstractmethod async #
fetch_auto_mod_rules(
guild: SnowflakeishOr[PartialGuild],
) -> Sequence[AutoModRule]
Fetch a guild's auto-moderation rules.
| PARAMETER | DESCRIPTION |
|---|---|
guild | Object or ID of the guild to fetch the auto-moderation rules of. TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
Sequence[AutoModRule] | Sequence of the guild's auto-moderation rules. |
| 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 was 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_available_sticker_packs abstractmethod async #
fetch_available_sticker_packs() -> Sequence[StickerPack]
Fetch the available sticker packs.
| RETURNS | DESCRIPTION |
|---|---|
Sequence[StickerPack] | The available sticker packs. |
| RAISES | DESCRIPTION |
|---|---|
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_ban abstractmethod async #
fetch_ban(
guild: SnowflakeishOr[PartialGuild],
user: SnowflakeishOr[PartialUser],
) -> GuildBan
Fetch the guild's ban info for a user.
| PARAMETER | DESCRIPTION |
|---|---|
guild | The guild to fetch the ban from. This may be the object or the ID of an existing guild. TYPE: |
user | The user to fetch the ban of. This may be the object or the ID of an existing user. TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
GuildBan | The requested ban info. |
| RAISES | DESCRIPTION |
|---|---|
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 or if the user is not banned. |
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_bans abstractmethod #
fetch_bans(
guild: SnowflakeishOr[PartialGuild],
/,
*,
newest_first: bool = False,
start_at: UndefinedOr[
SearchableSnowflakeishOr[PartialUser]
] = UNDEFINED,
) -> LazyIterator[GuildBan]
Fetch the bans of a guild.
Note
This call is not a coroutine function, it returns a special type of lazy iterator that will perform API calls as you iterate across it. See hikari.iterators for the full API for this iterator type.
| PARAMETER | DESCRIPTION |
|---|---|
guild | The guild to fetch the bans from. This may be the object or the ID of an existing guild. TYPE: |
newest_first | Whether to fetch the newest first or the oldest first. TYPE: |
start_at | If provided, will start at this snowflake. If you provide a datetime object, it will be transformed into a snowflake. This may also be a scheduled event object object. In this case, the date the object was first created will be used. TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
LazyIterator[GuildBan] | The requested bans. |
| RAISES | DESCRIPTION |
|---|---|
ForbiddenError | If you are missing the |
UnauthorizedError | If you are unauthorized to make the request (invalid/missing token). |
NotFoundError | If the guild 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_channel abstractmethod async #
fetch_channel(
channel: SnowflakeishOr[PartialChannel],
) -> PartialChannel
Fetch a channel.
| PARAMETER | DESCRIPTION |
|---|---|
channel | The channel to fetch. This may be the object or the ID of an existing channel. TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
PartialChannel | The channel. This will be a derivative of This means that you may get one of Likewise, the You can check for these using the |
| 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. |
fetch_channel_invites abstractmethod async #
fetch_channel_invites(
channel: SnowflakeishOr[GuildChannel],
) -> Sequence[InviteWithMetadata]
Fetch all invites pointing to the given guild channel.
| PARAMETER | DESCRIPTION |
|---|---|
channel | The channel to fetch the invites from. This may be a channel object, or the ID of an existing channel. TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
Sequence[InviteWithMetadata] | The invites pointing to the given guild channel. |
| 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 in any guilds you are a member of. |
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_channel_webhooks abstractmethod async #
fetch_channel_webhooks(
channel: SnowflakeishOr[WebhookChannelT],
) -> Sequence[PartialWebhook]
Fetch all channel webhooks.
| PARAMETER | DESCRIPTION |
|---|---|
channel | The channel to fetch the webhooks for. This may be an instance of any of the classes which are valid for TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
Sequence[PartialWebhook] | The fetched webhooks. |
| 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. |
fetch_emoji abstractmethod async #
fetch_emoji(
guild: SnowflakeishOr[PartialGuild],
emoji: SnowflakeishOr[CustomEmoji],
) -> KnownCustomEmoji
Fetch a guild emoji.
| PARAMETER | DESCRIPTION |
|---|---|
guild | The guild to fetch the emoji from. This can be a guild object or the ID of an existing guild. TYPE: |
emoji | The emoji to fetch. This can be a TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
KnownCustomEmoji | The requested emoji. |
| RAISES | DESCRIPTION |
|---|---|
NotFoundError | If the guild or the emoji are not 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_entitlement abstractmethod async #
fetch_entitlement(
application: SnowflakeishOr[PartialApplication],
entitlement: SnowflakeishOr[Entitlement],
) -> Entitlement
Fetch an entitlement for a given application.
| PARAMETER | DESCRIPTION |
|---|---|
application | The application to fetch the entitlement for. TYPE: |
entitlement | The entitlement to fetch. TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
Entitlement | The requested entitlement. |
| RAISES | DESCRIPTION |
|---|---|
UnauthorizedError | If you are unauthorized to make the request (invalid/missing token). |
NotFoundError | If the entitlement was 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_entitlements abstractmethod async #
fetch_entitlements(
application: SnowflakeishOr[PartialApplication],
/,
*,
user: UndefinedOr[
SnowflakeishOr[PartialUser]
] = UNDEFINED,
guild: UndefinedOr[
SnowflakeishOr[PartialGuild]
] = UNDEFINED,
skus: UndefinedOr[
SnowflakeishSequence[SKU]
] = UNDEFINED,
before: UndefinedOr[SearchableSnowflakeish] = UNDEFINED,
after: UndefinedOr[SearchableSnowflakeish] = UNDEFINED,
limit: UndefinedOr[int] = UNDEFINED,
exclude_ended: UndefinedOr[bool] = UNDEFINED,
exclude_deleted: UndefinedOr[bool] = UNDEFINED,
) -> Sequence[Entitlement]
Fetch all entitlements for a given application, active and expired.
| PARAMETER | DESCRIPTION |
|---|---|
application | The application to fetch entitlements for. TYPE: |
user | The user to look up entitlements for. TYPE: |
guild | The guild to look up entitlements for. TYPE: |
skus | The SKUs to check entitlements for. TYPE: |
before | Retrieve entitlements before this time or ID. TYPE: |
after | Retrieve entitlements after this time or ID. TYPE: |
limit | Number of entitlements to return, 1-100, default 100. TYPE: |
exclude_ended | Whether or not ended entitlements should be omitted. Defaults to TYPE: |
exclude_deleted | Whether or not deleted entitlements should be omitted. Defaults to TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
Sequence[Entitlement] | The entitlements for the application that match the criteria. |
| RAISES | DESCRIPTION |
|---|---|
BadRequestError | If any of the fields that are passed have an invalid value. |
UnauthorizedError | If you are unauthorized to make the request (invalid/missing token). |
NotFoundError | If the guild or user was 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_gateway_bot_info abstractmethod async #
fetch_gateway_bot_info() -> GatewayBotInfo
Fetch the gateway info for the bot.
| RETURNS | DESCRIPTION |
|---|---|
GatewayBotInfo | The gateway bot information. |
| RAISES | DESCRIPTION |
|---|---|
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_gateway_url abstractmethod async #
fetch_gateway_url() -> str
Fetch the gateway url.
Note
This endpoint does not require any valid authorization.
| RAISES | DESCRIPTION |
|---|---|
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_guild abstractmethod async #
fetch_guild(
guild: SnowflakeishOr[PartialGuild],
) -> RESTGuild
Fetch a guild.
| PARAMETER | DESCRIPTION |
|---|---|
guild | The guild to fetch. This can be the object or the ID of an existing guild. TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
RESTGuild | The requested guild. |
| RAISES | DESCRIPTION |
|---|---|
ForbiddenError | If you are not part of the guild. |
NotFoundError | If the guild is not 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_guild_channels abstractmethod async #
fetch_guild_channels(
guild: SnowflakeishOr[PartialGuild],
) -> Sequence[GuildChannel]
Fetch the channels in a guild.
Warning
Starting November 16, 2026, Discord will omit any channel the application doesn't have permission to view from the response. Permission to view a channel is defined by having hikari.permissions.Permissions.VIEW_CHANNEL on it or by being connected to it if it is a voice channel. Channel categories are viewable if any of their child channels are viewable.
| PARAMETER | DESCRIPTION |
|---|---|
guild | The guild to fetch the channels from. This may be the object or the ID of an existing guild. TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
Sequence[GuildChannel] | The requested channels. |
| RAISES | DESCRIPTION |
|---|---|
UnauthorizedError | If you are unauthorized to make the request (invalid/missing token). |
NotFoundError | If the guild 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_guild_emojis abstractmethod async #
fetch_guild_emojis(
guild: SnowflakeishOr[PartialGuild],
) -> Sequence[KnownCustomEmoji]
Fetch the emojis of a guild.
| PARAMETER | DESCRIPTION |
|---|---|
guild | The guild to fetch the emojis from. This can be a guild object or the ID of an existing guild. TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
Sequence[KnownCustomEmoji] | The requested emojis. |
| RAISES | DESCRIPTION |
|---|---|
NotFoundError | If the guild is not 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_guild_invites abstractmethod async #
fetch_guild_invites(
guild: SnowflakeishOr[PartialGuild],
) -> Sequence[InviteWithMetadata] | Sequence[Invite]
Fetch the guild's invites.
| PARAMETER | DESCRIPTION |
|---|---|
guild | The guild to fetch the invites for. This may be the object or the ID of an existing guild. TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
Sequence[InviteWithMetadata] | Sequence[Invite] | The invites for the guild. Will contain the metadata if you have the |
| RAISES | DESCRIPTION |
|---|---|
ForbiddenError | If you are missing the |
UnauthorizedError | If you are unauthorized to make the request (invalid/missing token). |
NotFoundError | If the guild 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_guild_onboarding abstractmethod async #
fetch_guild_onboarding(
guild: SnowflakeishOr[PartialGuild],
) -> GuildOnboarding
Fetch a guild's onboarding object.
| PARAMETER | DESCRIPTION |
|---|---|
guild | Object or ID of the guild to fetch the onboarding object for. TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
GuildOnboarding | The requested onboarding object. |
| RAISES | DESCRIPTION |
|---|---|
NotFoundError | If the guild is not 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_guild_preview abstractmethod async #
fetch_guild_preview(
guild: SnowflakeishOr[PartialGuild],
) -> GuildPreview
Fetch a guild preview.
Note
This will only work for guilds you are a part of or are public.
| PARAMETER | DESCRIPTION |
|---|---|
guild | The guild to fetch the preview of. This can be a guild object or the ID of an existing guild. TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
GuildPreview | The requested guild preview. |
| RAISES | DESCRIPTION |
|---|---|
NotFoundError | If the guild is not found or you are not part of the guild. |
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_guild_sticker abstractmethod async #
fetch_guild_sticker(
guild: SnowflakeishOr[PartialGuild],
sticker: SnowflakeishOr[PartialSticker],
) -> GuildSticker
Fetch a guild sticker.
| PARAMETER | DESCRIPTION |
|---|---|
guild | The guild the sticker is in. This can be a guild object or the ID of an existing guild. TYPE: |
sticker | The sticker to fetch. This can be a sticker object or the ID of an existing sticker. TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
GuildSticker | The requested sticker. |
| RAISES | DESCRIPTION |
|---|---|
ForbiddenError | If you are not part of the server. |
NotFoundError | If the guild or the sticker are not 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_guild_stickers abstractmethod async #
fetch_guild_stickers(
guild: SnowflakeishOr[PartialGuild],
) -> Sequence[GuildSticker]
Fetch a standard sticker.
| PARAMETER | DESCRIPTION |
|---|---|
guild | The guild to request stickers for. This can be a guild object or the ID of an existing guild. TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
Sequence[GuildSticker] | The requested stickers. |
| RAISES | DESCRIPTION |
|---|---|
ForbiddenError | If you are not part of the server. |
NotFoundError | If the guild is not 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_guild_templates abstractmethod async #
fetch_guild_templates(
guild: SnowflakeishOr[PartialGuild],
) -> Sequence[Template]
Fetch the templates for a guild.
| PARAMETER | DESCRIPTION |
|---|---|
guild | The object or ID of the guild to get the templates for. TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
Sequence[Template] | A sequence of the found template objects. |
| RAISES | DESCRIPTION |
|---|---|
ForbiddenError | If you are not part of the guild. |
NotFoundError | If the guild is not found or are missing the |
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_guild_voice_regions abstractmethod async #
fetch_guild_voice_regions(
guild: SnowflakeishOr[PartialGuild],
) -> Sequence[VoiceRegion]
Fetch the available voice regions for a guild.
| PARAMETER | DESCRIPTION |
|---|---|
guild | The guild to fetch the voice regions for. This may be the object or the ID of an existing guild. TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
Sequence[VoiceRegion] | The available voice regions for the guild. |
| RAISES | DESCRIPTION |
|---|---|
UnauthorizedError | If you are unauthorized to make the request (invalid/missing token). |
NotFoundError | If the guild 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_guild_webhooks abstractmethod async #
fetch_guild_webhooks(
guild: SnowflakeishOr[PartialGuild],
) -> Sequence[PartialWebhook]
Fetch all guild webhooks.
| PARAMETER | DESCRIPTION |
|---|---|
guild | The guild to fetch the webhooks for. This may be the object or the ID of an existing guild. TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
Sequence[PartialWebhook] | The fetched webhooks. |
| RAISES | DESCRIPTION |
|---|---|
UnauthorizedError | If you are unauthorized to make the request (invalid/missing token). |
ForbiddenError | If you are missing the |
NotFoundError | If the guild 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_integrations abstractmethod async #
fetch_integrations(
guild: SnowflakeishOr[PartialGuild],
) -> Sequence[Integration]
Fetch the guild's integrations.
| PARAMETER | DESCRIPTION |
|---|---|
guild | The guild to fetch the integrations for. This may be the object or the ID of an existing guild. TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
Sequence[Integration] | The integrations for the guild. |
| RAISES | DESCRIPTION |
|---|---|
ForbiddenError | If you are missing the |
UnauthorizedError | If you are unauthorized to make the request (invalid/missing token). |
NotFoundError | If the guild 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_interaction_response abstractmethod async #
fetch_interaction_response(
application: SnowflakeishOr[PartialApplication],
token: str,
) -> Message
Fetch the initial response for an interaction.
| PARAMETER | DESCRIPTION |
|---|---|
application | Object or ID of the application to fetch a command for. TYPE: |
token | Token of the interaction to get the initial response for. TYPE: |
| 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_invite abstractmethod async #
fetch_invite(
invite: InviteCode | str,
*,
with_counts: bool = True,
scheduled_event: UndefinedOr[
SnowflakeishOr[ScheduledEvent]
] = UNDEFINED,
) -> Invite
Fetch an existing invite.
| PARAMETER | DESCRIPTION |
|---|---|
invite | The invite to fetch. This may be an invite object or the code of an existing invite. TYPE: |
with_counts | Whether the invite should contain the approximate member counts. TYPE: |
scheduled_event | The scheduled event to include with the invite, if any. TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
Invite | The requested invite. |
| RAISES | DESCRIPTION |
|---|---|
UnauthorizedError | If you are unauthorized to make the request (invalid/missing token). |
NotFoundError | If the invite 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_joined_private_archived_threads abstractmethod #
fetch_joined_private_archived_threads(
channel: SnowflakeishOr[PermissibleGuildChannel],
/,
*,
before: UndefinedOr[
SearchableSnowflakeishOr[GuildThreadChannel]
] = UNDEFINED,
) -> LazyIterator[GuildPrivateThread]
Fetch the private archived threads you have joined in a channel.
Note
The exceptions on this endpoint will only be raised once the result is awaited or iterated over. Invoking this function itself will not raise anything.
| PARAMETER | DESCRIPTION |
|---|---|
channel | Object or ID of the channel to fetch the private archived threads of. |
before | If provided, fetch joined threads before this snowflake. If you provide a datetime object, it will be transformed into a snowflake. TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
LazyIterator[GuildPrivateThread] | An iterator to fetch the threads. Note This call is not a coroutine function, it returns a special type of lazy iterator that will perform API calls as you iterate across it. See |
| RAISES | DESCRIPTION |
|---|---|
UnauthorizedError | If you are unauthorized to make the request (invalid/missing token). |
ForbiddenError | If you cannot access the channel. |
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. |
fetch_member abstractmethod async #
fetch_member(
guild: SnowflakeishOr[PartialGuild],
user: SnowflakeishOr[PartialUser],
) -> Member
Fetch a guild member.
| PARAMETER | DESCRIPTION |
|---|---|
guild | The guild to get the member from. This may be the object or the ID of an existing guild. TYPE: |
user | The user to get the member for. This may be the object or the ID of an existing user. TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
Member | The requested member. |
| RAISES | DESCRIPTION |
|---|---|
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_members abstractmethod #
fetch_members(
guild: SnowflakeishOr[PartialGuild],
/,
*,
start_at: UndefinedOr[
SearchableSnowflakeishOr[PartialUser]
] = UNDEFINED,
) -> LazyIterator[Member]
Fetch the members from a guild.
Warning
This endpoint requires the [hikari.intents.Intents.GUILD_MEMBERS] intent to be enabled in the dashboard, not necessarily authenticated with it if using the gateway. If you don't have the intents you can use hikari.api.rest.RESTClient.search_members which doesn't require any intents.
Note
This call is not a coroutine function, it returns a special type of lazy iterator that will perform API calls as you iterate across it, thus any errors documented below will happen then.
See hikari.iterators for the full API for this iterator type.
| PARAMETER | DESCRIPTION |
|---|---|
guild | The guild to fetch the members of. This may be the object or the ID of an existing guild. TYPE: |
start_at | If provided, will start after this snowflake. If you provide a datetime object, it will be transformed into a snowflake. This may also be a user object. In this case, the date the object was first created will be used. TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
LazyIterator[Member] | An iterator to fetch the members. |
| RAISES | DESCRIPTION |
|---|---|
UnauthorizedError | If you are unauthorized to make the request (invalid/missing token). |
NotFoundError | If the guild 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_message abstractmethod async #
fetch_message(
channel: SnowflakeishOr[TextableChannel],
message: SnowflakeishOr[PartialMessage],
) -> Message
Fetch a specific message in the given text channel.
| PARAMETER | DESCRIPTION |
|---|---|
channel | The channel to fetch messages in. This may be the object or the ID of an existing channel. TYPE: |
message | The message to fetch. This may be the object or the ID of an existing message. TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
Message | The requested message. |
| 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 or the message is not found in the given text channel. |
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_messages abstractmethod #
fetch_messages(
channel: SnowflakeishOr[TextableChannel],
*,
before: UndefinedOr[
SearchableSnowflakeishOr[Unique]
] = UNDEFINED,
after: UndefinedOr[
SearchableSnowflakeishOr[Unique]
] = UNDEFINED,
around: UndefinedOr[
SearchableSnowflakeishOr[Unique]
] = UNDEFINED,
) -> LazyIterator[Message]
Browse the message history for a given text channel.
Note
This call is not a coroutine function, it returns a special type of lazy iterator that will perform API calls as you iterate across it, thus any errors documented below will happen then.
See hikari.iterators for the full API for this iterator type.
| PARAMETER | DESCRIPTION |
|---|---|
channel | The channel to fetch messages in. This may be the object or the ID of an existing channel. TYPE: |
before | If provided, fetch messages before this snowflake. If you provide a datetime object, it will be transformed into a snowflake. This may be any other Discord entity that has an ID. In this case, the date the object was first created will be used. TYPE: |
after | If provided, fetch messages after this snowflake. If you provide a datetime object, it will be transformed into a snowflake. This may be any other Discord entity that has an ID. In this case, the date the object was first created will be used. TYPE: |
around | If provided, fetch messages around this snowflake. If you provide a datetime object, it will be transformed into a snowflake. This may be any other Discord entity that has an ID. In this case, the date the object was first created will be used. TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
LazyIterator[Message] | An iterator to fetch the messages. |
| RAISES | DESCRIPTION |
|---|---|
TypeError | If you specify more than one of |
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. |
fetch_my_connections abstractmethod async #
fetch_my_connections() -> Sequence[OwnConnection]
Fetch the token's associated connections.
| RETURNS | DESCRIPTION |
|---|---|
OwnConnection | The token's associated connections. |
| RAISES | DESCRIPTION |
|---|---|
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_my_guilds abstractmethod #
fetch_my_guilds(
*,
newest_first: bool = False,
start_at: UndefinedOr[
SearchableSnowflakeishOr[PartialGuild]
] = UNDEFINED,
) -> LazyIterator[OwnGuild]
Fetch the token's associated guilds.
Note
This call is not a coroutine function, it returns a special type of lazy iterator that will perform API calls as you iterate across it, thus any errors documented below will happen then.
See hikari.iterators for the full API for this iterator type.
| PARAMETER | DESCRIPTION |
|---|---|
newest_first | Whether to fetch the newest first or the oldest first. TYPE: |
start_at | If provided, will start at this snowflake. If you provide a datetime object, it will be transformed into a snowflake. This may also be a guild object. In this case, the date the object was first created will be used. TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
LazyIterator[OwnGuild] | The token's associated guilds. |
| RAISES | DESCRIPTION |
|---|---|
BadRequestError | If any of the fields that are passed have an invalid value. |
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_my_member abstractmethod async #
fetch_my_member(
guild: SnowflakeishOr[PartialGuild],
) -> Member
Fetch the Oauth token's associated member in a guild.
Warning
This endpoint can only be used with a Bearer token. Using this with a Bot token will result in a hikari.errors.UnauthorizedError.
| RETURNS | DESCRIPTION |
|---|---|
Member | The associated guild member. |
| RAISES | DESCRIPTION |
|---|---|
UnauthorizedError | If you are unauthorized to make the request (invalid/missing token). |
NotFoundError | If the guild 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_my_user abstractmethod async #
fetch_my_user() -> OwnUser
Fetch the token's associated user.
| RETURNS | DESCRIPTION |
|---|---|
OwnUser | The token's associated user. |
| RAISES | DESCRIPTION |
|---|---|
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_my_user_application_role_connection abstractmethod async #
fetch_my_user_application_role_connection(
application: SnowflakeishOr[PartialApplication],
) -> OwnApplicationRoleConnection
Fetch the token's associated role connections.
Note
This requires the token to have the hikari.applications.OAuth2Scope.ROLE_CONNECTIONS_WRITE scope enabled.
| PARAMETER | DESCRIPTION |
|---|---|
application | The application to fetch the application role connections for. TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
OwnApplicationRoleConnection | The requested role connection. |
| RAISES | DESCRIPTION |
|---|---|
UnauthorizedError | If you are unauthorized to make the request (invalid/missing token). |
NotFoundError | If the application 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_my_voice_state abstractmethod async #
fetch_my_voice_state(
guild: SnowflakeishOr[PartialGuild],
) -> VoiceState
Fetch the current user's voice state.
| PARAMETER | DESCRIPTION |
|---|---|
guild | The guild to fetch the state from. This may be the object or the ID. TYPE: |
| RAISES | DESCRIPTION |
|---|---|
UnauthorizedError | If you are unauthorized to make the request (invalid/missing token). |
NotFoundError | If the channel, message or voice state 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. |
| RETURNS | DESCRIPTION |
|---|---|
VoiceState | The current user's voice state. |
fetch_pins abstractmethod #
fetch_pins(
channel: SnowflakeishOr[TextableChannel],
*,
before: UndefinedOr[datetime] = UNDEFINED,
) -> LazyIterator[PinnedMessage]
Fetch the pinned messages in this text channel.
Note
This call is not a coroutine function, it returns a special type of lazy iterator that will perform API calls as you iterate across it, thus any errors documented below will happen then.
See hikari.iterators for the full API for this iterator type.
| PARAMETER | DESCRIPTION |
|---|---|
channel | The channel to fetch pins from. This may be the object or the ID of an existing channel. TYPE: |
before | If provided, fetch pins before this time. TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
LazyIterator[PinnedMessage] | An iterator to fetch the pinned messages. |
| 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. |
fetch_poll_voters abstractmethod async #
fetch_poll_voters(
channel: SnowflakeishOr[TextableChannel],
message: SnowflakeishOr[PartialMessage],
answer_id: int,
/,
*,
after: UndefinedOr[
SnowflakeishOr[PartialUser]
] = UNDEFINED,
limit: UndefinedOr[int] = UNDEFINED,
) -> Sequence[User]
Fetch users that voted for a specific answer.
| PARAMETER | DESCRIPTION |
|---|---|
channel | The channel the poll is in. TYPE: |
message | The message the poll is in. TYPE: |
answer_id | The answers id. TYPE: |
after | The votes to collect, after this user voted. TYPE: |
limit | The amount of votes to collect. Maximum 100, default 25 TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
Sequence[User] | An sequence of Users. |
| RAISES | DESCRIPTION |
|---|---|
BadRequestError | If any of the fields that are passed have an invalid value. |
UnauthorizedError | If you are unauthorized to make the request (invalid/missing token). |
NotFoundError | If the entitlement was 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_private_archived_threads abstractmethod #
fetch_private_archived_threads(
channel: SnowflakeishOr[PermissibleGuildChannel],
/,
*,
before: UndefinedOr[datetime] = UNDEFINED,
) -> LazyIterator[GuildPrivateThread]
Fetch a channel's private archived threads.
Note
The exceptions on this endpoint will only be raised once the result is awaited or iterated over. Invoking this function itself will not raise anything.
| PARAMETER | DESCRIPTION |
|---|---|
channel | Object or ID of the channel to fetch the private archived threads of. |
before | The date to fetch threads before. This is based on the thread's TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
LazyIterator[GuildPrivateThread] | An iterator to fetch the threads. Note This call is not a coroutine function, it returns a special type of lazy iterator that will perform API calls as you iterate across it. See |
| RAISES | DESCRIPTION |
|---|---|
UnauthorizedError | If you are unauthorized to make the request (invalid/missing token). |
ForbiddenError | If you do not have |
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. |
fetch_public_archived_threads abstractmethod #
fetch_public_archived_threads(
channel: SnowflakeishOr[PermissibleGuildChannel],
/,
*,
before: UndefinedOr[datetime] = UNDEFINED,
) -> LazyIterator[GuildNewsThread | GuildPublicThread]
Fetch a channel's public archived threads.
Note
The exceptions on this endpoint will only be raised once the result is awaited or iterated over. Invoking this function itself will not raise anything.
| PARAMETER | DESCRIPTION |
|---|---|
channel | Object or ID of the channel to fetch the archived threads of. |
before | The date to fetch threads before. This is based on the thread's TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
LazyIterator[Union[GuildNewsChannel, GuildPublicThread]] | An iterator to fetch the threads. Note This call is not a coroutine function, it returns a special type of lazy iterator that will perform API calls as you iterate across it. See |
| RAISES | DESCRIPTION |
|---|---|
UnauthorizedError | If you are unauthorized to make the request (invalid/missing token). |
ForbiddenError | If you cannot access the channel. |
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. |
fetch_reactions_for_emoji abstractmethod #
fetch_reactions_for_emoji(
channel: SnowflakeishOr[TextableChannel],
message: SnowflakeishOr[PartialMessage],
emoji: str | Emoji,
emoji_id: UndefinedOr[
SnowflakeishOr[CustomEmoji]
] = UNDEFINED,
reaction_type: UndefinedOr[ReactionType] = UNDEFINED,
) -> LazyIterator[User]
Fetch reactions for an emoji from a message.
Note
This call is not a coroutine function, it returns a special type of lazy iterator that will perform API calls as you iterate across it, thus any errors documented below will happen then.
See hikari.iterators for the full API for this iterator type.
| PARAMETER | DESCRIPTION |
|---|---|
channel | The channel where the message is. This may be the object or the ID of an existing channel. TYPE: |
message | The message to fetch the reacting users from. This may be the object or the ID of an existing message. TYPE: |
emoji | Object or name of the emoji to get the reacting users for. |
emoji_id | ID of the custom emoji to get the reacting users for. This should only be provided when a custom emoji's name is passed for TYPE: |
reaction_type | If provided, the type of reaction to fetch the users for. If not provided, this defaults to normal reactions. TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
LazyIterator[User] | An iterator to fetch the users which reacted with the emoji. |
| RAISES | DESCRIPTION |
|---|---|
BadRequestError | If an invalid unicode emoji is given, or if the given custom emoji does not exist. |
UnauthorizedError | If you are unauthorized to make the request (invalid/missing token). |
NotFoundError | If the channel or message 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_role abstractmethod async #
fetch_role(
guild: SnowflakeishOr[PartialGuild],
role: SnowflakeishOr[PartialRole],
) -> Role
Fetch a single role of a guild.
| PARAMETER | DESCRIPTION |
|---|---|
guild | The guild to fetch the role from. This may be the object or the ID of an existing guild. TYPE: |
role | The role to fetch. This may be the object or the ID of an existing role. TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
Role | The requested role. |
| RAISES | DESCRIPTION |
|---|---|
UnauthorizedError | If you are unauthorized to make the request (invalid/missing token). |
NotFoundError | If the guild or the role 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_role_member_counts abstractmethod async #
fetch_role_member_counts(
guild: SnowflakeishOr[PartialGuild],
) -> Mapping[Snowflake, int]
Fetch role member counts.
Fetch the member counts for each role.
| PARAMETER | DESCRIPTION |
|---|---|
guild | The guild to fetch the roles from. This may be the object or the ID of an existing guild. TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
Mapping[Snowflake, int] | A mapping of role ID's to their member count. |
| RAISES | DESCRIPTION |
|---|---|
UnauthorizedError | If you are unauthorized to make the request (invalid/missing token). |
NotFoundError | If the guild was 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 abstractmethod async #
fetch_roles(
guild: SnowflakeishOr[PartialGuild],
) -> Sequence[Role]
Fetch the roles of a guild.
| PARAMETER | DESCRIPTION |
|---|---|
guild | The guild to fetch the roles from. This may be the object or the ID of an existing guild. TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
Sequence[Role] | The requested roles. |
| RAISES | DESCRIPTION |
|---|---|
UnauthorizedError | If you are unauthorized to make the request (invalid/missing token). |
NotFoundError | If the guild 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_scheduled_event abstractmethod async #
fetch_scheduled_event(
guild: SnowflakeishOr[PartialGuild],
event: SnowflakeishOr[ScheduledEvent],
) -> ScheduledEvent
Fetch a scheduled event.
| PARAMETER | DESCRIPTION |
|---|---|
guild | The guild the event bellongs to. This may be the object or the ID of an existing guild. TYPE: |
event | The event to fetch. This may be the object or the ID of an existing event. TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
ScheduledEvent | The scheduled event. |
| RAISES | DESCRIPTION |
|---|---|
UnauthorizedError | If you are unauthorized to make the request (invalid/missing token). |
ForbiddenError | If you are missing the permission needed to view this event. For |
NotFoundError | If the guild or event 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_scheduled_event_users abstractmethod #
fetch_scheduled_event_users(
guild: SnowflakeishOr[PartialGuild],
event: SnowflakeishOr[ScheduledEvent],
/,
*,
newest_first: bool = False,
start_at: UndefinedOr[
SearchableSnowflakeishOr[PartialUser]
] = UNDEFINED,
) -> LazyIterator[ScheduledEventUser]
Asynchronously iterate over the users who're subscribed to a scheduled event.
Note
This call is not a coroutine function, it returns a special type of lazy iterator that will perform API calls as you iterate across it, thus any errors documented below will happen then.
See hikari.iterators for the full API for this iterator type.
| PARAMETER | DESCRIPTION |
|---|---|
guild | The guild to fetch the scheduled event users from. TYPE: |
event | The scheduled event to fetch the subscribed users for. TYPE: |
newest_first | Whether to fetch the newest first or the oldest first. TYPE: |
start_at | If provided, will start at this snowflake. If you provide a datetime object, it will be transformed into a snowflake. This may also be a scheduled event object object. In this case, the date the object was first created will be used. TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
LazyIterator[ScheduledEventUser] | The token's associated guilds. |
| RAISES | DESCRIPTION |
|---|---|
BadRequestError | If any of the fields that are passed have an invalid value. |
UnauthorizedError | If you are unauthorized to make the request (invalid/missing token). |
NotFoundError | If the guild or event was 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_scheduled_events abstractmethod async #
fetch_scheduled_events(
guild: SnowflakeishOr[PartialGuild],
) -> Sequence[ScheduledEvent]
Fetch the scheduled events for a guild.
Note
VOICE and STAGE_CHANNEL events are only included if the bot has VOICE or STAGE_CHANNEL permissions in the associated channel.
| PARAMETER | DESCRIPTION |
|---|---|
guild | Object or ID of the guild to fetch scheduled events for. TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
Sequence[ScheduledEvent] | Sequence of the scheduled events. |
| RAISES | DESCRIPTION |
|---|---|
UnauthorizedError | If you are unauthorized to make the request (invalid/missing token). |
NotFoundError | If the guild 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_skus abstractmethod async #
fetch_skus(
application: SnowflakeishOr[PartialApplication],
) -> Sequence[SKU]
Fetch all SKUs for a given application.
Because of how Discord's SKU and subscription systems work, you will see two SKUs for your premium offering.
For integration and testing entitlements, you should use the SKU with type: hikari.monetization.SKUType.SUBSCRIPTION.
| PARAMETER | DESCRIPTION |
|---|---|
application | The application to fetch SKUs for. TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
Sequence[SKU] | The SKUs for the application. |
BadRequestError | If any of the fields that are passed have an invalid value. |
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_stage_instance abstractmethod async #
fetch_stage_instance(
channel: SnowflakeishOr[GuildStageChannel],
) -> StageInstance
Fetch the stage instance associated with a guild stage channel.
| PARAMETER | DESCRIPTION |
|---|---|
channel | The guild stage channel to fetch the stage instance from. TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
StageInstance | The stage instance associated with the guild stage channel. |
| RAISES | DESCRIPTION |
|---|---|
UnauthorizedError | If you are unauthorized to make the request (invalid/missing token). |
NotFoundError | If the stage instance or channel is not found. |
RateLimitTooLongError | Raised in the event that a rate limit occurs that is longer than |
RateLimitedError | Usually, Hikari will handle and retry on hitting rate-limits automatically. This includes most bucket-specific rate-limits and global rate-limits. In some rare edge cases, however, Discord implements other undocumented rules for rate-limiting, such as limits per attribute. These cannot be detected or handled normally by Hikari due to their undocumented nature, and will trigger this exception if they occur. |
InternalServerError | If an internal error occurs on Discord while handling the request. |
fetch_sticker abstractmethod async #
fetch_sticker(
sticker: SnowflakeishOr[PartialSticker],
) -> GuildSticker | StandardSticker
Fetch a sticker.
| PARAMETER | DESCRIPTION |
|---|---|
sticker | The sticker to fetch. This can be a sticker object or the ID of an existing sticker. TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
Union[GuildSticker, StandardSticker] | The requested sticker. |
| RAISES | DESCRIPTION |
|---|---|
NotFoundError | If the sticker is not 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_sticker_pack abstractmethod async #
fetch_sticker_pack(
sticker_pack: SnowflakeishOr[StickerPack],
) -> StickerPack
Fetch a sticker pack.
| PARAMETER | DESCRIPTION |
|---|---|
sticker_pack | The sticker pack to fetch. This can be a sticker pack object or the ID of an existing sticker pack. TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
StickerPack | The requested sticker pack. |
| RAISES | DESCRIPTION |
|---|---|
NotFoundError | If the sticker pack is not 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_template abstractmethod async #
Fetch a guild template.
| PARAMETER | DESCRIPTION |
|---|---|
template | The object or string code of the template to fetch. |
| RETURNS | DESCRIPTION |
|---|---|
Template | The object of the found template. |
| RAISES | DESCRIPTION |
|---|---|
NotFoundError | If the template was not 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_thread_member abstractmethod async #
fetch_thread_member(
channel: SnowflakeishOr[GuildThreadChannel],
user: SnowflakeishOr[PartialUser],
) -> ThreadMember
Fetch a thread member.
| PARAMETER | DESCRIPTION |
|---|---|
channel | Object or ID of the thread channel to fetch the member of. TYPE: |
user | Object or ID of the user to fetch the thread member of. TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
ThreadMember | The thread member. |
| RAISES | DESCRIPTION |
|---|---|
BadRequestError | If any of the fields that are passed have an invalid value. |
ForbiddenError | If you access the thread. |
NotFoundError | If the thread channel or member doesn't exist. |
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_thread_members abstractmethod #
fetch_thread_members(
channel: SnowflakeishOr[GuildThreadChannel],
/,
after: UndefinedOr[Snowflakeish] = UNDEFINED,
) -> LazyIterator[ThreadMember]
Fetch a thread's members.
Note
This call is not a coroutine function, it returns a special type of lazy iterator that will perform API calls as you iterate across it, thus any errors documented below will happen then.
See hikari.iterators for the full API for this iterator type.
| PARAMETER | DESCRIPTION |
|---|---|
channel | Object or ID of the thread channel to fetch the members of. TYPE: |
after | If provided, fetch thread members after this time. TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
LazyIterator[ThreadMember] | An iterator to fetch the thread members. |
| RAISES | DESCRIPTION |
|---|---|
BadRequestError | If any of the fields that are passed have an invalid value. |
ForbiddenError | If you access the thread. |
NotFoundError | If the thread channel doesn't exist. |
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_user abstractmethod async #
fetch_user(user: SnowflakeishOr[PartialUser]) -> User
Fetch a user.
| PARAMETER | DESCRIPTION |
|---|---|
user | The user to fetch. This can be the object or the ID of an existing user. TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
User | The requested user. |
| 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_vanity_url abstractmethod async #
fetch_vanity_url(
guild: SnowflakeishOr[PartialGuild],
) -> VanityURL
Fetch a guild's vanity url.
| PARAMETER | DESCRIPTION |
|---|---|
guild | The guild to fetch the vanity url from. This can be the object or the ID of an existing guild. TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
VanityURL | The requested invite. |
| RAISES | DESCRIPTION |
|---|---|
ForbiddenError | If you are not part of the guild. |
NotFoundError | If the guild is not 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_voice_regions abstractmethod async #
fetch_voice_regions() -> Sequence[VoiceRegion]
Fetch available voice regions.
| RETURNS | DESCRIPTION |
|---|---|
Sequence[VoiceRegion] | The available voice regions. |
| RAISES | DESCRIPTION |
|---|---|
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_voice_state abstractmethod async #
fetch_voice_state(
guild: SnowflakeishOr[PartialGuild],
user: SnowflakeishOr[PartialUser],
) -> VoiceState
Fetch the current user's voice state.
| PARAMETER | DESCRIPTION |
|---|---|
guild | The guild to fetch the state from. This may be the object or the ID. TYPE: |
user | The user to fetch the state for. This may be the object or the ID. TYPE: |
| RAISES | DESCRIPTION |
|---|---|
UnauthorizedError | If you are unauthorized to make the request (invalid/missing token). |
NotFoundError | If the channel, message or voice state 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. |
| RETURNS | DESCRIPTION |
|---|---|
VoiceState | The user's voice state. |
fetch_webhook abstractmethod async #
fetch_webhook(
webhook: SnowflakeishOr[PartialWebhook],
*,
token: UndefinedOr[str] = UNDEFINED,
) -> PartialWebhook
Fetch an existing webhook.
| PARAMETER | DESCRIPTION |
|---|---|
webhook | The webhook to fetch. This may be the object or the ID of an existing webhook. TYPE: |
token | If provided, the webhook token that will be used to fetch the webhook instead of the token the client was initialized with. TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
PartialWebhook | The requested webhook. |
| RAISES | DESCRIPTION |
|---|---|
ForbiddenError | If you are missing the |
UnauthorizedError | If you are unauthorized to make the request (invalid/missing token). |
NotFoundError | If the webhook 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_webhook_message abstractmethod async #
fetch_webhook_message(
webhook: ExecutableWebhook | Snowflakeish,
token: str,
message: SnowflakeishOr[PartialMessage],
*,
thread: UndefinedType
| SnowflakeishOr[GuildThreadChannel] = UNDEFINED,
) -> Message
Fetch an old message sent by the webhook.
| PARAMETER | DESCRIPTION |
|---|---|
webhook | The webhook to execute. This may be the object or the ID of an existing webhook. TYPE: |
token | The webhook token. TYPE: |
message | The message to fetch. This may be the object or the ID of an existing channel. TYPE: |
thread | If provided then the message will be fetched from the target thread within the webhook's channel, otherwise it will be fetched from the webhook's target channel. This is required when trying to fetch a thread message. TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
Message | The requested message. |
| RAISES | DESCRIPTION |
|---|---|
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. |
fetch_welcome_screen abstractmethod async #
fetch_welcome_screen(
guild: SnowflakeishOr[PartialGuild],
) -> WelcomeScreen
Fetch a guild's welcome screen.
| PARAMETER | DESCRIPTION |
|---|---|
guild | Object or ID of the guild to fetch the welcome screen for. TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
WelcomeScreen | The requested welcome screen. |
| RAISES | DESCRIPTION |
|---|---|
NotFoundError | If the guild is not found or the welcome screen has never been set for this guild (if the welcome screen has been set for a guild before and then disabled you should still be able to fetch it). |
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_widget abstractmethod async #
fetch_widget(
guild: SnowflakeishOr[PartialGuild],
) -> GuildWidget
Fetch a guilds's widget.
| PARAMETER | DESCRIPTION |
|---|---|
guild | The guild to fetch the widget from. This can be the object or the ID of an existing guild. TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
GuildWidget | The requested guild widget. |
| RAISES | DESCRIPTION |
|---|---|
ForbiddenError | If you are missing the |
NotFoundError | If the guild is not 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. |
follow_channel abstractmethod async #
follow_channel(
news_channel: SnowflakeishOr[GuildNewsChannel],
target_channel: SnowflakeishOr[GuildChannel],
) -> ChannelFollow
Follow a news channel to send messages to a target channel.
| PARAMETER | DESCRIPTION |
|---|---|
news_channel | The object or ID of the news channel to follow. TYPE: |
target_channel | The object or ID of the channel to target. TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
ChannelFollow | Information about the new relationship that was made. |
| RAISES | DESCRIPTION |
|---|---|
BadRequestError | If you try to follow a channel that's not a news channel or if the target channel has reached it's webhook limit, which is 10 at the time of writing. |
UnauthorizedError | If you are unauthorized to make the request (invalid/missing token). |
ForbiddenError | If you are missing the |
NotFoundError | If the origin or target 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. |
forward_message abstractmethod async #
forward_message(
channel_to: SnowflakeishOr[TextableChannel],
message: SnowflakeishOr[PartialMessage],
channel_from: UndefinedOr[
SnowflakeishOr[TextableChannel]
] = UNDEFINED,
) -> Message
Forward a message.
| PARAMETER | DESCRIPTION |
|---|---|
channel_to | The object or ID of the channel to forward the message to. TYPE: |
message | The object or ID of the message to forward. TYPE: |
channel_from | The object or ID of the message's channel of origin. This field will be ignored if the message provided is of type TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
Message | The message object that was forwarded. |
| RAISES | DESCRIPTION |
|---|---|
ValueError | If the message is of type |
UnauthorizedError | If you are unauthorized to make the request (invalid/missing token). |
ForbiddenError | If you tried to forward a message without the |
NotFoundError | If the channel or message was not found. |
RateLimitTooLongError | Raised in the event that a rate limit occurs that is longer than |
InternalServerError | If an internal error occurs on Discords side while handling the request. |
interaction_autocomplete_builder abstractmethod #
interaction_autocomplete_builder(
choices: Sequence[AutocompleteChoiceBuilder],
) -> InteractionAutocompleteBuilder
Create a builder for an autocomplete interaction response.
| PARAMETER | DESCRIPTION |
|---|---|
choices | The autocomplete choices. |
| RETURNS | DESCRIPTION |
|---|---|
InteractionAutocompleteBuilder | The autocomplete interaction response builder object. |
interaction_deferred_builder abstractmethod #
interaction_deferred_builder(
type: ResponseType | int,
) -> InteractionDeferredBuilder
Create a builder for a deferred message interaction response.
| PARAMETER | DESCRIPTION |
|---|---|
type | The type of deferred message response this builder is for. TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
InteractionDeferredBuilder | The deferred message interaction response builder object. |
interaction_message_builder abstractmethod #
interaction_message_builder(
type: ResponseType | int,
) -> InteractionMessageBuilder
Create a builder for a message interaction response.
| PARAMETER | DESCRIPTION |
|---|---|
type | The type of message response this builder is for. TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
InteractionMessageBuilder | The interaction message response builder object. |
interaction_modal_builder abstractmethod #
interaction_modal_builder(
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. |
join_thread abstractmethod async #
join_thread(
channel: SnowflakeishOr[GuildTextChannel],
) -> None
Join a thread channel.
| PARAMETER | DESCRIPTION |
|---|---|
channel | Object or ID of the thread channel to join. TYPE: |
| RAISES | DESCRIPTION |
|---|---|
BadRequestError | If any of the fields that are passed have an invalid value. |
ForbiddenError | If you cannot join this thread. |
NotFoundError | If the thread channel does not exist. |
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. |
kick_member abstractmethod async #
kick_member(
guild: SnowflakeishOr[PartialGuild],
user: SnowflakeishOr[PartialUser],
*,
reason: UndefinedOr[str] = UNDEFINED,
) -> None
Alias of hikari.api.rest.RESTClient.kick_user.
kick_user abstractmethod async #
kick_user(
guild: SnowflakeishOr[PartialGuild],
user: SnowflakeishOr[PartialUser],
*,
reason: UndefinedOr[str] = UNDEFINED,
) -> None
Kick a member from a guild.
| PARAMETER | DESCRIPTION |
|---|---|
guild | The guild to kick the member from. This may be the object or the ID of an existing guild. TYPE: |
user | The user to kick. This may be the object or the ID of an existing user. TYPE: |
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 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. |
leave_guild abstractmethod async #
leave_guild(guild: SnowflakeishOr[PartialGuild]) -> None
Leave a guild.
| PARAMETER | DESCRIPTION |
|---|---|
guild | The guild to leave. This may be the object or the ID of an existing guild. TYPE: |
| RAISES | DESCRIPTION |
|---|---|
UnauthorizedError | If you are unauthorized to make the request (invalid/missing token). |
NotFoundError | If the guild is not found or you own the guild. |
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. |
leave_thread abstractmethod async #
leave_thread(
channel: SnowflakeishOr[GuildThreadChannel],
) -> None
Leave a thread channel.
| PARAMETER | DESCRIPTION |
|---|---|
channel | Object or ID of the thread channel to leave. TYPE: |
| RAISES | DESCRIPTION |
|---|---|
BadRequestError | If any of the fields that are passed have an invalid value. |
NotFoundError | If you're not in the thread or it doesn't exist. |
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. |
pin_message abstractmethod async #
pin_message(
channel: SnowflakeishOr[TextableChannel],
message: SnowflakeishOr[PartialMessage],
) -> None
Pin an existing message in the given text channel.
| PARAMETER | DESCRIPTION |
|---|---|
channel | The channel to pin a message in. This may be the object or the ID of an existing channel. TYPE: |
message | The message to pin. This may be the object or the ID of an existing message. TYPE: |
| 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, or if the message does not exist in the given channel. |
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. |
refresh_access_token abstractmethod async #
refresh_access_token(
client: SnowflakeishOr[PartialApplication],
client_secret: str,
refresh_token: str,
*,
scopes: UndefinedOr[
Sequence[OAuth2Scope | str]
] = UNDEFINED,
) -> OAuth2AuthorizationToken
Refresh an access token.
Warning
As of writing this Discord currently ignores any passed scopes, therefore you should use hikari.applications.OAuth2AuthorizationToken.scopes to validate that the expected scopes were actually authorized here.
| PARAMETER | DESCRIPTION |
|---|---|
client | Object or ID of the application to authorize with. TYPE: |
client_secret | Secret of the application to authorize with. TYPE: |
refresh_token | The refresh token to use. TYPE: |
scopes | The scope of the access request. TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
OAuth2AuthorizationToken | Object of the authorized OAuth2 token. |
| RAISES | DESCRIPTION |
|---|---|
BadRequestError | If an invalid redirect uri or refresh_token is passed. |
UnauthorizedError | When an client or client secret is passed. |
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. |
remove_role_from_member abstractmethod async #
remove_role_from_member(
guild: SnowflakeishOr[PartialGuild],
user: SnowflakeishOr[PartialUser],
role: SnowflakeishOr[PartialRole],
*,
reason: UndefinedOr[str] = UNDEFINED,
) -> None
Remove a role from a member.
| PARAMETER | DESCRIPTION |
|---|---|
guild | The guild where the member is in. This may be the object or the ID of an existing guild. TYPE: |
user | The user to remove the role from. This may be the object or the ID of an existing user. TYPE: |
role | The role to remove. This may be the object or the ID of an existing role. TYPE: |
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. |
remove_thread_member abstractmethod async #
remove_thread_member(
channel: SnowflakeishOr[GuildThreadChannel],
user: SnowflakeishOr[PartialUser],
) -> None
Remove a user from a thread.
| PARAMETER | DESCRIPTION |
|---|---|
channel | Object or ID of the thread channel to remove a user from. TYPE: |
user | Object or ID of the user to remove from the thread. TYPE: |
| RAISES | DESCRIPTION |
|---|---|
BadRequestError | If any of the fields that are passed have an invalid value. |
ForbiddenError | If you cannot remove this user from the thread. |
NotFoundError | If the thread channel or member doesn't exist. |
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. |
reposition_channels abstractmethod #
reposition_channels(
guild: SnowflakeishOr[PartialGuild],
positions: UndefinedOr[
Mapping[int, SnowflakeishOr[GuildChannel]]
] = UNDEFINED,
reason: UndefinedOr[str] = UNDEFINED,
) -> ChannelRepositioner
Return a hikari.api.special_endpoints.ChannelRepositioner, used to reposition channels in a guild.
See hikari.api.special_endpoints.ChannelRepositioner for more functionality on this endpoint
| PARAMETER | DESCRIPTION |
|---|---|
guild | The guild to reposition the channels in. This may be the object or the ID of an existing guild. TYPE: |
positions | A mapping of the new position to the object or the ID of an existing channel, relative to their parent category, if any. Note Instead of using the TYPE: |
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 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. |
| RETURNS | DESCRIPTION |
|---|---|
ChannelRepositioner | The channel repositioner. |
reposition_roles abstractmethod async #
reposition_roles(
guild: SnowflakeishOr[PartialGuild],
positions: Mapping[int, SnowflakeishOr[PartialRole]],
reason: UndefinedOr[str] = UNDEFINED,
) -> None
Reposition the roles in a guild.
| PARAMETER | DESCRIPTION |
|---|---|
guild | The guild to reposition the roles in. This may be the object or the ID of an existing guild. TYPE: |
positions | A mapping of the position to the role. TYPE: |
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 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. |
revoke_access_token abstractmethod async #
revoke_access_token(
client: SnowflakeishOr[PartialApplication],
client_secret: str,
token: str | PartialOAuth2Token,
) -> None
Revoke an OAuth2 token.
| PARAMETER | DESCRIPTION |
|---|---|
client | Object or ID of the application to authorize with. TYPE: |
client_secret | Secret of the application to authorize with. TYPE: |
token | Object or string of the access token to revoke. TYPE: |
| RAISES | DESCRIPTION |
|---|---|
UnauthorizedError | When an client or client secret is passed. |
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. |
search_members abstractmethod async #
search_members(
guild: SnowflakeishOr[PartialGuild], name: str
) -> Sequence[Member]
Search the members in a guild by nickname and username.
Note
Unlike hikari.api.rest.RESTClient.fetch_members this endpoint isn't paginated and therefore will return all the members in one go rather than needing to be asynchronously iterated over.
| PARAMETER | DESCRIPTION |
|---|---|
guild | The object or ID of the guild to search members in. TYPE: |
name | The query to match username(s) and nickname(s) against. TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
Sequence[Member] | A sequence of the members who matched the provided |
| RAISES | DESCRIPTION |
|---|---|
UnauthorizedError | If you are unauthorized to make the request (invalid/missing token). |
NotFoundError | If the guild 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. |
set_application_command_permissions abstractmethod async #
set_application_command_permissions(
application: SnowflakeishOr[PartialApplication],
guild: SnowflakeishOr[PartialGuild],
command: SnowflakeishOr[PartialCommand],
permissions: Sequence[CommandPermission],
) -> GuildCommandPermissions
Set permissions for a specific command.
Note
This requires the access_token to have the hikari.applications.OAuth2Scope.APPLICATIONS_COMMANDS_PERMISSION_UPDATE scope enabled along with the authorization of a Bot which has hikari.permissions.Permissions.CREATE_INSTANT_INVITE permission within the target guild.
Note
This overwrites any previously set permissions.
| PARAMETER | DESCRIPTION |
|---|---|
application | Object or ID of the application to set the command permissions for. TYPE: |
guild | Object or ID of the guild to set the command permissions for. TYPE: |
command | Object or ID of the command to set the permissions for. TYPE: |
permissions | Sequence of up to 10 of the permission objects to set. TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
GuildCommandPermissions | Object of the set permissions. |
| RAISES | DESCRIPTION |
|---|---|
ForbiddenError | If you cannot access the provided application's commands or guild. |
NotFoundError | If the provided application or command 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. |
set_application_commands abstractmethod async #
set_application_commands(
application: SnowflakeishOr[PartialApplication],
commands: Sequence[CommandBuilder],
guild: UndefinedOr[
SnowflakeishOr[PartialGuild]
] = UNDEFINED,
) -> Sequence[PartialCommand]
Set the commands for an application.
Warning
Any existing commands not included in the provided commands array will be deleted.
| PARAMETER | DESCRIPTION |
|---|---|
application | Object or ID of the application to create a command for. TYPE: |
commands | A sequence of up to 100 initialised command builder objects of the commands to set for this the application. TYPE: |
guild | Object or ID of the specific guild to set the commands for. If left as TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
Sequence[PartialCommand] | A sequence of the set command objects. |
| RAISES | DESCRIPTION |
|---|---|
ForbiddenError | If you cannot access the provided application's commands. |
NotFoundError | If the provided application isn't found. |
BadRequestError | If any of the fields that are passed have an invalid value. |
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. |
set_application_role_connection_metadata_records abstractmethod async #
set_application_role_connection_metadata_records(
application: SnowflakeishOr[PartialApplication],
records: Sequence[
ApplicationRoleConnectionMetadataRecord
],
) -> Sequence[ApplicationRoleConnectionMetadataRecord]
Set the application role connection metadata records.
Note
This requires the token to have the hikari.applications.OAuth2Scope.ROLE_CONNECTIONS_WRITE scope enabled.
| PARAMETER | DESCRIPTION |
|---|---|
application | The application to set the application role connection metadata records for. TYPE: |
records | The records to set for the application. |
| RETURNS | DESCRIPTION |
|---|---|
Sequence[ApplicationRoleConnectionMetadataRecord] | The set application role connection metadata records. |
| RAISES | DESCRIPTION |
|---|---|
BadRequestError | If incorrect values are provided for the records. |
UnauthorizedError | If you are unauthorized to make the request (invalid/missing token). |
NotFoundError | If the application 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. |
set_guild_incident_actions abstractmethod async #
set_guild_incident_actions(
guild: SnowflakeishOr[PartialGuild],
*,
invites_disabled_until: datetime | None = None,
dms_disabled_until: datetime | None = None,
) -> GuildIncidents
Set the incident actions for a guild.
Warning
This endpoint will reset any previous security measures if not specified. This is a Discord limitation.
| PARAMETER | DESCRIPTION |
|---|---|
guild | The guild to set the incident actions for. This may be the object or the ID of an existing guild. TYPE: |
invites_disabled_until | The datetime when invites will be enabled again. If Note If TYPE: |
dms_disabled_until | The datetime when direct messages between non-friend guild members will be enabled again. If TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
GuildIncidents | A guild incidents object with the updated incident actions. |
| RAISES | DESCRIPTION |
|---|---|
BadRequestError | If any of the fields that are passed have an invalid value. |
ForbiddenError | If you do not have at least one of the following permissions: - |
UnauthorizedError | If you are unauthorized to make the request (invalid/missing token). |
NotFoundError | If the guild 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. |
set_my_user_application_role_connection abstractmethod async #
set_my_user_application_role_connection(
application: SnowflakeishOr[PartialApplication],
platform_name: UndefinedOr[str] = UNDEFINED,
platform_username: UndefinedOr[str] = UNDEFINED,
metadata: UndefinedOr[
Mapping[str, str | int | bool | datetime]
] = UNDEFINED,
) -> OwnApplicationRoleConnection
Set the token's associated role connections.
Note
This requires the token to have the hikari.applications.OAuth2Scope.ROLE_CONNECTIONS_WRITE scope enabled.
| PARAMETER | DESCRIPTION |
|---|---|
application | The application to set the application role connections for. TYPE: |
platform_name | If provided, the name of the platform that will be connected. TYPE: |
platform_username | If provided, the name of the user in the platform. TYPE: |
metadata | If provided, the role connection metadata. Depending on the time of the previously created application role records through TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
OwnApplicationRoleConnection | The set role connection. |
| RAISES | DESCRIPTION |
|---|---|
BadRequestError | If incorrect values are provided or unknown keys are provided in the metadata. |
UnauthorizedError | If you are unauthorized to make the request (invalid/missing token). |
NotFoundError | If the application 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. |
slash_command_builder abstractmethod #
slash_command_builder(
name: str, description: str
) -> SlashCommandBuilder
Create a command builder to use in hikari.api.rest.RESTClient.set_application_commands.
| PARAMETER | DESCRIPTION |
|---|---|
name | The command's name. This should match the regex TYPE: |
description | The description to set for the command if this is a slash command. This should be inclusively between 1-100 characters in length. TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
SlashCommandBuilder | The created command builder object. |
sync_guild_template abstractmethod async #
sync_guild_template(
guild: SnowflakeishOr[PartialGuild],
template: str | Template,
) -> Template
Create a guild template.
| PARAMETER | DESCRIPTION |
|---|---|
guild | The guild to sync a template in. TYPE: |
template | Object or code of the template to sync. |
| RETURNS | DESCRIPTION |
|---|---|
Template | The object of the synced template. |
| RAISES | DESCRIPTION |
|---|---|
ForbiddenError | If you are not part of the guild or are missing the |
NotFoundError | If the guild or template is not 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. |
trigger_typing abstractmethod #
trigger_typing(
channel: SnowflakeishOr[TextableChannel],
) -> TypingIndicator
Trigger typing in a text channel.
Note
The result of this call can be awaited to trigger typing once, or can be used as an async context manager to continually type until the context manager is left. Any errors documented below will happen then.
Examples:
# Trigger typing just once.
await rest.trigger_typing(channel)
# Trigger typing repeatedly for 1 minute.
async with rest.trigger_typing(channel):
await asyncio.sleep(60)
Warning
Sending a message to the channel will cause the typing indicator to disappear until it is re-triggered.
| PARAMETER | DESCRIPTION |
|---|---|
channel | The channel to trigger typing in. This may be the object or the ID of an existing channel. TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
TypingIndicator | A typing indicator to use. |
| 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. |
unban_member abstractmethod async #
unban_member(
guild: SnowflakeishOr[PartialGuild],
user: SnowflakeishOr[PartialUser],
*,
reason: UndefinedOr[str] = UNDEFINED,
) -> None
Alias of hikari.api.rest.RESTClient.unban_user.
unban_user abstractmethod async #
unban_user(
guild: SnowflakeishOr[PartialGuild],
user: SnowflakeishOr[PartialUser],
*,
reason: UndefinedOr[str] = UNDEFINED,
) -> None
Unban a member from a guild.
| PARAMETER | DESCRIPTION |
|---|---|
guild | The guild to unban the member from. This may be the object or the ID of an existing guild. TYPE: |
user | The user to unban. This may be the object or the ID of an existing user. TYPE: |
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 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. |
unpin_message abstractmethod async #
unpin_message(
channel: SnowflakeishOr[TextableChannel],
message: SnowflakeishOr[PartialMessage],
) -> None
Unpin a given message from a given text channel.
| PARAMETER | DESCRIPTION |
|---|---|
channel | The channel to unpin a message in. This may be the object or the ID of an existing channel. TYPE: |
message | The message to unpin. This may be the object or the ID of an existing message. TYPE: |
| 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 or the message is not a pinned message in the given channel. |
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. |
TokenStrategy #
Bases: ABC
Interface of an object used for managing OAuth2 access.
token_type abstractmethod property #
Type of token this strategy returns.
acquire abstractmethod async #
acquire(client: RESTClient) -> str
Acquire an authorization token (including the prefix).
| PARAMETER | DESCRIPTION |
|---|---|
client | The rest client to use to acquire the token. TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
str | The current authorization token to use for this client and it's prefix. |
invalidate abstractmethod #
invalidate(token: str | None) -> None
Invalidate the cached token in this handler.
Note
token may be provided in-order to avoid newly generated tokens from being invalidated due to multiple calls being made by separate subroutines which are handling the same token.
| PARAMETER | DESCRIPTION |
|---|---|
token | The token to specifically invalidate. If provided then this will only invalidate the cached token if it matches this, otherwise it'll be invalidated regardless. TYPE: |