hikari.api.rest#

Provides an interface for REST API implementations to follow.

Module Contents#

class hikari.api.rest.RESTClient[source]#

Bases: hikari.traits.NetworkSettingsAware, abc.ABC

Interface for functionality that a REST API implementation provides.

abstract property entity_factory: hikari.api.entity_factory.EntityFactory[source]#

Entity factory used by this REST client.

abstract property is_alive: bool[source]#

Whether this component is alive.

abstract property token_type: Union[str, hikari.applications.TokenType, None][source]#

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.

abstract async add_reaction(channel, message, emoji, emoji_id=undefined.UNDEFINED)[source]#

Add a reaction emoji to a message in a given channel.

Parameters:
channelhikari.snowflakes.SnowflakeishOr[hikari.channels.TextableChannel]

The channel where the message to add the reaction to is. This may be a hikari.channels.TextableChannel or the ID of an existing channel.

messagehikari.snowflakes.SnowflakeishOr[hikari.messages.PartialMessage]

The message to add a reaction to. This may be the object or the ID of an existing message.

emojityping.Union[str, hikari.emojis.Emoji]

Object or name of the emoji to react with.

Other Parameters:
emoji_idhikari.undefined.UndefinedOr[hikari.snowflakes.SnowflakeishOr[hikari.emojis.CustomEmoji]]

ID of the custom emoji to react with. This should only be provided when a custom emoji’s name is passed for emoji.

Raises:
hikari.errors.BadRequestError

If an invalid unicode emoji is given, or if the given custom emoji does not exist.

hikari.errors.UnauthorizedError

If you are unauthorized to make the request (invalid/missing token).

hikari.errors.ForbiddenError

If you are missing the ADD_REACTIONS (this is only necessary if you are the first person to add the reaction).

hikari.errors.NotFoundError

If the channel or message is not found.

hikari.errors.RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

hikari.errors.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.

hikari.errors.InternalServerError

If an internal error occurs on Discord while handling the request.

abstract async add_role_to_member(guild, user, role, *, reason=undefined.UNDEFINED)[source]#

Add a role to a member.

Parameters:
guildhikari.snowflakes.SnowflakeishOr[hikari.guilds.PartialGuild]

The guild where the member is in. This may be the object or the ID of an existing guild.

userhikari.snowflakes.SnowflakeishOr[hikari.users.PartialUser]

The user to add the role to. This may be the object or the ID of an existing user.

rolehikari.snowflakes.SnowflakeishOr[hikari.guilds.PartialRole]

The role to add. This may be the object or the ID of an existing role.

Other Parameters:
reasonhikari.undefined.UndefinedOr[str]

If provided, the reason that will be recorded in the audit logs. Maximum of 512 characters.

Raises:
hikari.errors.ForbiddenError

If you are missing the MANAGE_ROLES permission.

hikari.errors.UnauthorizedError

If you are unauthorized to make the request (invalid/missing token).

hikari.errors.NotFoundError

If the guild, user or role are not found.

hikari.errors.RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

hikari.errors.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.

hikari.errors.InternalServerError

If an internal error occurs on Discord while handling the request.

abstract async add_thread_member(channel, user, /)[source]#

Add a user to a thread channel.

Parameters:
channelhikari.snowflakes.SnowflakeishOr[hikari.channels.GuildTextChannel]

Object or ID of the thread channel to add a member to.

userhikari.snowflakes.SnowflakeishOr[hikari.users.PartialUser]

Object or ID of the user to add to the thread.

Raises:
hikari.errors.BadRequestError

If any of the fields that are passed have an invalid value.

hikari.errors.ForbiddenError

If you cannot add a user to this thread.

hikari.errors.NotFoundError

If the thread channel doesn’t exist.

hikari.errors.UnauthorizedError

If you are unauthorized to make the request (invalid/missing token).

hikari.errors.RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

hikari.errors.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.

hikari.errors.InternalServerError

If an internal error occurs on Discord while handling the request.

abstract async add_user_to_guild(access_token, guild, user, *, nickname=undefined.UNDEFINED, roles=undefined.UNDEFINED, mute=undefined.UNDEFINED, deaf=undefined.UNDEFINED)[source]#

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 MANAGE_INVITES permission within the target guild.

Parameters:
access_tokentyping.Union[str, hikari.applications.PartialOAuth2Token]

Object or string of the access token to use for this request.

guildhikari.snowflakes.SnowflakeishOr[hikari.guilds.PartialGuild]

The guild to add the user to. This may be the object or the ID of an existing guild.

userhikari.snowflakes.SnowflakeishOr[hikari.users.PartialUser]

The user to add to the guild. This may be the object or the ID of an existing user.

Other Parameters:
nicknamehikari.undefined.UndefinedOr[str]

If provided, the nick to add to the user when he joins the guild.

Requires the MANAGE_NICKNAMES permission on the guild.

roleshikari.undefined.UndefinedOr[hikari.snowflakes.SnowflakeishSequence[hikari.guilds.PartialRole]]

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 MANAGE_ROLES permission on the guild.

mutehikari.undefined.UndefinedOr[bool]

If provided, the mute state to add the user when he joins the guild.

Requires the MUTE_MEMBERS permission on the guild.

deafhikari.undefined.UndefinedOr[bool]

If provided, the deaf state to add the user when he joins the guild.

Requires the DEAFEN_MEMBERS permission on the guild.

Returns:
typing.Optional[hikari.guilds.Member]

None if the user was already part of the guild, else hikari.guilds.Member.

Raises:
hikari.errors.BadRequestError

If any of the fields that are passed have an invalid value.

hikari.errors.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 hikari.applications.OAuth2Scope.GUILDS_JOIN scope enabled.

hikari.errors.UnauthorizedError

If you are unauthorized to make the request (invalid/missing token).

hikari.errors.NotFoundError

If you own the guild or the user is not found.

hikari.errors.RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

hikari.errors.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.

hikari.errors.InternalServerError

If an internal error occurs on Discord while handling the request.

abstract async authorize_access_token(client, client_secret, code, redirect_uri)[source]#

Authorize an OAuth2 token using the authorize code grant type.

Parameters:
clienthikari.snowflakes.SnowflakeishOr[hikari.guilds.PartialApplication]

Object or ID of the application to authorize with.

client_secretstr

Secret of the application to authorize with.

codestr

The authorization code to exchange for an OAuth2 access token.

redirect_uristr

The redirect uri that was included in the authorization request.

Returns:
hikari.applications.OAuth2AuthorizationToken

Object of the authorized OAuth2 token.

Raises:
hikari.errors.BadRequestError

If an invalid redirect uri or code is passed.

hikari.errors.UnauthorizedError

When an client or client secret is passed.

hikari.errors.RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

hikari.errors.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.

hikari.errors.InternalServerError

If an internal error occurs on Discord while handling the request.

abstract async authorize_client_credentials_token(client, client_secret, scopes)[source]#

Authorize a client credentials token for an application.

Parameters:
clienthikari.snowflakes.SnowflakeishOr[hikari.guilds.PartialApplication]

Object or ID of the application to authorize as.

client_secretstr

Secret of the application to authorize as.

scopestyping.Sequence[typing.Union[hikari.applications.OAuth2Scope, str]]

The scopes to authorize for.

Returns:
hikari.applications.PartialOAuth2Token

Object of the authorized partial OAuth2 token.

Raises:
hikari.errors.BadRequestError

If invalid any invalid or malformed scopes are passed.

hikari.errors.UnauthorizedError

When an client or client secret is passed.

hikari.errors.RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

hikari.errors.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.

hikari.errors.InternalServerError

If an internal error occurs on Discord while handling the request.

abstract async ban_member(guild, user, *, delete_message_days=undefined.UNDEFINED, delete_message_seconds=undefined.UNDEFINED, reason=undefined.UNDEFINED)[source]#

Alias of ban_user.

abstract async ban_user(guild, user, *, delete_message_days=undefined.UNDEFINED, delete_message_seconds=undefined.UNDEFINED, reason=undefined.UNDEFINED)[source]#

Ban the given user from this guild.

Parameters:
guildhikari.snowflakes.SnowflakeishOr[hikari.guilds.PartialGuild]

The guild to ban the member from. This may be the object or the ID of an existing guild.

userhikari.snowflakes.SnowflakeishOr[hikari.users.PartialUser]

The user to kick. This may be the object or the ID of an existing user.

Other Parameters:
delete_message_dayshikari.undefined.UndefinedOr[int]

If provided, the number of days to delete messages for. This must be between 0 and 7.

Deprecated since version 2.0.0.dev114: Use delete_message_seconds instead.

delete_message_secondshikari.undefined.UndefinedNoneOr[hikari.internal.time.Intervalish]

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 datetime.timedelta object.

reasonhikari.undefined.UndefinedOr[str]

If provided, the reason that will be recorded in the audit logs. Maximum of 512 characters.

Raises:
hikari.errors.BadRequestError

If any of the fields that are passed have an invalid value.

hikari.errors.ForbiddenError

If you are missing the BAN_MEMBERS permission.

hikari.errors.UnauthorizedError

If you are unauthorized to make the request (invalid/missing token).

hikari.errors.NotFoundError

If the guild or user are not found.

hikari.errors.RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

hikari.errors.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.

hikari.errors.InternalServerError

If an internal error occurs on Discord while handling the request.

abstract async begin_guild_prune(guild, *, days=undefined.UNDEFINED, compute_prune_count=undefined.UNDEFINED, include_roles=undefined.UNDEFINED, reason=undefined.UNDEFINED)[source]#

Begin the guild prune.

Parameters:
guildhikari.snowflakes.SnowflakeishOr[hikari.guilds.PartialGuild]

The guild to begin the guild prune in. This may be the object or the ID of an existing guild.

Other Parameters:
dayshikari.undefined.UndefinedOr[int]

If provided, number of days to count prune for.

compute_prune_counthikari.snowflakes.SnowflakeishOr[bool]

If provided, whether to return the prune count. This is discouraged for large guilds.

include_roleshikari.undefined.UndefinedOr[hikari.snowflakes.SnowflakeishSequence[hikari.guilds.PartialRole]]

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.

reasonhikari.undefined.UndefinedOr[str]

If provided, the reason that will be recorded in the audit logs. Maximum of 512 characters.

Returns:
typing.Optional[int]

If compute_prune_count is not provided or True, the number of members pruned. Else None.

Raises:
hikari.errors.BadRequestError

If any of the fields that are passed have an invalid value.

hikari.errors.UnauthorizedError

If you are unauthorized to make the request (invalid/missing token).

hikari.errors.ForbiddenError

If you are missing the KICK_MEMBERS permission.

hikari.errors.NotFoundError

If the guild is not found.

hikari.errors.RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

hikari.errors.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.

hikari.errors.InternalServerError

If an internal error occurs on Discord while handling the request.

abstract build_message_action_row()[source]#

Build a message action row message component for use in message create and REST calls.

Returns:
hikari.api.special_endpoints.MessageActionRowBuilder

The initialised action row builder.

abstract build_modal_action_row()[source]#

Build an action row modal component for use in interactions and REST calls.

Returns:
hikari.api.special_endpoints.ModalActionRowBuilder

The initialised action row builder.

abstract async close()[source]#

Close the client session.

abstract context_menu_command_builder(type, name)[source]#

Create a command builder to use in RESTClient.set_application_commands.

Parameters:
typecommands.CommandType

The commands’s type.

namestr

The command’s name.

Returns:
hikari.api.special_endpoints.ContextMenuCommandBuilder

The created command builder object.

abstract async create_autocomplete_response(interaction, token, choices)[source]#

Create the initial response for an autocomplete interaction.

Parameters:
interactionhikari.snowflakes.SnowflakeishOr[hikari.interactions.base_interactions.PartialInteraction]

Object or ID of the interaction this response is for.

tokenstr

The command interaction’s token.

Other Parameters:
choicestyping.Sequence[commands.CommandChoice]

The autocomplete choices themselves.

Raises:
hikari.errors.UnauthorizedError

If you are unauthorized to make the request (invalid/missing token).

hikari.errors.NotFoundError

If the interaction is not found or if the interaction’s initial response has already been created.

hikari.errors.RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

hikari.errors.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.

hikari.errors.InternalServerError

If an internal error occurs on Discord while handling the request.

abstract async create_context_menu_command(application, type, name, *, guild=undefined.UNDEFINED, name_localizations=undefined.UNDEFINED, default_member_permissions=undefined.UNDEFINED, dm_enabled=undefined.UNDEFINED, nsfw=undefined.UNDEFINED)[source]#

Create an application command.

Parameters:
applicationhikari.snowflakes.SnowflakeishOr[hikari.guilds.PartialApplication]

Object or ID of the application to create a command for.

typetyping.Union[hikari.commands.CommandType, int]

The type of menu command to make.

Only USER and MESSAGE are valid here.

namestr

The command’s name. This should match the regex ^[-_p{L}p{N}p{sc=Deva}p{sc=Thai}]{1,32}$ in Unicode mode and be lowercase.

Other Parameters:
guildhikari.undefined.UndefinedOr[hikari.snowflakes.SnowflakeishOr[hikari.guilds.PartialGuild]

Object or ID of the specific guild this should be made for. If left as hikari.undefined.UNDEFINED then this call will create a global command rather than a guild specific one.

name_localizationshikari.undefined.UndefinedOr[typing.Mapping[typing.Union[hikari.locales.Locale, str], str]]

The name localizations for this command.

default_member_permissionstyping.Union[hikari.undefined.UndefinedType, int, hikari.permissions.Permissions]

Member permissions necessary to utilize this command by default.

If 0, then it will be available for all members. Note that this doesn’t affect administrators of the guild and overwrites.

dm_enabledhikari.undefined.UndefinedOr[bool]

Whether this command is enabled in DMs with the bot.

This can only be applied to non-guild commands.

nsfwhikari.undefined.UndefinedOr[bool]

Whether this command should be age-restricted.

Returns:
hikari.commands.ContextMenuCommand

Object of the created command.

Raises:
hikari.errors.ForbiddenError

If you cannot access the provided application’s commands.

hikari.errors.NotFoundError

If the provided application isn’t found.

hikari.errors.BadRequestError

If any of the fields that are passed have an invalid value.

hikari.errors.UnauthorizedError

If you are unauthorized to make the request (invalid/missing token).

hikari.errors.RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

hikari.errors.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.

hikari.errors.InternalServerError

If an internal error occurs on Discord while handling the request.

abstract async create_dm_channel(user, /)[source]#

Create a DM channel with a user.

Parameters:
userhikari.snowflakes.SnowflakeishOr[hikari.users.PartialUser]

The user to create the DM channel with. This may be the object or the ID of an existing user.

Returns:
hikari.channels.DMChannel

The created DM channel.

Raises:
hikari.errors.BadRequestError

If the user is not found.

hikari.errors.UnauthorizedError

If you are unauthorized to make the request (invalid/missing token).

hikari.errors.RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

hikari.errors.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.

hikari.errors.InternalServerError

If an internal error occurs on Discord while handling the request.

abstract async create_emoji(guild, name, image, *, roles=undefined.UNDEFINED, reason=undefined.UNDEFINED)[source]#

Create an emoji in a guild.

Parameters:
guildhikari.snowflakes.SnowflakeishOr[hikari.guilds.PartialGuild]

The guild to create the emoji on. This can be a guild object or the ID of an existing guild.

namestr

The name for the emoji.

imagehikari.files.Resourceish

The 128x128 image for the emoji. Maximum upload size is 256kb. This can be a still or an animated image.

Other Parameters:
roleshikari.undefined.UndefinedOr[hikari.snowflakes.SnowflakeishSequence[hikari.guilds.PartialRole]]

If provided, a collection of the roles that will be able to use this emoji. This can be a hikari.guilds.PartialRole or the ID of an existing role.

reasonhikari.undefined.UndefinedOr[str]

If provided, the reason that will be recorded in the audit logs. Maximum of 512 characters.

Returns:
hikari.emojis.KnownCustomEmoji

The created emoji.

Raises:
hikari.errors.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.

hikari.errors.ForbiddenError

If you are missing MANAGE_EMOJIS_AND_STICKERS in the server.

hikari.errors.NotFoundError

If the guild is not found.

hikari.errors.UnauthorizedError

If you are unauthorized to make the request (invalid/missing token).

hikari.errors.RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

hikari.errors.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.

hikari.errors.InternalServerError

If an internal error occurs on Discord while handling the request.

abstract async create_external_event(guild, name, /, location, start_time, end_time, *, description=undefined.UNDEFINED, image=undefined.UNDEFINED, privacy_level=scheduled_events.EventPrivacyLevel.GUILD_ONLY, reason=undefined.UNDEFINED)[source]#

Create a scheduled external event.

Parameters:
guildhikari.snowflakes.SnowflakeishOr[hikari.guilds.PartialGuild]

The guild to create the event in.

namestr

The name of the event.

locationstr

The location the event.

start_timedatetime.datetime

When the event is scheduled to start.

end_timedatetime.datetime

When the event is scheduled to end.

Other Parameters:
descriptionhikari.undefined.UndefinedOr[str]

The event’s description.

imagehikari.undefined.UndefinedOr[hikari.files.Resourceish]

The event’s display image.

privacy_levelhikari.undefined.UndefinedOr[hikari.scheduled_events.EventPrivacyLevel]

The event’s privacy level.

This effects who can view and subscribe to the event.

reasonhikari.undefined.UndefinedOr[str]

If provided, the reason that will be recorded in the audit logs. Maximum of 512 characters.

Returns:
hikari.scheduled_events.ScheduledExternalEvent

The created scheduled external event.

Raises:
hikari.errors.BadRequestError

If any of the fields that are passed have an invalid value.

hikari.errors.UnauthorizedError

If you are unauthorized to make the request (invalid/missing token).

hikari.errors.ForbiddenError

If you are missing the MANAGE_EVENTS permission.

hikari.errors.NotFoundError

If the guild or event is not found.

hikari.errors.RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

hikari.errors.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.

hikari.errors.InternalServerError

If an internal error occurs on Discord while handling the request.

abstract async create_forum_post(channel, name, /, content=undefined.UNDEFINED, *, attachment=undefined.UNDEFINED, attachments=undefined.UNDEFINED, component=undefined.UNDEFINED, components=undefined.UNDEFINED, embed=undefined.UNDEFINED, embeds=undefined.UNDEFINED, tts=undefined.UNDEFINED, mentions_everyone=undefined.UNDEFINED, mentions_reply=undefined.UNDEFINED, user_mentions=undefined.UNDEFINED, role_mentions=undefined.UNDEFINED, flags=undefined.UNDEFINED, auto_archive_duration=datetime.timedelta(days=1), rate_limit_per_user=undefined.UNDEFINED, tags=undefined.UNDEFINED, reason=undefined.UNDEFINED)[source]#

Create a post in a forum channel.

Parameters:
channelhikari.snowflakes.SnowflakeishOr[hikari.channels.PermissibleGuildChannel]

Object or ID of the forum channel to create a post in.

namestr

Name of the post.

contenthikari.undefined.UndefinedOr[typing.Any]

If provided, the message contents. If hikari.undefined.UNDEFINED, then nothing will be sent in the content. Any other value here will be cast to a str.

If this is a hikari.embeds.Embed and no embed nor embeds kwarg is provided, then this will instead update the embed. This allows for simpler syntax when sending an embed alone.

Likewise, if this is a hikari.files.Resource, then the content is instead treated as an attachment if no attachment and no attachments kwargs are provided.

Other Parameters:
attachmenthikari.undefined.UndefinedOr[hikari.files.Resourceish]

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.

  • If a pathlib.PurePath or str to a valid URL, the

    resource at the given URL will be streamed to Discord when sending the message. Subclasses of hikari.files.WebResource such as hikari.files.URL, hikari.messages.Attachment, hikari.emojis.Emoji, EmbedResource, etc will also be uploaded this way. This will use bit-inception, so only a small percentage of the resource will remain in memory at any one time, thus aiding in scalability.

  • If a hikari.files.Bytes is passed, or a str

    that contains a valid data URI is passed, then this is uploaded with a randomized file name if not provided.

  • If a hikari.files.File, pathlib.PurePath or

    str that is an absolute or relative path to a file on your file system is passed, then this resource is uploaded as an attachment using non-blocking code internally and streamed using bit-inception where possible. This depends on the type of concurrent.futures.Executor that is being used for the application (default is a thread pool which supports this behaviour).

attachmentshikari.undefined.UndefinedOr[typing.Sequence[hikari.files.Resourceish]]

If provided, the message attachments. These can be resources, or strings consisting of paths on your computer or URLs.

componenthikari.undefined.UndefinedOr[hikari.api.special_endpoints.ComponentBuilder]

If provided, builder object of the component to include in this message.

componentshikari.undefined.UndefinedOr[typing.Sequence[hikari.api.special_endpoints.ComponentBuilder]]

If provided, a sequence of the component builder objects to include in this message.

embedhikari.undefined.UndefinedOr[hikari.embeds.Embed]

If provided, the message embed.

embedshikari.undefined.UndefinedOr[typing.Sequence[hikari.embeds.Embed]]

If provided, the message embeds.

ttshikari.undefined.UndefinedOr[bool]

If provided, whether the message will be read out by a screen reader using Discord’s TTS (text-to-speech) system.

mentions_everyonehikari.undefined.UndefinedOr[bool]

If provided, whether the message should parse @everyone/@here mentions.

mentions_replyhikari.undefined.UndefinedOr[bool]

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 reply.

user_mentionshikari.undefined.UndefinedOr[typing.Union[hikari.snowflakes.SnowflakeishSequence[hikari.users.PartialUser], bool]]

If provided, and True, all user mentions will be detected. If provided, and False, all user mentions will be ignored if appearing in the message body. Alternatively this may be a collection of hikari.snowflakes.Snowflake, or hikari.users.PartialUser derivatives to enforce mentioning specific users.

role_mentionshikari.undefined.UndefinedOr[typing.Union[hikari.snowflakes.SnowflakeishSequence[hikari.guilds.PartialRole], bool]]

If provided, and True, all role mentions will be detected. If provided, and False, all role mentions will be ignored if appearing in the message body. Alternatively this may be a collection of hikari.snowflakes.Snowflake, or hikari.guilds.PartialRole derivatives to enforce mentioning specific roles.

flagshikari.undefined.UndefinedOr[hikari.messages.MessageFlag]

If provided, optional flags to set on the message. If hikari.undefined.UNDEFINED, then nothing is changed.

Note that some flags may not be able to be set. Currently the only flags that can be set are NONE and SUPPRESS_EMBEDS.

auto_archive_durationhikari.undefined.UndefinedOr[hikari.internal.time.Intervalish]

If provided, how long the post should remain inactive until it’s archived.

This should be either 60, 1440, 4320 or 10080 seconds and, as of writing, ignores the parent channel’s set default_auto_archive_duration when passed as hikari.undefined.UNDEFINED.

rate_limit_per_userhikari.undefined.UndefinedOr[hikari.internal.time.Intervalish]

If provided, the amount of seconds a user has to wait before being able to send another message in the channel. Maximum 21600 seconds.

tagshikari.undefined.UndefinedOr[typing.Sequence[hikari.snowflakes.SnowflakeishOr[hikari.channels.ForumTag]]]

If provided, the tags to add to the created post.

reasonhikari.undefined.UndefinedOr[str]

If provided, the reason that will be recorded in the audit logs. Maximum of 512 characters.

Returns:
hikari.channels.GuildPublicThread

The created post.

Raises:
hikari.errors.BadRequestError

If any of the fields that are passed have an invalid value.

hikari.errors.ForbiddenError

If you are missing the SEND_MESSAGES permission in the channel.

hikari.errors.UnauthorizedError

If you are unauthorized to make the request (invalid/missing token).

hikari.errors.RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

hikari.errors.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.

hikari.errors.InternalServerError

If an internal error occurs on Discord while handling the request.

abstract async create_guild_category(guild, name, *, position=undefined.UNDEFINED, permission_overwrites=undefined.UNDEFINED, reason=undefined.UNDEFINED)[source]#

Create a category in a guild.

Parameters:
guildhikari.snowflakes.SnowflakeishOr[hikari.guilds.PartialGuild]

The guild to create the channel in. This may be the object or the ID of an existing guild.

namestr

The channels name. Must be between 2 and 1000 characters.

Other Parameters:
positionhikari.undefined.UndefinedOr[int]

If provided, the position of the category.

permission_overwriteshikari.undefined.UndefinedOr[typing.Sequence[hikari.channels.PermissionOverwrite]]

If provided, the permission overwrites for the category.

reasonhikari.undefined.UndefinedOr[str]

If provided, the reason that will be recorded in the audit logs. Maximum of 512 characters.

Returns:
hikari.channels.GuildCategory

The created category.

Raises:
hikari.errors.BadRequestError

If any of the fields that are passed have an invalid value.

hikari.errors.ForbiddenError

If you are missing the MANAGE_CHANNEL permission.

hikari.errors.UnauthorizedError

If you are unauthorized to make the request (invalid/missing token).

hikari.errors.NotFoundError

If the guild is not found.

hikari.errors.RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

hikari.errors.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.

hikari.errors.InternalServerError

If an internal error occurs on Discord while handling the request.

abstract async create_guild_forum_channel(guild, name, *, position=undefined.UNDEFINED, category=undefined.UNDEFINED, permission_overwrites=undefined.UNDEFINED, topic=undefined.UNDEFINED, nsfw=undefined.UNDEFINED, rate_limit_per_user=undefined.UNDEFINED, default_auto_archive_duration=undefined.UNDEFINED, default_thread_rate_limit_per_user=undefined.UNDEFINED, default_forum_layout=undefined.UNDEFINED, default_sort_order=undefined.UNDEFINED, available_tags=undefined.UNDEFINED, default_reaction_emoji=undefined.UNDEFINED, reason=undefined.UNDEFINED)[source]#

Create a forum channel in a guild.

Parameters:
guildhikari.snowflakes.SnowflakeishOr[hikari.guilds.PartialGuild]

The guild to create the channel in. This may be the object or the ID of an existing guild.

namestr

The channels name. Must be between 2 and 1000 characters.

Other Parameters:
positionhikari.undefined.UndefinedOr[int]

If provided, the position of the category.

categoryhikari.undefined.UndefinedOr[hikari.snowflakes.SnowflakeishOr[hikari.channels.GuildCategory]]

The category to create the channel under. This may be the object or the ID of an existing category.

permission_overwriteshikari.undefined.UndefinedOr[typing.Sequence[hikari.channels.PermissionOverwrite]]

If provided, the permission overwrites for the category.

topichikari.undefined.UndefinedOr[str]

If provided, the channels topic. Maximum 1024 characters.

nsfwhikari.undefined.UndefinedOr[bool]

If provided, whether to mark the channel as NSFW.

rate_limit_per_userhikari.undefined.UndefinedOr[hikari.internal.time.Intervalish]

If provided, the amount of seconds a user has to wait before being able to send another message in the channel. Maximum 21600 seconds.

default_auto_archive_durationhikari.undefined.UndefinedOr[hikari.internal.time.Intervalish]

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 seconds and, as of writing, ignores the parent channel’s set default_auto_archive_duration when passed as hikari.undefined.UNDEFINED.

default_thread_rate_limit_per_userhikari.undefined.UndefinedOr[hikari.internal.time.Intervalish]

If provided, the ratelimit that should be set in threads created from the forum.

default_forum_layouthikari.undefined.UndefinedOr[typing.Union[hikari.channels.ForumLayoutType, int]]

If provided, the default forum layout to show in the client.

default_sort_orderhikari.undefined.UndefinedOr[typing.Union[hikari.channels.ForumSortOrderType, int]]

If provided, the default sort order to show in the client.

available_tagshikari.undefined.UndefinedOr[typing.Sequence[hikari.channels.ForumTag]]

If provided, the available tags to select from when creating a thread.

default_reaction_emojityping.Union[str, hikari.emojis.Emoji, hikari.undefined.UndefinedType, hikari.snowflakes.Snowflake]

If provided, the new default reaction emoji for threads created in a forum channel.

reasonhikari.undefined.UndefinedOr[str]

If provided, the reason that will be recorded in the audit logs. Maximum of 512 characters.

Returns:
hikari.channels.GuildForumChannel

The created forum channel.

Raises:
hikari.errors.BadRequestError

If any of the fields that are passed have an invalid value.

hikari.errors.ForbiddenError

If you are missing the MANAGE_CHANNEL permission.

hikari.errors.UnauthorizedError

If you are unauthorized to make the request (invalid/missing token).

hikari.errors.NotFoundError

If the guild is not found.

hikari.errors.RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

hikari.errors.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.

hikari.errors.InternalServerError

If an internal error occurs on Discord while handling the request.

abstract async create_guild_from_template(template, name, *, icon=undefined.UNDEFINED)[source]#

Make a guild from a template.

Note

This endpoint can only be used by bots in less than 10 guilds.

Parameters:
templatetyping.Union[str, hikari.templates.Template]

The object or string code of the template to create a guild based on.

namestr

The new guilds name.

Other Parameters:
iconhikari.undefined.UndefinedOr[hikari.files.Resourceish]

If provided, the guild icon to set. Must be a 1024x1024 image or can be an animated gif when the guild has the ANIMATED_ICON feature.

Returns:
hikari.guilds.RESTGuild

Object of the created guild.

Raises:
hikari.errors.BadRequestError

If any of the fields that are passed have an invalid value or if you call this as a bot that’s in more than 10 guilds.

hikari.errors.UnauthorizedError

If you are unauthorized to make the request (invalid/missing token).

hikari.errors.RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

hikari.errors.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.

hikari.errors.InternalServerError

If an internal error occurs on Discord while handling the request.

abstract async create_guild_news_channel(guild, name, *, position=undefined.UNDEFINED, topic=undefined.UNDEFINED, nsfw=undefined.UNDEFINED, rate_limit_per_user=undefined.UNDEFINED, permission_overwrites=undefined.UNDEFINED, category=undefined.UNDEFINED, default_auto_archive_duration=undefined.UNDEFINED, reason=undefined.UNDEFINED)[source]#

Create a news channel in a guild.

Parameters:
guildhikari.snowflakes.SnowflakeishOr[hikari.guilds.PartialGuild]

The guild to create the channel in. This may be the object or the ID of an existing guild.

namestr

The channels name. Must be between 2 and 1000 characters.

Other Parameters:
positionhikari.undefined.UndefinedOr[int]

If provided, the position of the channel (relative to the category, if any).

topichikari.undefined.UndefinedOr[str]

If provided, the channels topic. Maximum 1024 characters.

nsfwhikari.undefined.UndefinedOr[bool]

If provided, whether to mark the channel as NSFW.

rate_limit_per_userhikari.undefined.UndefinedOr[hikari.internal.time.Intervalish]

If provided, the amount of seconds a user has to wait before being able to send another message in the channel. Maximum 21600 seconds.

permission_overwriteshikari.undefined.UndefinedOr[typing.Sequence[hikari.channels.PermissionOverwrite]]

If provided, the permission overwrites for the channel.

categoryhikari.undefined.UndefinedOr[hikari.snowflakes.SnowflakeishOr[hikari.channels.GuildCategory]]

The category to create the channel under. This may be the object or the ID of an existing category.

default_auto_archive_durationhikari.undefined.UndefinedOr[hikari.internal.time.Intervalish]

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 seconds and, as of writing, ignores the parent channel’s set default_auto_archive_duration when passed as hikari.undefined.UNDEFINED.

reasonhikari.undefined.UndefinedOr[str]

If provided, the reason that will be recorded in the audit logs. Maximum of 512 characters.

Returns:
hikari.channels.GuildNewsChannel

The created channel.

Raises:
hikari.errors.BadRequestError

If any of the fields that are passed have an invalid value.

hikari.errors.ForbiddenError

If you are missing the MANAGE_CHANNEL permission.

hikari.errors.UnauthorizedError

If you are unauthorized to make the request (invalid/missing token).

hikari.errors.NotFoundError

If the guild is not found.

hikari.errors.RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

hikari.errors.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.

hikari.errors.InternalServerError

If an internal error occurs on Discord while handling the request.

abstract async create_guild_stage_channel(guild, name, *, position=undefined.UNDEFINED, user_limit=undefined.UNDEFINED, bitrate=undefined.UNDEFINED, permission_overwrites=undefined.UNDEFINED, region=undefined.UNDEFINED, category=undefined.UNDEFINED, reason=undefined.UNDEFINED)[source]#

Create a stage channel in a guild.

Parameters:
guildhikari.snowflakes.SnowflakeishOr[hikari.guilds.PartialGuild]

The guild to create the channel in. This may be the object or the ID of an existing guild.

namestr

The channel’s name. Must be between 2 and 1000 characters.

Other Parameters:
positionhikari.undefined.UndefinedOr[int]

If provided, the position of the channel (relative to the category, if any).

user_limithikari.undefined.UndefinedOr[int]

If provided, the maximum users in the channel at once. Must be between 0 and 99 with 0 meaning no limit.

bitratehikari.undefined.UndefinedOr[int]

If provided, the bitrate for the channel. Must be between 8000 and 96000 or 8000 and 128000 for VIP servers.

permission_overwriteshikari.undefined.UndefinedOr[typing.Sequence[hikari.channels.PermissionOverwrite]]

If provided, the permission overwrites for the channel.

regionhikari.undefined.UndefinedOr[typing.Union[hikari.voices.VoiceRegion, str]]

If provided, the voice region to for this channel. Passing None here will set it to “auto” mode where the used region will be decided based on the first person who connects to it when it’s empty.

categoryhikari.undefined.UndefinedOr[hikari.snowflakes.SnowflakeishOr[hikari.channels.GuildCategory]]

The category to create the channel under. This may be the object or the ID of an existing category.

reasonhikari.undefined.UndefinedOr[str]

If provided, the reason that will be recorded in the audit logs. Maximum of 512 characters.

Returns:
hikari.channels.GuildStageChannel

The created channel.

Raises:
hikari.errors.BadRequestError

If any of the fields that are passed have an invalid value.

hikari.errors.ForbiddenError

If you are missing the MANAGE_CHANNEL permission.

hikari.errors.UnauthorizedError

If you are unauthorized to make the request (invalid/missing token).

hikari.errors.NotFoundError

If the guild is not found.

hikari.errors.RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

hikari.errors.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.

hikari.errors.InternalServerError

If an internal error occurs on Discord while handling the request.

abstract async create_guild_text_channel(guild, name, *, position=undefined.UNDEFINED, topic=undefined.UNDEFINED, nsfw=undefined.UNDEFINED, rate_limit_per_user=undefined.UNDEFINED, permission_overwrites=undefined.UNDEFINED, category=undefined.UNDEFINED, default_auto_archive_duration=undefined.UNDEFINED, reason=undefined.UNDEFINED)[source]#

Create a text channel in a guild.

Parameters:
guildhikari.snowflakes.SnowflakeishOr[hikari.guilds.PartialGuild]

The guild to create the channel in. This may be the object or the ID of an existing guild.

namestr

The channels name. Must be between 2 and 1000 characters.

Other Parameters:
positionhikari.undefined.UndefinedOr[int]

If provided, the position of the channel (relative to the category, if any).

topichikari.undefined.UndefinedOr[str]

If provided, the channels topic. Maximum 1024 characters.

nsfwhikari.undefined.UndefinedOr[bool]

If provided, whether to mark the channel as NSFW.

rate_limit_per_userhikari.undefined.UndefinedOr[hikari.internal.time.Intervalish]

If provided, the amount of seconds a user has to wait before being able to send another message in the channel. Maximum 21600 seconds.

permission_overwriteshikari.undefined.UndefinedOr[typing.Sequence[hikari.channels.PermissionOverwrite]]

If provided, the permission overwrites for the channel.

categoryhikari.undefined.UndefinedOr[hikari.snowflakes.SnowflakeishOr[hikari.channels.GuildCategory]]

The category to create the channel under. This may be the object or the ID of an existing category.

default_auto_archive_durationhikari.undefined.UndefinedOr[hikari.internal.time.Intervalish]

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 seconds and, as of writing, ignores the parent channel’s set default_auto_archive_duration when passed as hikari.undefined.UNDEFINED.

reasonhikari.undefined.UndefinedOr[str]

If provided, the reason that will be recorded in the audit logs. Maximum of 512 characters.

Returns:
hikari.channels.GuildTextChannel

The created channel.

Raises:
hikari.errors.BadRequestError

If any of the fields that are passed have an invalid value.

hikari.errors.ForbiddenError

If you are missing the MANAGE_CHANNEL permission.

hikari.errors.UnauthorizedError

If you are unauthorized to make the request (invalid/missing token).

hikari.errors.NotFoundError

If the guild is not found.

hikari.errors.RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

hikari.errors.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.

hikari.errors.InternalServerError

If an internal error occurs on Discord while handling the request.

abstract async create_guild_voice_channel(guild, name, *, position=undefined.UNDEFINED, user_limit=undefined.UNDEFINED, bitrate=undefined.UNDEFINED, video_quality_mode=undefined.UNDEFINED, permission_overwrites=undefined.UNDEFINED, region=undefined.UNDEFINED, category=undefined.UNDEFINED, reason=undefined.UNDEFINED)[source]#

Create a voice channel in a guild.

Parameters:
guildhikari.snowflakes.SnowflakeishOr[hikari.guilds.PartialGuild]

The guild to create the channel in. This may be the object or the ID of an existing guild.

namestr

The channels name. Must be between 2 and 1000 characters.

Other Parameters:
positionhikari.undefined.UndefinedOr[int]

If provided, the position of the channel (relative to the category, if any).

user_limithikari.undefined.UndefinedOr[int]

If provided, the maximum users in the channel at once. Must be between 0 and 99 with 0 meaning no limit.

bitratehikari.undefined.UndefinedOr[int]

If provided, the bitrate for the channel. Must be between 8000 and 96000 or 8000 and 128000 for VIP servers.

video_quality_modehikari.undefined.UndefinedOr[typing.Union[hikari.channels.VideoQualityMode, int]]

If provided, the new video quality mode for the channel.

permission_overwriteshikari.undefined.UndefinedOr[typing.Sequence[hikari.channels.PermissionOverwrite]]

If provided, the permission overwrites for the channel.

regionhikari.undefined.UndefinedOr[typing.Union[hikari.voices.VoiceRegion, str]]

If provided, the voice region to for this channel. Passing None here will set it to “auto” mode where the used region will be decided based on the first person who connects to it when it’s empty.

categoryhikari.undefined.UndefinedOr[hikari.snowflakes.SnowflakeishOr[hikari.channels.GuildCategory]]

The category to create the channel under. This may be the object or the ID of an existing category.

reasonhikari.undefined.UndefinedOr[str]

If provided, the reason that will be recorded in the audit logs. Maximum of 512 characters.

Returns:
hikari.channels.GuildVoiceChannel

The created channel.

Raises:
hikari.errors.BadRequestError

If any of the fields that are passed have an invalid value.

hikari.errors.ForbiddenError

If you are missing the MANAGE_CHANNEL permission.

hikari.errors.UnauthorizedError

If you are unauthorized to make the request (invalid/missing token).

hikari.errors.NotFoundError

If the guild is not found.

hikari.errors.RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

hikari.errors.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.

hikari.errors.InternalServerError

If an internal error occurs on Discord while handling the request.

abstract async create_interaction_response(interaction, token, response_type, content=undefined.UNDEFINED, *, flags=undefined.UNDEFINED, tts=undefined.UNDEFINED, attachment=undefined.UNDEFINED, attachments=undefined.UNDEFINED, component=undefined.UNDEFINED, components=undefined.UNDEFINED, embed=undefined.UNDEFINED, embeds=undefined.UNDEFINED, mentions_everyone=undefined.UNDEFINED, user_mentions=undefined.UNDEFINED, role_mentions=undefined.UNDEFINED)[source]#

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.

Parameters:
interactionhikari.snowflakes.SnowflakeishOr[hikari.interactions.base_interactions.PartialInteraction]

Object or ID of the interaction this response is for.

tokenstr

The command interaction’s token.

response_typetyping.Union[int, hikari.interactions.base_interactions.ResponseType]

The type of interaction response this is.

Other Parameters:
contenthikari.undefined.UndefinedOr[typing.Any]

If provided, the message contents. If hikari.undefined.UNDEFINED, then nothing will be sent in the content. Any other value here will be cast to a str.

If this is a hikari.embeds.Embed and no embed nor no embeds kwarg is provided, then this will instead update the embed. This allows for simpler syntax when sending an embed alone.

attachmenthikari.undefined.UndefinedNoneOr[typing.Union[hikari.files.Resourceish, hikari.messages.Attachment]]

If provided, the message attachment. This can be a resource, or string of a path on your computer or a URL.

attachmentshikari.undefined.UndefinedNoneOr[typing.Sequence[typing.Union[hikari.files.Resourceish, hikari.messages.Attachment]]]

If provided, the message attachments. These can be resources, or strings consisting of paths on your computer or URLs.

componenthikari.undefined.UndefinedNoneOr[hikari.api.special_endpoints.ComponentBuilder]

If provided, builder object of the component to include in this message.

componentshikari.undefined.UndefinedNoneOr[typing.Sequence[hikari.api.special_endpoints.ComponentBuilder]]

If provided, a sequence of the component builder objects to include in this message.

embedhikari.undefined.UndefinedNoneOr[hikari.embeds.Embed]

If provided, the message embed.

embedshikari.undefined.UndefinedNoneOr[typing.Sequence[hikari.embeds.Embed]]

If provided, the message embeds.

flagstyping.Union[int, hikari.messages.MessageFlag, hikari.undefined.UndefinedType]

If provided, the message flags this response should have.

As of writing the only message flag which can be set here is hikari.messages.MessageFlag.EPHEMERAL.

ttshikari.undefined.UndefinedOr[bool]

If provided, whether the message will be read out by a screen reader using Discord’s TTS (text-to-speech) system.

mentions_everyonehikari.undefined.UndefinedOr[bool]

If provided, whether the message should parse @everyone/@here mentions.

user_mentionshikari.undefined.UndefinedOr[typing.Union[hikari.snowflakes.SnowflakeishSequence[hikari.users.PartialUser], bool]]

If provided, and True, all user mentions will be detected. If provided, and False, all user mentions will be ignored if appearing in the message body. Alternatively this may be a collection of hikari.snowflakes.Snowflake, or hikari.users.PartialUser derivatives to enforce mentioning specific users.

role_mentionshikari.undefined.UndefinedOr[typing.Union[hikari.snowflakes.SnowflakeishSequence[hikari.guilds.PartialRole], bool]]

If provided, and True, all role mentions will be detected. If provided, and False, all role mentions will be ignored if appearing in the message body. Alternatively this may be a collection of hikari.snowflakes.Snowflake, or hikari.guilds.PartialRole derivatives to enforce mentioning specific roles.

Raises:
ValueError

If more than 100 unique objects/entities are passed for role_mentions or user_mentions.

TypeError

If both embed and embeds are specified.

hikari.errors.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.

hikari.errors.UnauthorizedError

If you are unauthorized to make the request (invalid/missing token).

hikari.errors.NotFoundError

If the interaction is not found or if the interaction’s initial response has already been created.

hikari.errors.RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

hikari.errors.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.

hikari.errors.InternalServerError

If an internal error occurs on Discord while handling the request.

abstract async create_invite(channel, *, max_age=undefined.UNDEFINED, max_uses=undefined.UNDEFINED, temporary=undefined.UNDEFINED, unique=undefined.UNDEFINED, target_type=undefined.UNDEFINED, target_user=undefined.UNDEFINED, target_application=undefined.UNDEFINED, reason=undefined.UNDEFINED)[source]#

Create an invite to the given guild channel.

Parameters:
channelhikari.snowflakes.SnowflakeishOr[hikari.channels.GuildChannel]

The channel to create a invite for. This may be the object or the ID of an existing channel.

Other Parameters:
max_agehikari.undefined.UndefinedOr[typing.Union[datetime.timedelta, float, int]]

If provided, the duration of the invite before expiry.

max_useshikari.undefined.UndefinedOr[int]

If provided, the max uses the invite can have.

temporaryhikari.undefined.UndefinedOr[bool]

If provided, whether the invite only grants temporary membership.

uniquehikari.undefined.UndefinedOr[bool]

If provided, whether the invite should be unique.

target_typehikari.undefined.UndefinedOr[hikari.invites.TargetType]

If provided, the target type of this invite.

target_userhikari.undefined.UndefinedOr[hikari.snowflakes.SnowflakeishOr[hikari.users.PartialUser]]

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 target_type is STREAM and the targeted user must be streaming into the channel.

target_applicationhikari.undefined.UndefinedOr[hikari.snowflakes.SnowflakeishOr[hikari.guilds.PartialApplication]]

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 target_type is EMBEDDED_APPLICATION and the targeted application must have the EMBEDDED flag.

reasonhikari.undefined.UndefinedOr[str]

If provided, the reason that will be recorded in the audit logs. Maximum of 512 characters.

Returns:
hikari.invites.InviteWithMetadata

The invite to the given guild channel.

Raises:
hikari.errors.BadRequestError

If any of the fields that are passed have an invalid value.

hikari.errors.UnauthorizedError

If you are unauthorized to make the request (invalid/missing token).

hikari.errors.ForbiddenError

If you are missing the MANAGE_CHANNELS permission.

hikari.errors.NotFoundError

If the channel is not found, or if the target user does not exist, if provided.

hikari.errors.RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

hikari.errors.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.

hikari.errors.InternalServerError

If an internal error occurs on Discord while handling the request.

abstract async create_message(channel, content=undefined.UNDEFINED, *, attachment=undefined.UNDEFINED, attachments=undefined.UNDEFINED, component=undefined.UNDEFINED, components=undefined.UNDEFINED, embed=undefined.UNDEFINED, embeds=undefined.UNDEFINED, tts=undefined.UNDEFINED, reply=undefined.UNDEFINED, mentions_everyone=undefined.UNDEFINED, mentions_reply=undefined.UNDEFINED, user_mentions=undefined.UNDEFINED, role_mentions=undefined.UNDEFINED, flags=undefined.UNDEFINED)[source]#

Create a message in the given channel.

Parameters:
channelhikari.snowflakes.SnowflakeishOr[hikari.channels.TextableChannel]

The channel to create the message in.

contenthikari.undefined.UndefinedOr[typing.Any]

If provided, the message contents. If hikari.undefined.UNDEFINED, then nothing will be sent in the content. Any other value here will be cast to a str.

If this is a hikari.embeds.Embed and no embed nor embeds kwarg is provided, then this will instead update the embed. This allows for simpler syntax when sending an embed alone.

Likewise, if this is a hikari.files.Resource, then the content is instead treated as an attachment if no attachment and no attachments kwargs are provided.

Other Parameters:
attachmenthikari.undefined.UndefinedOr[hikari.files.Resourceish]

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.

  • If a pathlib.PurePath or str to a valid URL, the

    resource at the given URL will be streamed to Discord when sending the message. Subclasses of hikari.files.WebResource such as hikari.files.URL, hikari.messages.Attachment, hikari.emojis.Emoji, EmbedResource, etc will also be uploaded this way. This will use bit-inception, so only a small percentage of the resource will remain in memory at any one time, thus aiding in scalability.

  • If a hikari.files.Bytes is passed, or a str

    that contains a valid data URI is passed, then this is uploaded with a randomized file name if not provided.

  • If a hikari.files.File, pathlib.PurePath or

    str that is an absolute or relative path to a file on your file system is passed, then this resource is uploaded as an attachment using non-blocking code internally and streamed using bit-inception where possible. This depends on the type of concurrent.futures.Executor that is being used for the application (default is a thread pool which supports this behaviour).

attachmentshikari.undefined.UndefinedOr[typing.Sequence[hikari.files.Resourceish]]

If provided, the message attachments. These can be resources, or strings consisting of paths on your computer or URLs.

componenthikari.undefined.UndefinedOr[hikari.api.special_endpoints.ComponentBuilder]

If provided, builder object of the component to include in this message.

componentshikari.undefined.UndefinedOr[typing.Sequence[hikari.api.special_endpoints.ComponentBuilder]]

If provided, a sequence of the component builder objects to include in this message.

embedhikari.undefined.UndefinedOr[hikari.embeds.Embed]

If provided, the message embed.

embedshikari.undefined.UndefinedOr[typing.Sequence[hikari.embeds.Embed]]

If provided, the message embeds.

ttshikari.undefined.UndefinedOr[bool]

If provided, whether the message will be read out by a screen reader using Discord’s TTS (text-to-speech) system.

replyhikari.undefined.UndefinedOr[hikari.snowflakes.SnowflakeishOr[hikari.messages.PartialMessage]]

If provided, the message to reply to.

mentions_everyonehikari.undefined.UndefinedOr[bool]

If provided, whether the message should parse @everyone/@here mentions.

mentions_replyhikari.undefined.UndefinedOr[bool]

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 reply.

user_mentionshikari.undefined.UndefinedOr[typing.Union[hikari.snowflakes.SnowflakeishSequence[hikari.users.PartialUser], bool]]

If provided, and True, all user mentions will be detected. If provided, and False, all user mentions will be ignored if appearing in the message body. Alternatively this may be a collection of hikari.snowflakes.Snowflake, or hikari.users.PartialUser derivatives to enforce mentioning specific users.

role_mentionshikari.undefined.UndefinedOr[typing.Union[hikari.snowflakes.SnowflakeishSequence[hikari.guilds.PartialRole], bool]]

If provided, and True, all role mentions will be detected. If provided, and False, all role mentions will be ignored if appearing in the message body. Alternatively this may be a collection of hikari.snowflakes.Snowflake, or hikari.guilds.PartialRole derivatives to enforce mentioning specific roles.

flagshikari.undefined.UndefinedOr[hikari.messages.MessageFlag]

If provided, optional flags to set on the message. If hikari.undefined.UNDEFINED, then nothing is changed.

Note that some flags may not be able to be set. Currently the only flags that can be set are NONE and SUPPRESS_EMBEDS.

Returns:
hikari.messages.Message

The created message.

Raises:
ValueError

If more than 100 unique objects/entities are passed for role_mentions or user_mentions or if both attachment and attachments, component and components or embed and embeds are specified.

hikari.errors.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 reply is not found or not in the same channel as channel; too many components.

hikari.errors.UnauthorizedError

If you are unauthorized to make the request (invalid/missing token).

hikari.errors.ForbiddenError

If you are missing the SEND_MESSAGES in the channel or the person you are trying to message has the DM’s disabled.

hikari.errors.NotFoundError

If the channel is not found.

hikari.errors.RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

hikari.errors.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.

hikari.errors.InternalServerError

If an internal error occurs on Discord while handling the request.

abstract async create_message_thread(channel, message, name, /, *, auto_archive_duration=datetime.timedelta(days=1), rate_limit_per_user=undefined.UNDEFINED, reason=undefined.UNDEFINED)[source]#

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.

Parameters:
channelhikari.snowflakes.SnowflakeishOr[hikari.channels.PermissibleGuildChannel]

Object or ID of the guild news or text channel to create a public thread in.

messagehikari.snowflakes.SnowflakeishOr[hikari.messages.PartialMessage]

Object or ID of the message to attach the created thread to.

namestr

Name of the thread channel.

Other Parameters:
auto_archive_durationhikari.undefined.UndefinedOr[hikari.internal.time.Intervalish]

If provided, how long the thread should remain inactive until it’s archived.

This should be either 60, 1440, 4320 or 10080 seconds and, as of writing, ignores the parent channel’s set default_auto_archive_duration when passed as hikari.undefined.UNDEFINED.

rate_limit_per_userhikari.undefined.UndefinedOr[hikari.internal.time.Intervalish]

If provided, the amount of seconds a user has to wait before being able to send another message in the channel. Maximum 21600 seconds.

reasonhikari.undefined.UndefinedOr[str]

If provided, the reason that will be recorded in the audit logs. Maximum of 512 characters.

Returns:
typing.Union[hikari.channels.GuildPublicThread, hikari.channels.GuildNewsThread]

The created public or news thread channel.

Raises:
hikari.errors.BadRequestError

If any of the fields that are passed have an invalid value.

hikari.errors.ForbiddenError

If you are missing the CREATE_PUBLIC_THREADS permission or if you can’t send messages in the target channel.

hikari.errors.UnauthorizedError

If you are unauthorized to make the request (invalid/missing token).

hikari.errors.RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

hikari.errors.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.

hikari.errors.InternalServerError

If an internal error occurs on Discord while handling the request.

async create_modal_response(interaction, token, *, title, custom_id, component=undefined.UNDEFINED, components=undefined.UNDEFINED)[source]#

Create a response by sending a modal.

Parameters:
interactionhikari.snowflakes.SnowflakeishOr[hikari.interactions.base_interactions.PartialInteraction]

Object or ID of the interaction this response is for.

tokenstr

The command interaction’s token.

titlestr

The title that will show up in the modal.

custom_idstr

Developer set custom ID used for identifying interactions with this modal.

Other Parameters:
componenthikari.undefined.UndefinedOr[typing.Sequence[hikari.api.special_endpoints.ComponentBuilder]]

A component builders to send in this modal.

componentshikari.undefined.UndefinedOr[typing.Sequence[hikari.api.special_endpoints.ComponentBuilder]]

A sequence of component builders to send in this modal.

Raises:
ValueError

If both component and components are specified or if none are specified.

abstract async create_role(guild, *, name=undefined.UNDEFINED, permissions=undefined.UNDEFINED, color=undefined.UNDEFINED, colour=undefined.UNDEFINED, hoist=undefined.UNDEFINED, icon=undefined.UNDEFINED, unicode_emoji=undefined.UNDEFINED, mentionable=undefined.UNDEFINED, reason=undefined.UNDEFINED)[source]#

Create a role.

Parameters:
guildhikari.snowflakes.SnowflakeishOr[hikari.guilds.PartialGuild]

The guild to create the role in. This may be the object or the ID of an existing guild.

Other Parameters:
namehikari.undefined.UndefinedOr[str]

If provided, the name for the role.

permissionshikari.undefined.UndefinedOr[hikari.permissions.Permissions]

The permissions to give the role. This will default to setting NO roles if left to the default value. This is in contrast to default behaviour on Discord where some random permissions will be set by default.

colorhikari.undefined.UndefinedOr[hikari.colors.Colorish]

If provided, the role’s color.

colourhikari.undefined.UndefinedOr[hikari.colors.Colorish]

An alias for color.

hoisthikari.undefined.UndefinedOr[bool]

If provided, whether to hoist the role.

iconhikari.undefined.UndefinedOr[hikari.files.Resourceish]

If provided, the role icon. Must be a 64x64 image under 256kb.

unicode_emojihikari.undefined.UndefinedOr[str]

If provided, the standard emoji to set as the role icon.

mentionablehikari.undefined.UndefinedOr[bool]

If provided, whether to make the role mentionable.

reasonhikari.undefined.UndefinedOr[str]

If provided, the reason that will be recorded in the audit logs. Maximum of 512 characters.

Returns:
hikari.guilds.Role

The created role.

Raises:
TypeError

If both color and colour are specified or if both icon and unicode_emoji are specified.

hikari.errors.BadRequestError

If any of the fields that are passed have an invalid value.

hikari.errors.ForbiddenError

If you are missing the MANAGE_ROLES permission.

hikari.errors.UnauthorizedError

If you are unauthorized to make the request (invalid/missing token).

hikari.errors.NotFoundError

If the guild is not found.

hikari.errors.RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

hikari.errors.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.

hikari.errors.InternalServerError

If an internal error occurs on Discord while handling the request.

abstract async create_slash_command(application, name, description, *, guild=undefined.UNDEFINED, options=undefined.UNDEFINED, name_localizations=undefined.UNDEFINED, description_localizations=undefined.UNDEFINED, default_member_permissions=undefined.UNDEFINED, dm_enabled=undefined.UNDEFINED, nsfw=undefined.UNDEFINED)[source]#

Create an application command.

Parameters:
applicationhikari.snowflakes.SnowflakeishOr[hikari.guilds.PartialApplication]

Object or ID of the application to create a command for.

namestr

The command’s name. This should match the regex ^[w-]{1,32}$ in Unicode mode and be lowercase.

descriptionstr

The description to set for the command. This should be inclusively between 1-100 characters in length.

Other Parameters:
guildhikari.undefined.UndefinedOr[hikari.snowflakes.SnowflakeishOr[hikari.guilds.PartialGuild]

Object or ID of the specific guild this should be made for. If left as hikari.undefined.UNDEFINED then this call will create a global command rather than a guild specific one.

optionshikari.undefined.UndefinedOr[typing.Sequence[hikari.commands.CommandOption]]

A sequence of up to 10 options for this command.

name_localizationshikari.undefined.UndefinedOr[typing.Mapping[typing.Union[hikari.locales.Locale, str], str]]

The name localizations for this command.

description_localizationshikari.undefined.UndefinedOr[typing.Mapping[typing.Union[hikari.locales.Locale, str], str]]

The description localizations for this command.

default_member_permissionstyping.Union[hikari.undefined.UndefinedType, int, hikari.permissions.Permissions]

Member permissions necessary to utilize this command by default.

If 0, then it will be available for all members. Note that this doesn’t affect administrators of the guild and overwrites.

dm_enabledhikari.undefined.UndefinedOr[bool]

Whether this command is enabled in DMs with the bot.

This can only be applied to non-guild commands.

nsfwhikari.undefined.UndefinedOr[bool]

Whether this command should be age-restricted.

Returns:
hikari.commands.SlashCommand

Object of the created command.

Raises:
hikari.errors.ForbiddenError

If you cannot access the provided application’s commands.

hikari.errors.NotFoundError

If the provided application isn’t found.

hikari.errors.BadRequestError

If any of the fields that are passed have an invalid value.

hikari.errors.UnauthorizedError

If you are unauthorized to make the request (invalid/missing token).

hikari.errors.RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

hikari.errors.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.

hikari.errors.InternalServerError

If an internal error occurs on Discord while handling the request.

abstract async create_stage_event(guild, channel, name, /, start_time, *, description=undefined.UNDEFINED, end_time=undefined.UNDEFINED, image=undefined.UNDEFINED, privacy_level=scheduled_events.EventPrivacyLevel.GUILD_ONLY, reason=undefined.UNDEFINED)[source]#

Create a scheduled stage event.

Parameters:
guildhikari.snowflakes.SnowflakeishOr[hikari.guilds.PartialGuild]

The guild to create the event in.

channelhikari.snowflakes.SnowflakeishOr[hikari.channels.PartialChannel]

The stage channel to create the event in.

namestr

The name of the event.

start_timedatetime.datetime

When the event is scheduled to start.

Other Parameters:
descriptionhikari.undefined.UndefinedOr[str]

The event’s description.

end_timehikari.undefined.UndefinedOr[datetime.datetime]

When the event should be scheduled to end.

imagehikari.undefined.UndefinedOr[hikari.files.Resourceish]

The event’s display image.

privacy_levelhikari.undefined.UndefinedOr[hikari.scheduled_events.EventPrivacyLevel]

The event’s privacy level.

This effects who can view and subscribe to the event.

reasonhikari.undefined.UndefinedOr[str]

If provided, the reason that will be recorded in the audit logs. Maximum of 512 characters.

Returns:
hikari.scheduled_events.ScheduledStageEvent

The created scheduled stage event.

Raises:
hikari.errors.BadRequestError

If any of the fields that are passed have an invalid value.

hikari.errors.UnauthorizedError

If you are unauthorized to make the request (invalid/missing token).

hikari.errors.ForbiddenError

If you are missing permissions to create the scheduled event.

You need the following permissions in the target stage channel: MANAGE_EVENTS, VIEW_CHANNEL and CONNECT.

hikari.errors.NotFoundError

If the guild or event is not found.

hikari.errors.RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

hikari.errors.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.

hikari.errors.InternalServerError

If an internal error occurs on Discord while handling the request.

abstract async create_sticker(guild, name, tag, image, *, description=undefined.UNDEFINED, reason=undefined.UNDEFINED)[source]#

Create a sticker in a guild.

Parameters:
guildhikari.snowflakes.SnowflakeishOr[hikari.guilds.PartialGuild]

The guild to create the sticker on. This can be a guild object or the ID of an existing guild.

namestr

The name for the sticker.

tagstr

The tag for the sticker.

imagehikari.files.Resourceish

The 320x320 image for the sticker. Maximum upload size is 500kb. This can be a still or an animated PNG or a Lottie.

Note

Lottie support is only available for verified and partnered servers.

Other Parameters:
descriptionhikari.undefined.UndefinedOr[str]

If provided, the description of the sticker.

reasonhikari.undefined.UndefinedOr[str]

If provided, the reason that will be recorded in the audit logs. Maximum of 512 characters.

Returns:
hikari.stickers.GuildSticker

The created sticker.

Raises:
hikari.errors.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.

hikari.errors.ForbiddenError

If you are missing MANAGE_EMOJIS_AND_STICKERS in the server.

hikari.errors.NotFoundError

If the guild is not found.

hikari.errors.UnauthorizedError

If you are unauthorized to make the request (invalid/missing token).

hikari.errors.RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

hikari.errors.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.

hikari.errors.InternalServerError

If an internal error occurs on Discord while handling the request.

abstract async create_template(guild, name, *, description=undefined.UNDEFINED)[source]#

Create a guild template.

Parameters:
guildhikari.snowflakes.SnowflakeishOr[hikari.guilds.PartialGuild]

The guild to create a template from.

namestr

The name to use for the created template.

Other Parameters:
descriptionhikari.undefined.UndefinedNoneOr[str]

The description to set for the template.

Returns:
hikari.templates.Template

The object of the created template.

Raises:
hikari.errors.ForbiddenError

If you are not part of the guild.

hikari.errors.NotFoundError

If the guild is not found or you are missing the MANAGE_GUILD permission.

hikari.errors.UnauthorizedError

If you are unauthorized to make the request (invalid/missing token).

hikari.errors.RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

hikari.errors.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.

hikari.errors.InternalServerError

If an internal error occurs on Discord while handling the request.

abstract async create_thread(channel, type, name, /, *, auto_archive_duration=datetime.timedelta(days=1), invitable=undefined.UNDEFINED, rate_limit_per_user=undefined.UNDEFINED, reason=undefined.UNDEFINED)[source]#

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.

Parameters:
channelhikari.snowflakes.SnowflakeishOr[hikari.channels.PermissibleGuildChannel]

Object or ID of the guild news or text channel to create a thread in.

typetyping.Union[hikari.channels.ChannelType, int]

The thread type to create.

namestr

Name of the thread channel.

Other Parameters:
auto_archive_durationhikari.undefined.UndefinedOr[hikari.internal.time.Intervalish]

If provided, how long the thread should remain inactive until it’s archived.

This should be either 60, 1440, 4320 or 10080 seconds and, as of writing, ignores the parent channel’s set default_auto_archive_duration when passed as hikari.undefined.UNDEFINED.

invitableundefined.UndefinedOr[bool]

If provided, whether non-moderators should be able to add other non-moderators to the thread.

This only applies to private threads.

rate_limit_per_userhikari.undefined.UndefinedOr[hikari.internal.time.Intervalish]

If provided, the amount of seconds a user has to wait before being able to send another message in the channel. Maximum 21600 seconds.

reasonhikari.undefined.UndefinedOr[str]

If provided, the reason that will be recorded in the audit logs. Maximum of 512 characters.

Returns:
hikari.channels.GuildThreadChannel

The created thread channel.

Raises:
hikari.errors.BadRequestError

If any of the fields that are passed have an invalid value.

hikari.errors.ForbiddenError

If you are missing the CREATE_PUBLIC_THREADS permission or if you can’t send messages in the target channel.

hikari.errors.UnauthorizedError

If you are unauthorized to make the request (invalid/missing token).

hikari.errors.RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

hikari.errors.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.

hikari.errors.InternalServerError

If an internal error occurs on Discord while handling the request.

abstract async create_voice_event(guild, channel, name, /, start_time, *, description=undefined.UNDEFINED, end_time=undefined.UNDEFINED, image=undefined.UNDEFINED, privacy_level=scheduled_events.EventPrivacyLevel.GUILD_ONLY, reason=undefined.UNDEFINED)[source]#

Create a scheduled voice event.

Parameters:
guildhikari.snowflakes.SnowflakeishOr[hikari.guilds.PartialGuild]

The guild to create the event in.

channelhikari.snowflakes.SnowflakeishOr[hikari.channels.PartialChannel]

The voice channel to create the event in.

namestr

The name of the event.

start_timedatetime.datetime

When the event is scheduled to start.

Other Parameters:
descriptionhikari.undefined.UndefinedOr[str]

The event’s description.

end_timehikari.undefined.UndefinedOr[datetime.datetime]

When the event should be scheduled to end.

imagehikari.undefined.UndefinedOr[hikari.files.Resourceish]

The event’s display image.

privacy_levelhikari.undefined.UndefinedOr[hikari.scheduled_events.EventPrivacyLevel]

The event’s privacy level.

This effects who can view and subscribe to the event.

reasonhikari.undefined.UndefinedOr[str]

If provided, the reason that will be recorded in the audit logs. Maximum of 512 characters.

Returns:
hikari.scheduled_events.ScheduledVoiceEvent

The created scheduled voice event.

Raises:
hikari.errors.BadRequestError

If any of the fields that are passed have an invalid value.

hikari.errors.UnauthorizedError

If you are unauthorized to make the request (invalid/missing token).

hikari.errors.ForbiddenError

If you are missing permissions to create the scheduled event.

You need the following permissions in the target voice channel: MANAGE_EVENTS, VIEW_CHANNEL and CONNECT.

hikari.errors.NotFoundError

If the guild or event is not found.

hikari.errors.RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

hikari.errors.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.

hikari.errors.InternalServerError

If an internal error occurs on Discord while handling the request.

abstract async create_webhook(channel, name, *, avatar=undefined.UNDEFINED, reason=undefined.UNDEFINED)[source]#

Create webhook in a channel.

Parameters:
channelhikari.snowflakes.SnowflakeishOr[hikari.channels.WebhookChannelT]

The channel where the webhook will be created. This may be the object or the ID of an existing channel.

namestr

The name for the webhook. This cannot be clyde.

Other Parameters:
avatartyping.Optional[hikari.files.Resourceish]

If provided, the avatar for the webhook.

reasonhikari.undefined.UndefinedOr[str]

If provided, the reason that will be recorded in the audit logs. Maximum of 512 characters.

Returns:
hikari.webhooks.IncomingWebhook

The created webhook.

Raises:
hikari.errors.BadRequestError

If name doesn’t follow the restrictions enforced by discord.

hikari.errors.ForbiddenError

If you are missing the MANAGE_WEBHOOKS permission.

hikari.errors.UnauthorizedError

If you are unauthorized to make the request (invalid/missing token).

hikari.errors.NotFoundError

If the channel is not found.

hikari.errors.RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

hikari.errors.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.

hikari.errors.InternalServerError

If an internal error occurs on Discord while handling the request.

abstract async crosspost_message(channel, message)[source]#

Broadcast an announcement message.

Parameters:
channelhikari.snowflakes.SnowflakeishOr[hikari.channels.GuildNewsChannel]

The object or ID of the news channel to crosspost a message in.

messagehikari.snowflakes.SnowflakeishOr[hikari.messages.PartialMessage]

The object or ID of the message to crosspost.

Returns:
hikari.messages.Message

The message object that was crossposted.

Raises:
hikari.errors.BadRequestError

If you tried to crosspost a message that has already been broadcast.

hikari.errors.UnauthorizedError

If you are unauthorized to make the request (invalid/missing token).

hikari.errors.ForbiddenError

If you try to crosspost a message by the current user without the SEND_MESSAGES permission for the target news channel or try to crosspost a message by another user without both the SEND_MESSAGES and MANAGE_MESSAGES permissions for the target channel.

hikari.errors.NotFoundError

If the channel or message is not found.

hikari.errors.RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

hikari.errors.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.

hikari.errors.InternalServerError

If an internal error occurs on Discord while handling the request.

abstract async delete_all_reactions(channel, message)[source]#

Delete all reactions from a message.

Parameters:
channelhikari.snowflakes.SnowflakeishOr[hikari.channels.TextableChannel]

The channel where the message to delete all reactions from is. This may be the object or the ID of an existing channel.

messagehikari.snowflakes.SnowflakeishOr[hikari.messages.PartialMessage]

The message to delete all reaction from. This may be the object or the ID of an existing message.

Raises:
hikari.errors.BadRequestError

If an invalid unicode emoji is given, or if the given custom emoji does not exist.

hikari.errors.ForbiddenError

If you are missing the MANAGE_MESSAGES permission.

hikari.errors.UnauthorizedError

If you are unauthorized to make the request (invalid/missing token).

hikari.errors.NotFoundError

If the channel or message is not found.

hikari.errors.RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

hikari.errors.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.

hikari.errors.InternalServerError

If an internal error occurs on Discord while handling the request.

abstract async delete_all_reactions_for_emoji(channel, message, emoji, emoji_id=undefined.UNDEFINED)[source]#

Delete all reactions for a single emoji on a given message.

Parameters:
channelhikari.snowflakes.SnowflakeishOr[hikari.channels.TextableChannel]

The channel where the message to delete the reactions from is. This may be the object or the ID of an existing channel.

messagehikari.snowflakes.SnowflakeishOr[hikari.messages.PartialMessage]

The message to delete a reactions from. This may be the object or the ID of an existing message.

emojityping.Union[str, hikari.emojis.Emoji]

Object or name of the emoji to remove all the reactions for.

Other Parameters:
emoji_idhikari.undefined.UndefinedOr[hikari.snowflakes.SnowflakeishOr[hikari.emojis.CustomEmoji]]

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 emoji.

Raises:
hikari.errors.BadRequestError

If an invalid unicode emoji is given, or if the given custom emoji does not exist.

hikari.errors.ForbiddenError

If you are missing the MANAGE_MESSAGES permission.

hikari.errors.UnauthorizedError

If you are unauthorized to make the request (invalid/missing token).

hikari.errors.NotFoundError

If the channel or message is not found.

hikari.errors.RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

hikari.errors.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.

hikari.errors.InternalServerError

If an internal error occurs on Discord while handling the request.

abstract async delete_application_command(application, command, guild=undefined.UNDEFINED)[source]#

Delete a registered application command.

Parameters:
applicationhikari.snowflakes.SnowflakeishOr[hikari.guilds.PartialApplication]

Object or ID of the application to delete a command for.

commandhikari.snowflakes.SnowflakeishOr[hikari.commands.PartialCommand]

Object or ID of the command to delete.

Other Parameters:
guildhikari.undefined.UndefinedOr[hikari.snowflakes.SnowflakeishOr[hikari.guilds.PartialGuild]]

Object or ID of the guild to delete a command for if this is a guild specific command. Leave this as hikari.undefined.UNDEFINED to delete a global command.

Raises:
hikari.errors.ForbiddenError

If you cannot access the provided application’s commands.

hikari.errors.NotFoundError

If the provided application or command isn’t found.

hikari.errors.UnauthorizedError

If you are unauthorized to make the request (invalid/missing token).

hikari.errors.RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

hikari.errors.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.

hikari.errors.InternalServerError

If an internal error occurs on Discord while handling the request.

abstract async delete_channel(channel)[source]#

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.

Parameters:
channelhikari.snowflakes.SnowflakeishOr[hikari.channels.PartialChannel]

The channel to delete. This may be the object or the ID of an existing channel.

Returns:
hikari.channels.PartialChannel

Object of the channel that was deleted.

Raises:
hikari.errors.UnauthorizedError

If you are unauthorized to make the request (invalid/missing token).

hikari.errors.ForbiddenError

If you are missing the MANAGE_CHANNEL permission in the channel.

hikari.errors.NotFoundError

If the channel is not found.

hikari.errors.RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

hikari.errors.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.

hikari.errors.InternalServerError

If an internal error occurs on Discord while handling the request.

abstract async delete_emoji(guild, emoji, *, reason=undefined.UNDEFINED)[source]#

Delete an emoji in a guild.

Parameters:
guildhikari.snowflakes.SnowflakeishOr[hikari.guilds.PartialGuild]

The guild to delete the emoji on. This can be a guild object or the ID of an existing guild.

emojihikari.snowflakes.SnowflakeishOr[hikari.emojis.CustomEmoji]

The emoji to delete. This can be a hikari.emojis.CustomEmoji or the ID of an existing emoji.

Other Parameters:
reasonhikari.undefined.UndefinedOr[str]

If provided, the reason that will be recorded in the audit logs. Maximum of 512 characters.

Raises:
hikari.errors.ForbiddenError

If you are missing MANAGE_EMOJIS_AND_STICKERS in the server.

hikari.errors.NotFoundError

If the guild or the emoji are not found.

hikari.errors.UnauthorizedError

If you are unauthorized to make the request (invalid/missing token).

hikari.errors.RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

hikari.errors.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.

hikari.errors.InternalServerError

If an internal error occurs on Discord while handling the request.

abstract async delete_guild(guild)[source]#

Delete a guild.

Parameters:
guildhikari.snowflakes.SnowflakeishOr[hikari.guilds.PartialGuild]

The guild to delete. This may be the object or the ID of an existing guild.

Raises:
hikari.errors.ForbiddenError

If you are not the owner of the guild.

hikari.errors.UnauthorizedError

If you are unauthorized to make the request (invalid/missing token).

hikari.errors.NotFoundError

If you own the guild or if you are not in it.

hikari.errors.RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

hikari.errors.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.

hikari.errors.InternalServerError

If an internal error occurs on Discord while handling the request.

abstract async delete_interaction_response(application, token)[source]#

Delete the initial response of an interaction.

Parameters:
applicationhikari.snowflakes.SnowflakeishOr[hikari.guilds.PartialApplication]

Object or ID of the application to delete a command response for.

tokenstr

The interaction’s token.

Raises:
hikari.errors.UnauthorizedError

If you are unauthorized to make the request (invalid/missing token).

hikari.errors.NotFoundError

If the interaction or response is not found.

hikari.errors.RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

hikari.errors.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.

hikari.errors.InternalServerError

If an internal error occurs on Discord while handling the request.

abstract async delete_invite(invite)[source]#

Delete an existing invite.

Parameters:
invitetyping.Union[hikari.invites.InviteCode, str]

The invite to delete. This may be an invite object or the code of an existing invite.

Returns:
hikari.invites.Invite

Object of the invite that was deleted.

Raises:
hikari.errors.ForbiddenError

If you are missing the MANAGE_GUILD permission in the guild the invite is from or if you are missing the MANAGE_CHANNELS permission in the channel the invite is from.

hikari.errors.UnauthorizedError

If you are unauthorized to make the request (invalid/missing token).

hikari.errors.NotFoundError

If the invite is not found.

hikari.errors.RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

hikari.errors.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.

hikari.errors.InternalServerError

If an internal error occurs on Discord while handling the request.

abstract async delete_message(channel, message)[source]#

Delete a given message in a given channel.

Parameters:
channelhikari.snowflakes.SnowflakeishOr[hikari.channels.TextableChannel]

The channel to delete the message in. This may be the object or the ID of an existing channel.

messagehikari.snowflakes.SnowflakeishOr[hikari.messages.PartialMessage]

The message to delete. This may be the object or the ID of an existing message.

Raises:
hikari.errors.UnauthorizedError

If you are unauthorized to make the request (invalid/missing token).

hikari.errors.ForbiddenError

If you are missing the MANAGE_MESSAGES, and the message is not sent by you.

hikari.errors.NotFoundError

If the channel or message is not found.

hikari.errors.RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

hikari.errors.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.

hikari.errors.InternalServerError

If an internal error occurs on Discord while handling the request.

abstract async delete_messages(channel, messages, /, *other_messages)[source]#

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.

Parameters:
channelhikari.snowflakes.SnowflakeishOr[hikari.channels.TextableChannel]

The channel to bulk delete the messages in. This may be the object or the ID of an existing channel.

messagestyping.Union[hikari.snowflakes.SnowflakeishOr[hikari.messages.PartialMessage], hikari.snowflakes.SnowflakeishIterable[hikari.messages.PartialMessage]]

Either the object/ID of an existing message to delete or an iterable of the objects and/or IDs of existing messages to delete.

Other Parameters:
*other_messageshikari.snowflakes.SnowflakeishOr[hikari.messages.PartialMessage]

The objects and/or IDs of other existing messages to delete.

Raises:
hikari.errors.BulkDeleteError

An error containing the messages successfully deleted, and the messages that were not removed. The BaseException.__cause__ of the exception will be the original error that terminated this process.

abstract async delete_my_reaction(channel, message, emoji, emoji_id=undefined.UNDEFINED)[source]#

Delete a reaction that your application user created.

Parameters:
channelhikari.snowflakes.SnowflakeishOr[hikari.channels.TextableChannel]

The channel where the message to delete the reaction from is. This may be the object or the ID of an existing channel.

messagehikari.snowflakes.SnowflakeishOr[hikari.messages.PartialMessage]

The message to delete a reaction from. This may be the object or the ID of an existing message.

emojityping.Union[str, hikari.emojis.Emoji]

Object or name of the emoji to remove your reaction for.

Other Parameters:
emoji_idhikari.undefined.UndefinedOr[hikari.snowflakes.SnowflakeishOr[hikari.emojis.CustomEmoji]]

ID of the custom emoji to remove your reaction for. This should only be provided when a custom emoji’s name is passed for emoji.

Raises:
hikari.errors.BadRequestError

If an invalid unicode emoji is given, or if the given custom emoji does not exist.

hikari.errors.UnauthorizedError

If you are unauthorized to make the request (invalid/missing token).

hikari.errors.NotFoundError

If the channel or message is not found.

hikari.errors.RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

hikari.errors.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.

hikari.errors.InternalServerError

If an internal error occurs on Discord while handling the request.

abstract async delete_permission_overwrite(channel, target)[source]#

Delete a custom permission for an entity in a given guild channel.

Parameters:
channelhikari.snowflakes.SnowflakeishOr[hikari.channels.GuildChannel]

The channel to delete a permission overwrite in. This may be the object, or the ID of an existing channel.

targettyping.Union[hikari.users.PartialUser, hikari.guilds.PartialRole, hikari.channels.PermissionOverwrite, hikari.snowflakes.Snowflakeish]

The channel overwrite to delete.

Raises:
hikari.errors.UnauthorizedError

If you are unauthorized to make the request (invalid/missing token).

hikari.errors.ForbiddenError

If you are missing the MANAGE_PERMISSIONS permission in the channel.

hikari.errors.NotFoundError

If the channel is not found or the target is not found.

hikari.errors.RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

hikari.errors.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.

hikari.errors.InternalServerError

If an internal error occurs on Discord while handling the request.

abstract async delete_reaction(channel, message, user, emoji, emoji_id=undefined.UNDEFINED)[source]#

Delete a reaction from a message.

If you are looking to delete your own applications reaction, use delete_my_reaction.

Parameters:
channelhikari.snowflakes.SnowflakeishOr[hikari.channels.TextableChannel]

The channel where the message to delete the reaction from is. This may be the object or the ID of an existing channel.

messagehikari.snowflakes.SnowflakeishOr[hikari.messages.PartialMessage]

The message to delete a reaction from. This may be the object or the ID of an existing message.

userhikari.snowflakes.SnowflakeishOr[hikari.users.PartialUser]

Object or ID of the user to remove the reaction of.

emojityping.Union[str, hikari.emojis.Emoji]

Object or name of the emoji to react with.

Other Parameters:
emoji_idhikari.undefined.UndefinedOr[hikari.snowflakes.SnowflakeishOr[hikari.emojis.CustomEmoji]]

ID of the custom emoji to react with. This should only be provided when a custom emoji’s name is passed for emoji.

Raises:
hikari.errors.BadRequestError

If an invalid unicode emoji is given, or if the given custom emoji does not exist.

hikari.errors.ForbiddenError

If you are missing the MANAGE_MESSAGES permission.

hikari.errors.UnauthorizedError

If you are unauthorized to make the request (invalid/missing token).

hikari.errors.NotFoundError

If the channel or message is not found.

hikari.errors.RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

hikari.errors.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.

hikari.errors.InternalServerError

If an internal error occurs on Discord while handling the request.

abstract async delete_role(guild, role)[source]#

Delete a role.

Parameters:
guildhikari.snowflakes.SnowflakeishOr[hikari.guilds.PartialGuild]

The guild to delete the role in. This may be the object or the ID of an existing guild.

rolehikari.snowflakes.SnowflakeishOr[hikari.guilds.PartialRole]

The role to delete. This may be the object or the ID of an existing role.

Raises:
hikari.errors.ForbiddenError

If you are missing the MANAGE_ROLES permission.

hikari.errors.UnauthorizedError

If you are unauthorized to make the request (invalid/missing token).

hikari.errors.NotFoundError

If the guild or role are not found.

hikari.errors.RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

hikari.errors.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.

hikari.errors.InternalServerError

If an internal error occurs on Discord while handling the request.

abstract async delete_scheduled_event(guild, event, /)[source]#

Delete a scheduled event.

Parameters:
guildhikari.snowflakes.SnowflakeishOr[hikari.guilds.PartialGuild]

The guild to delete the event from.

eventhikari.snowflakes.SnowflakeishOr[hikari.scheduled_events.ScheduledEvent]

The scheduled event to delete.

Raises:
hikari.errors.UnauthorizedError

If you are unauthorized to make the request (invalid/missing token).

hikari.errors.ForbiddenError

If you are missing the MANAGE_EVENTS permission.

hikari.errors.NotFoundError

If the guild or event is not found.

hikari.errors.RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

hikari.errors.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.

hikari.errors.InternalServerError

If an internal error occurs on Discord while handling the request.

abstract async delete_sticker(guild, sticker, *, reason=undefined.UNDEFINED)[source]#

Delete a sticker in a guild.

Parameters:
guildhikari.snowflakes.SnowflakeishOr[hikari.guilds.PartialGuild]

The guild to delete the sticker on. This can be a guild object or the ID of an existing guild.

stickerhikari.snowflakes.SnowflakeishOr[hikari.stickers.PartialSticker]

The sticker to delete. This can be a sticker object or the ID of an existing sticker.

Other Parameters:
reasonhikari.undefined.UndefinedOr[str]

If provided, the reason that will be recorded in the audit logs. Maximum of 512 characters.

Raises:
hikari.errors.ForbiddenError

If you are missing MANAGE_EMOJIS_AND_STICKERS in the server.

hikari.errors.NotFoundError

If the guild or the sticker are not found.

hikari.errors.UnauthorizedError

If you are unauthorized to make the request (invalid/missing token).

hikari.errors.RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

hikari.errors.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.

hikari.errors.InternalServerError

If an internal error occurs on Discord while handling the request.

abstract async delete_template(guild, template)[source]#

Delete a guild template.

Parameters:
guildhikari.snowflakes.SnowflakeishOr[hikari.guilds.PartialGuild]

The guild to delete a template in.

templatetyping.Union[str, hikari.templates.Template]

Object or string code of the template to delete.

Returns:
hikari.templates.Template

The deleted template’s object.

Raises:
hikari.errors.ForbiddenError

If you are not part of the guild.

hikari.errors.NotFoundError

If the guild is not found or you are missing the MANAGE_GUILD permission.

hikari.errors.UnauthorizedError

If you are unauthorized to make the request (invalid/missing token).

hikari.errors.RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

hikari.errors.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.

hikari.errors.InternalServerError

If an internal error occurs on Discord while handling the request.

abstract async delete_webhook(webhook, *, token=undefined.UNDEFINED)[source]#

Delete a webhook.

Parameters:
webhookhikari.snowflakes.SnowflakeishOr[hikari.webhooks.PartialWebhook]

The webhook to delete. This may be the object or the ID of an existing webhook.

Other Parameters:
tokenhikari.undefined.UndefinedOr[str]

If provided, the webhook token that will be used to delete the webhook instead of the token the client was initialized with.

Raises:
hikari.errors.ForbiddenError

If you are missing the MANAGE_WEBHOOKS permission when not using a token.

hikari.errors.UnauthorizedError

If you are unauthorized to make the request (invalid/missing token).

hikari.errors.NotFoundError

If the webhook is not found.

hikari.errors.RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

hikari.errors.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.

hikari.errors.InternalServerError

If an internal error occurs on Discord while handling the request.

abstract async delete_webhook_message(webhook, token, message, *, thread=undefined.UNDEFINED)[source]#

Delete a given message in a given channel.

Parameters:
webhooktyping.Union[hikari.snowflakes.Snowflakeish, hikari.webhooks.ExecutableWebhook]

The webhook to execute. This may be the object or the ID of an existing webhook.

tokenstr

The webhook token.

messagehikari.snowflakes.SnowflakeishOr[hikari.messages.PartialMessage]

The message to delete. This may be the object or the ID of an existing message.

Other Parameters:
threadhikari.undefined.UndefinedOr[hikari.snowflakes.SnowflakeishOr[hikari.channels.GuildThreadChannel]]

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.

Raises:
hikari.errors.UnauthorizedError

If you are unauthorized to make the request (invalid/missing token).

hikari.errors.NotFoundError

If the webhook or the message are not found.

hikari.errors.RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

hikari.errors.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.

hikari.errors.InternalServerError

If an internal error occurs on Discord while handling the request.

abstract async edit_application_command(application, command, guild=undefined.UNDEFINED, *, name=undefined.UNDEFINED, description=undefined.UNDEFINED, options=undefined.UNDEFINED, default_member_permissions=undefined.UNDEFINED, dm_enabled=undefined.UNDEFINED)[source]#

Edit a registered application command.

Parameters:
applicationhikari.snowflakes.SnowflakeishOr[hikari.guilds.PartialApplication]

Object or ID of the application to edit a command for.

commandhikari.snowflakes.SnowflakeishOr[hikari.commands.PartialCommand]

Object or ID of the command to modify.

Other Parameters:
guildhikari.undefined.UndefinedOr[hikari.snowflakes.SnowflakeishOr[hikari.guilds.PartialGuild]]

Object or ID of the guild to edit a command for if this is a guild specific command. Leave this as hikari.undefined.UNDEFINED to delete a global command.

namehikari.undefined.UndefinedOr[str]

The name to set for the command. Leave as hikari.undefined.UNDEFINED to not change.

descriptionhikari.undefined.UndefinedOr[str]

The description to set for the command. Leave as hikari.undefined.UNDEFINED to not change.

optionshikari.undefined.UndefinedOr[typing.Sequence[hikari.commands.CommandOption]]

A sequence of up to 10 options to set for this command. Leave this as hikari.undefined.UNDEFINED to not change.

default_member_permissionstyping.Union[hikari.undefined.UndefinedType, int, hikari.permissions.Permissions]

Member permissions necessary to utilize this command by default.

If 0, then it will be available for all members. Note that this doesn’t affect administrators of the guild and overwrites.

dm_enabledhikari.undefined.UndefinedOr[bool]

Whether this command is enabled in DMs with the bot.

This can only be applied to non-guild commands.

Returns:
hikari.commands.PartialCommand

The edited command object.

Raises:
hikari.errors.ForbiddenError

If you cannot access the provided application’s commands.

hikari.errors.NotFoundError

If the provided application or command isn’t found.

hikari.errors.BadRequestError

If any of the fields that are passed have an invalid value.

hikari.errors.UnauthorizedError

If you are unauthorized to make the request (invalid/missing token).

hikari.errors.RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

hikari.errors.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.

hikari.errors.InternalServerError

If an internal error occurs on Discord while handling the request.

abstract async edit_channel(channel, /, *, name=undefined.UNDEFINED, flags=undefined.UNDEFINED, position=undefined.UNDEFINED, topic=undefined.UNDEFINED, nsfw=undefined.UNDEFINED, bitrate=undefined.UNDEFINED, video_quality_mode=undefined.UNDEFINED, user_limit=undefined.UNDEFINED, rate_limit_per_user=undefined.UNDEFINED, region=undefined.UNDEFINED, permission_overwrites=undefined.UNDEFINED, parent_category=undefined.UNDEFINED, default_auto_archive_duration=undefined.UNDEFINED, default_thread_rate_limit_per_user=undefined.UNDEFINED, default_forum_layout=undefined.UNDEFINED, default_sort_order=undefined.UNDEFINED, available_tags=undefined.UNDEFINED, default_reaction_emoji=undefined.UNDEFINED, archived=undefined.UNDEFINED, locked=undefined.UNDEFINED, invitable=undefined.UNDEFINED, auto_archive_duration=undefined.UNDEFINED, reason=undefined.UNDEFINED)[source]#

Edit a channel.

Parameters:
channelhikari.snowflakes.SnowflakeishOr[hikari.channels.GuildChannel]

The channel to edit. This may be the object or the ID of an existing channel.

Other Parameters:
namehikari.undefined.UndefinedOr[str]

If provided, the new name for the channel.

flagshikari.undefined.UndefinedOr[hikari.channels.ChannelFlag]

If provided, the new flags for the channel

positionhikari.undefined.UndefinedOr[int]

If provided, the new position for the channel.

topichikari.undefined.UndefinedOr[str]

If provided, the new topic for the channel.

nsfwhikari.undefined.UndefinedOr[bool]

If provided, whether the channel should be marked as NSFW or not.

bitratehikari.undefined.UndefinedOr[int]

If provided, the new bitrate for the channel.

video_quality_modehikari.undefined.UndefinedOr[typing.Union[hikari.channels.VideoQualityMode, int]]

If provided, the new video quality mode for the channel.

user_limithikari.undefined.UndefinedOr[int]

If provided, the new user limit in the channel.

rate_limit_per_userhikari.undefined.UndefinedOr[hikari.internal.time.Intervalish]

If provided, the new rate limit per user in the channel.

regionhikari.undefined.UndefinedNoneOr[typing.Union[str, hikari.voices.VoiceRegion]]

If provided, the voice region to set for this channel. Passing None here will set it to “auto” mode where the used region will be decided based on the first person who connects to it when it’s empty.

permission_overwriteshikari.undefined.UndefinedOr[typing.Sequence[hikari.channels.PermissionOverwrite]]

If provided, the new permission overwrites for the channel.

parent_categoryhikari.undefined.UndefinedOr[hikari.snowflakes.SnowflakeishOr[hikari.channels.GuildCategory]]

If provided, the new guild category for the channel.

default_auto_archive_durationhikari.undefined.UndefinedOr[hikari.internal.time.Intervalish]

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 seconds and, as of writing, ignores the parent channel’s set default_auto_archive_duration when passed as hikari.undefined.UNDEFINED.

default_thread_rate_limit_per_userhikari.undefined.UndefinedOr[hikari.internal.time.Intervalish]

If provided, the ratelimit that should be set in threads derived from this channel.

This only applies to forum channels.

default_forum_layouthikari.undefined.UndefinedOr[typing.Union[hikari.channels.ForumLayoutType, int]]

If provided, the default forum layout to show in the client.

default_sort_orderhikari.undefined.UndefinedOr[typing.Union[hikari.channels.ForumSortOrderType, int]]

If provided, the default sort order to show in the client.

available_tagshikari.undefined.UndefinedOr[typing.Sequence[hikari.channels.ForumTag]]

If provided, the new available tags to select from when creating a thread.

This only applies to forum channels.

default_reaction_emojityping.Union[str, hikari.emojis.Emoji, hikari.undefined.UndefinedType, hikari.snowflakes.Snowflake]

If provided, the new default reaction emoji for threads created in a forum channel.

This only applies to forum channels.

archivedhikari.undefined.UndefinedOr[bool]

If provided, whether to archive or unarchive this thread channel.

lockedhikari.undefined.UndefinedOr[bool]

If provided, whether to lock or unlock this thread channel.

If it’s locked then only people with MANAGE_THREADS can unarchive it.

invitableundefined.UndefinedOr[bool]

If provided, whether non-moderators should be able to add other non-moderators to the thread.

This only applies to private threads.

auto_archive_durationhikari.undefined.UndefinedOr[hikari.internal.time.Intervalish]

If provided, how long the thread should remain inactive until it’s archived.

This should be either 60, 1440, 4320 or 10080 seconds and, as of writing, ignores the parent channel’s set default_auto_archive_duration when passed as hikari.undefined.UNDEFINED.

reasonhikari.undefined.UndefinedOr[str]

If provided, the reason that will be recorded in the audit logs. Maximum of 512 characters.

Returns:
hikari.channels.PartialChannel

The edited channel.

Raises:
hikari.errors.BadRequestError

If any of the fields that are passed have an invalid value.

hikari.errors.UnauthorizedError

If you are unauthorized to make the request (invalid/missing token).

hikari.errors.ForbiddenError

If you are missing permissions to edit the channel.

hikari.errors.NotFoundError

If the channel is not found.

hikari.errors.RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

hikari.errors.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.

hikari.errors.InternalServerError

If an internal error occurs on Discord while handling the request.

abstract async edit_emoji(guild, emoji, *, name=undefined.UNDEFINED, roles=undefined.UNDEFINED, reason=undefined.UNDEFINED)[source]#

Edit an emoji in a guild.

Parameters:
guildhikari.snowflakes.SnowflakeishOr[hikari.guilds.PartialGuild]

The guild to edit the emoji on. This can be a guild object or the ID of an existing guild.

emojihikari.snowflakes.SnowflakeishOr[hikari.emojis.CustomEmoji]

The emoji to edit. This can be a hikari.emojis.CustomEmoji or the ID of an existing emoji.

Other Parameters:
namehikari.undefined.UndefinedOr[str]

If provided, the new name for the emoji.

roleshikari.undefined.UndefinedOr[hikari.snowflakes.SnowflakeishSequence[hikari.guilds.PartialRole]]

If provided, the new collection of roles that will be able to use this emoji. This can be a hikari.guilds.PartialRole or the ID of an existing role.

reasonhikari.undefined.UndefinedOr[str]

If provided, the reason that will be recorded in the audit logs. Maximum of 512 characters.

Returns:
hikari.emojis.KnownCustomEmoji

The edited emoji.

Raises:
hikari.errors.BadRequestError

If any of the fields that are passed have an invalid value.

hikari.errors.ForbiddenError

If you are missing MANAGE_EMOJIS_AND_STICKERS in the server.

hikari.errors.NotFoundError

If the guild or the emoji are not found.

hikari.errors.UnauthorizedError

If you are unauthorized to make the request (invalid/missing token).

hikari.errors.RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

hikari.errors.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.

hikari.errors.InternalServerError

If an internal error occurs on Discord while handling the request.

abstract async edit_guild(guild, *, name=undefined.UNDEFINED, verification_level=undefined.UNDEFINED, default_message_notifications=undefined.UNDEFINED, explicit_content_filter_level=undefined.UNDEFINED, afk_channel=undefined.UNDEFINED, afk_timeout=undefined.UNDEFINED, icon=undefined.UNDEFINED, owner=undefined.UNDEFINED, splash=undefined.UNDEFINED, banner=undefined.UNDEFINED, system_channel=undefined.UNDEFINED, rules_channel=undefined.UNDEFINED, public_updates_channel=undefined.UNDEFINED, preferred_locale=undefined.UNDEFINED, reason=undefined.UNDEFINED)[source]#

Edit a guild.

Parameters:
guildhikari.snowflakes.SnowflakeishOr[hikari.guilds.PartialGuild]

The guild to edit. This may be the object or the ID of an existing guild.

Other Parameters:
namehikari.undefined.UndefinedOr[str]

If provided, the new name for the guild.

verification_levelhikari.undefined.UndefinedOr[hikari.guilds.GuildVerificationLevel]

If provided, the new verification level.

default_message_notificationshikari.undefined.UndefinedOr[hikari.guilds.GuildMessageNotificationsLevel]

If provided, the new default message notifications level.

explicit_content_filter_levelhikari.undefined.UndefinedOr[hikari.guilds.GuildExplicitContentFilterLevel]

If provided, the new explicit content filter level.

afk_channelhikari.undefined.UndefinedOr[hikari.snowflakes.SnowflakeishOr[hikari.channels.GuildVoiceChannel]]

If provided, the new afk channel. Requires afk_timeout to be set to work.

afk_timeouthikari.undefined.UndefinedOr[hikari.internal.time.Intervalish]

If provided, the new afk timeout.

iconhikari.undefined.UndefinedOr[hikari.files.Resourceish]

If provided, the new guild icon. Must be a 1024x1024 image or can be an animated gif when the guild has the ANIMATED_ICON feature.

ownerhikari.undefined.UndefinedOr[hikari.snowflakes.SnowflakeishOr[hikari.users.PartialUser]]]

If provided, the new guild owner.

Warning

You need to be the owner of the server to use this.

splashhikari.undefined.UndefinedNoneOr[hikari.files.Resourceish]

If provided, the new guild splash. Must be a 16:9 image and the guild must have the INVITE_SPLASH feature.

bannerhikari.undefined.UndefinedNoneOr[hikari.files.Resourceish]

If provided, the new guild banner. Must be a 16:9 image and the guild must have the BANNER feature.

system_channelhikari.undefined.UndefinedNoneOr[hikari.snowflakes.SnowflakeishOr[hikari.channels.GuildTextChannel]]

If provided, the new system channel.

rules_channelhikari.undefined.UndefinedNoneOr[hikari.snowflakes.SnowflakeishOr[hikari.channels.GuildTextChannel]]

If provided, the new rules channel.

public_updates_channelhikari.undefined.UndefinedNoneOr[hikari.snowflakes.SnowflakeishOr[hikari.channels.GuildTextChannel]]

If provided, the new public updates channel.

preferred_localehikari.undefined.UndefinedNoneOr[str]

If provided, the new preferred locale.

reasonhikari.undefined.UndefinedOr[str]

If provided, the reason that will be recorded in the audit logs. Maximum of 512 characters.

Returns:
hikari.guilds.RESTGuild

The edited guild.

Raises:
hikari.errors.BadRequestError

If any of the fields that are passed have an invalid value. Or you are missing the

hikari.errors.ForbiddenError

If you are missing the MANAGE_GUILD permission or if you tried to pass ownership without being the server owner.

hikari.errors.UnauthorizedError

If you are unauthorized to make the request (invalid/missing token).

hikari.errors.NotFoundError

If the guild is not found.

hikari.errors.RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

hikari.errors.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.

hikari.errors.InternalServerError

If an internal error occurs on Discord while handling the request.

abstract async edit_interaction_response(application, token, content=undefined.UNDEFINED, *, attachment=undefined.UNDEFINED, attachments=undefined.UNDEFINED, component=undefined.UNDEFINED, components=undefined.UNDEFINED, embed=undefined.UNDEFINED, embeds=undefined.UNDEFINED, mentions_everyone=undefined.UNDEFINED, user_mentions=undefined.UNDEFINED, role_mentions=undefined.UNDEFINED)[source]#

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.

Parameters:
applicationhikari.snowflakes.SnowflakeishOr[hikari.guilds.PartialApplication]

Object or ID of the application to edit a command response for.

tokenstr

The interaction’s token.

Other Parameters:
contenthikari.undefined.UndefinedOr[typing.Any]

If provided, the message content to update with. If hikari.undefined.UNDEFINED, then the content will not be changed. If None, then the content will be removed.

Any other value will be cast to a str before sending.

If this is a hikari.embeds.Embed and neither the embed or embeds kwargs are provided or if this is a hikari.files.Resourceish and neither the attachment or attachments kwargs are provided, the values will be overwritten. This allows for simpler syntax when sending an embed or an attachment alone.

attachmenthikari.undefined.UndefinedNoneOr[typing.Union[hikari.files.Resourceish, hikari.messages.Attachment]]

If provided, the attachment to set on the message. If hikari.undefined.UNDEFINED, the previous attachment, if present, is not changed. If this is None, then the attachment is removed, if present. Otherwise, the new attachment that was provided will be attached.

attachmentshikari.undefined.UndefinedNoneOr[typing.Sequence[typing.Union[hikari.files.Resourceish, hikari.messages.Attachment]]]

If provided, the attachments to set on the message. If hikari.undefined.UNDEFINED, the previous attachments, if present, are not changed. If this is None, then the attachments is removed, if present. Otherwise, the new attachments that were provided will be attached.

componenthikari.undefined.UndefinedNoneOr[hikari.api.special_endpoints.ComponentBuilder]

If provided, builder object of the component to set for this message. This component will replace any previously set components and passing None will remove all components.

componentshikari.undefined.UndefinedNoneOr[typing.Sequence[hikari.api.special_endpoints.ComponentBuilder]]

If provided, a sequence of the component builder objects set for this message. These components will replace any previously set components and passing None or an empty sequence will remove all components.

embedhikari.undefined.UndefinedNoneOr[hikari.embeds.Embed]

If provided, the embed to set on the message. If hikari.undefined.UNDEFINED, the previous embed(s) are not changed. If this is None then any present embeds are removed. Otherwise, the new embed that was provided will be used as the replacement.

embedshikari.undefined.UndefinedNoneOr[typing.Sequence[hikari.embeds.Embed]]

If provided, the embeds to set on the message. If hikari.undefined.UNDEFINED, the previous embed(s) are not changed. If this is None then any present embeds are removed. Otherwise, the new embeds that were provided will be used as the replacement.

mentions_everyonehikari.undefined.UndefinedOr[bool]

If provided, whether the message should parse @everyone/@here mentions.

user_mentionshikari.undefined.UndefinedOr[typing.Union[hikari.snowflakes.SnowflakeishSequence[hikari.users.PartialUser], bool]]

If provided, and True, all user mentions will be detected. If provided, and False, all user mentions will be ignored if appearing in the message body. Alternatively this may be a collection of hikari.snowflakes.Snowflake, or hikari.users.PartialUser derivatives to enforce mentioning specific users.

role_mentionshikari.undefined.UndefinedOr[typing.Union[hikari.snowflakes.SnowflakeishSequence[hikari.guilds.PartialRole], bool]]

If provided, and True, all role mentions will be detected. If provided, and False, all role mentions will be ignored if appearing in the message body. Alternatively this may be a collection of hikari.snowflakes.Snowflake, or hikari.guilds.PartialRole derivatives to enforce mentioning specific roles.

Returns:
hikari.messages.Message

The edited message.

Raises:
ValueError

If both attachment and attachments, component and components or embed and embeds are specified.

hikari.errors.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.

hikari.errors.UnauthorizedError

If you are unauthorized to make the request (invalid/missing token).

hikari.errors.NotFoundError

If the interaction or the message are not found.

hikari.errors.RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

hikari.errors.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.

hikari.errors.InternalServerError

If an internal error occurs on Discord while handling the request.

abstract async edit_member(guild, user, *, nickname=undefined.UNDEFINED, roles=undefined.UNDEFINED, mute=undefined.UNDEFINED, deaf=undefined.UNDEFINED, voice_channel=undefined.UNDEFINED, communication_disabled_until=undefined.UNDEFINED, reason=undefined.UNDEFINED)[source]#

Edit a guild member.

Parameters:
guildhikari.snowflakes.SnowflakeishOr[hikari.guilds.PartialGuild]

The guild to edit. This may be the object or the ID of an existing guild.

userhikari.snowflakes.SnowflakeishOr[hikari.users.PartialUser]

The user to edit. This may be the object or the ID of an existing user.

Other Parameters:
nicknamehikari.undefined.UndefinedNoneOr[str]

If provided, the new nick for the member. If None, will remove the members nick.

Requires the MANAGE_NICKNAMES permission.

roleshikari.undefined.UndefinedOr[hikari.snowflakes.SnowflakeishSequence[hikari.guilds.PartialRole]]

If provided, the new roles for the member.

Requires the MANAGE_ROLES permission.

mutehikari.undefined.UndefinedOr[bool]

If provided, the new server mute state for the member.

Requires the MUTE_MEMBERS permission.

deafhikari.undefined.UndefinedOr[bool]

If provided, the new server deaf state for the member.

Requires the DEAFEN_MEMBERS permission.

voice_channelhikari.undefined.UndefinedOr[hikari.snowflakes.SnowflakeishOr[hikari.channels.GuildVoiceChannel]]]

If provided, None or the object or the ID of an existing voice channel to move the member to. If None, will disconnect the member from voice.

Requires the MOVE_MEMBERS permission and the CONNECT permission in the original voice channel and the target voice channel.

Note

If the member is not in a voice channel, this will take no effect.

communication_disabled_untilhikari.undefined.UndefinedNoneOr[datetime.datetime]

If provided, the datetime when the timeout (disable communication) of the member expires, up to 28 days in the future, or None to remove the timeout from the member.

Requires the MODERATE_MEMBERS permission.

reasonhikari.undefined.UndefinedOr[str]

If provided, the reason that will be recorded in the audit logs. Maximum of 512 characters.

Returns:
hikari.guilds.Member

Object of the member that was updated.

Raises:
hikari.errors.BadRequestError

If any of the fields that are passed have an invalid value.

hikari.errors.ForbiddenError

If you are missing a permission to do an action.

hikari.errors.UnauthorizedError

If you are unauthorized to make the request (invalid/missing token).

hikari.errors.NotFoundError

If the guild or the user are not found.

hikari.errors.RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

hikari.errors.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.

hikari.errors.InternalServerError

If an internal error occurs on Discord while handling the request.

abstract async edit_message(channel, message, content=undefined.UNDEFINED, *, attachment=undefined.UNDEFINED, attachments=undefined.UNDEFINED, component=undefined.UNDEFINED, components=undefined.UNDEFINED, embed=undefined.UNDEFINED, embeds=undefined.UNDEFINED, mentions_everyone=undefined.UNDEFINED, mentions_reply=undefined.UNDEFINED, user_mentions=undefined.UNDEFINED, role_mentions=undefined.UNDEFINED, flags=undefined.UNDEFINED)[source]#

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.

Parameters:
channelhikari.snowflakes.SnowflakeishOr[hikari.channels.TextableChannel]

The channel to create the message in. This may be the object or the ID of an existing channel.

messagehikari.snowflakes.SnowflakeishOr[hikari.messages.PartialMessage]

The message to edit. This may be the object or the ID of an existing message.

contenthikari.undefined.UndefinedOr[typing.Any]

If provided, the message content to update with. If hikari.undefined.UNDEFINED, then the content will not be changed. If None, then the content will be removed.

Any other value will be cast to a str before sending.

If this is a hikari.embeds.Embed and neither the embed or embeds kwargs are provided or if this is a hikari.files.Resourceish and neither the attachment or attachments kwargs are provided, the values will be overwritten. This allows for simpler syntax when sending an embed or an attachment alone.

Other Parameters:
attachmenthikari.undefined.UndefinedNoneOr[typing.Union[hikari.files.Resourceish, hikari.messages.Attachment]]

If provided, the attachment to set on the message. If hikari.undefined.UNDEFINED, the previous attachment, if present, is not changed. If this is None, then the attachment is removed, if present. Otherwise, the new attachment that was provided will be attached.

attachmentshikari.undefined.UndefinedNoneOr[typing.Sequence[typing.Union[hikari.files.Resourceish, hikari.messages.Attachment]]]

If provided, the attachments to set on the message. If hikari.undefined.UNDEFINED, the previous attachments, if present, are not changed. If this is None, then the attachments is removed, if present. Otherwise, the new attachments that were provided will be attached.

componenthikari.undefined.UndefinedNoneOr[hikari.api.special_endpoints.ComponentBuilder]

If provided, builder object of the component to set for this message. This component will replace any previously set components and passing None will remove all components.

componentshikari.undefined.UndefinedNoneOr[typing.Sequence[hikari.api.special_endpoints.ComponentBuilder]]

If provided, a sequence of the component builder objects set for this message. These components will replace any previously set components and passing None or an empty sequence will remove all components.

embedhikari.undefined.UndefinedNoneOr[hikari.embeds.Embed]

If provided, the embed to set on the message. If hikari.undefined.UNDEFINED, the previous embed(s) are not changed. If this is None then any present embeds are removed. Otherwise, the new embed that was provided will be used as the replacement.

embedshikari.undefined.UndefinedNoneOr[typing.Sequence[hikari.embeds.Embed]]

If provided, the embeds to set on the message. If hikari.undefined.UNDEFINED, the previous embed(s) are not changed. If this is None then any present embeds are removed. Otherwise, the new embeds that were provided will be used as the replacement.

mentions_everyonehikari.undefined.UndefinedOr[bool]

If provided, sanitation for @everyone mentions. If hikari.undefined.UNDEFINED, then the previous setting is not changed. If True, then @everyone/@here mentions in the message content will show up as mentioning everyone that can view the chat.

mentions_replyhikari.undefined.UndefinedOr[bool]

If provided, whether to mention the author of the message that is being replied to.

This will not do anything if message is not a reply message.

user_mentionshikari.undefined.UndefinedOr[typing.Union[hikari.snowflakes.SnowflakeishSequence[hikari.users.PartialUser], bool]]

If provided, sanitation for user mentions. If hikari.undefined.UNDEFINED, then the previous setting is not changed. If True, all valid user mentions will behave as mentions. If False, all valid user mentions will not behave as mentions.

You may alternatively pass a collection of hikari.snowflakes.Snowflake user IDs, or hikari.users.PartialUser-derived objects.

role_mentionshikari.undefined.UndefinedOr[typing.Union[hikari.snowflakes.SnowflakeishSequence[hikari.guilds.PartialRole], bool]]

If provided, sanitation for role mentions. If hikari.undefined.UNDEFINED, then the previous setting is not changed. If True, all valid role mentions will behave as mentions. If False, all valid role mentions will not behave as mentions.

You may alternatively pass a collection of hikari.snowflakes.Snowflake role IDs, or hikari.guilds.PartialRole-derived objects.

flagshikari.undefined.UndefinedOr[hikari.messages.MessageFlag]

If provided, optional flags to set on the message. If hikari.undefined.UNDEFINED, then nothing is changed.

Note that some flags may not be able to be set. Currently the only flags that can be set are NONE and SUPPRESS_EMBEDS. If you have MANAGE_MESSAGES permissions, you can use this call to suppress embeds on another user’s message.

Returns:
hikari.messages.Message

The edited message.

Raises:
ValueError

If both attachment and attachments, component and components or embed and embeds are specified.

hikari.errors.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.

hikari.errors.UnauthorizedError

If you are unauthorized to make the request (invalid/missing token).

hikari.errors.ForbiddenError

If you are missing the SEND_MESSAGES in the channel; if you try to change the contents of another user’s message; or if you try to edit the flags on another user’s message without the MANAGE_MESSAGES permission.

hikari.errors.NotFoundError

If the channel or message is not found.

hikari.errors.RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

hikari.errors.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.

hikari.errors.InternalServerError

If an internal error occurs on Discord while handling the request.

abstract async edit_my_member(guild, *, nickname=undefined.UNDEFINED, reason=undefined.UNDEFINED)[source]#

Edit the current user’s member in a guild.

Parameters:
guildhikari.snowflakes.SnowflakeishOr[hikari.guilds.PartialGuild]

The guild to edit the member in. This may be the object or the ID of an existing guild.

Other Parameters:
nicknamehikari.undefined.UndefinedNoneOr[str]

If provided, the new nickname for the member. If None, will remove the members nickname.

Requires the CHANGE_NICKNAME permission. If provided, the reason that will be recorded in the audit logs. Maximum of 512 characters.

reasonhikari.undefined.UndefinedOr[str]

If provided, the reason that will be recorded in the audit logs. Maximum of 512 characters.

Returns:
hikari.guilds.Member

Object of the member that was updated.

Raises:
hikari.errors.BadRequestError

If any of the fields that are passed have an invalid value.

hikari.errors.ForbiddenError

If you are missing a permission to do an action.

hikari.errors.UnauthorizedError

If you are unauthorized to make the request (invalid/missing token).

hikari.errors.NotFoundError

If the guild is not found.

hikari.errors.RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

hikari.errors.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.

hikari.errors.InternalServerError

If an internal error occurs on Discord while handling the request.

abstract async edit_my_user(*, username=undefined.UNDEFINED, avatar=undefined.UNDEFINED)[source]#

Edit the token’s associated user.

Other Parameters:
usernameundefined.UndefinedOr[str]

If provided, the new username.

avatarundefined.UndefinedNoneOr[hikari.files.Resourceish]

If provided, the new avatar. If None, the avatar will be removed.

Returns:
hikari.users.OwnUser

The edited token’s associated user.

Raises:
hikari.errors.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>

hikari.errors.UnauthorizedError

If you are unauthorized to make the request (invalid/missing token).

hikari.errors.InternalServerError

If an internal error occurs on Discord while handling the request.

abstract async edit_my_voice_state(guild, channel, *, suppress=undefined.UNDEFINED, request_to_speak=undefined.UNDEFINED)[source]#

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.

Parameters:
guildhikari.snowflakes.SnowflakeishOr[hikari.guilds.PartialGuild]

Object or Id of the guild to edit a voice state in.

channelhikari.snowflakes.SnowflakeishOr[hikari.channels.GuildStageChannel]

Object or Id of the channel to edit a voice state in.

Other Parameters:
suppresshikari.undefined.UndefinedOr[bool]

If specified, whether the user should be allowed to become a speaker in the target stage channel with builtin.True suppressing them from becoming one.

request_to_speaktyping.Union[hikari.undefined.UndefinedType, bool, datetime.datetime]

Whether to request to speak. This may be one of the following:

  • True to indicate that the bot wants to speak.

  • False to remove any previously set request to speak.

  • datetime.datetime to specify when they want their request to

    speak timestamp to be set to. If a datetime from the past is passed then Discord will use the current time instead.

Raises:
hikari.errors.BadRequestError

If you try to target a non-staging channel.

hikari.errors.UnauthorizedError

If you are unauthorized to make the request (invalid/missing token).

hikari.errors.ForbiddenError

If you are missing the MUTE_MEMBERS permission in the channel.

hikari.errors.NotFoundError

If the channel, message or voice state is not found.

hikari.errors.RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

hikari.errors.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.

hikari.errors.InternalServerError

If an internal error occurs on Discord while handling the request.

abstract async edit_permission_overwrite(channel, target, *, allow=undefined.UNDEFINED, deny=undefined.UNDEFINED, reason=undefined.UNDEFINED)[source]#
abstract async edit_permission_overwrite(channel: hikari.snowflakes.SnowflakeishOr[hikari.channels.GuildChannel], target: hikari.snowflakes.Snowflakeish, *, target_type: Union[hikari.channels.PermissionOverwriteType, int], allow: hikari.undefined.UndefinedOr[hikari.permissions.Permissions] = undefined.UNDEFINED, deny: hikari.undefined.UndefinedOr[hikari.permissions.Permissions] = undefined.UNDEFINED, reason: hikari.undefined.UndefinedOr[str] = undefined.UNDEFINED) None

Edit permissions for a specific entity in the given guild channel.

Parameters:
channelhikari.snowflakes.SnowflakeishOr[hikari.channels.GuildChannel]

The channel to edit a permission overwrite in. This may be the object, or the ID of an existing channel.

targettyping.Union[hikari.users.PartialUser, hikari.guilds.PartialRole, hikari.channels.PermissionOverwrite, hikari.snowflakes.Snowflakeish]

The channel overwrite to edit. This may be the object or the ID of an existing overwrite.

Other Parameters:
target_typehikari.undefined.UndefinedOr[typing.Union[hikari.channels.PermissionOverwriteType, int]]

If provided, the type of the target to update. If unset, will attempt to get the type from target.

allowhikari.undefined.UndefinedOr[hikari.permissions.Permissions]

If provided, the new value of all allowed permissions.

denyhikari.undefined.UndefinedOr[hikari.permissions.Permissions]

If provided, the new value of all disallowed permissions.

reasonhikari.undefined.UndefinedOr[str]

If provided, the reason that will be recorded in the audit logs. Maximum of 512 characters.

Raises:
TypeError

If target_type is unset and we were unable to determine the type from target.

hikari.errors.BadRequestError

If any of the fields that are passed have an invalid value.

hikari.errors.UnauthorizedError

If you are unauthorized to make the request (invalid/missing token).

hikari.errors.ForbiddenError

If you are missing the MANAGE_PERMISSIONS permission in the channel.

hikari.errors.NotFoundError

If the channel is not found or the target is not found if it is a role.

hikari.errors.RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

hikari.errors.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.

hikari.errors.InternalServerError

If an internal error occurs on Discord while handling the request.

abstract async edit_role(guild, role, *, name=undefined.UNDEFINED, permissions=undefined.UNDEFINED, color=undefined.UNDEFINED, colour=undefined.UNDEFINED, hoist=undefined.UNDEFINED, icon=undefined.UNDEFINED, unicode_emoji=undefined.UNDEFINED, mentionable=undefined.UNDEFINED, reason=undefined.UNDEFINED)[source]#

Edit a role.

Parameters:
guildhikari.snowflakes.SnowflakeishOr[hikari.guilds.PartialGuild]

The guild to edit the role in. This may be the object or the ID of an existing guild.

rolehikari.snowflakes.SnowflakeishOr[hikari.guilds.PartialRole]

The role to edit. This may be the object or the ID of an existing role.

Other Parameters:
namehikari.undefined.UndefinedOr[str]

If provided, the new name for the role.

permissionshikari.undefined.UndefinedOr[hikari.permissions.Permissions]

If provided, the new permissions for the role.

colorhikari.undefined.UndefinedOr[hikari.colors.Colorish]

If provided, the new color for the role.

colourhikari.undefined.UndefinedOr[hikari.colors.Colorish]

An alias for color.

hoisthikari.undefined.UndefinedOr[bool]

If provided, whether to hoist the role.

iconhikari.undefined.UndefinedNoneOr[hikari.files.Resourceish]

If provided, the new role icon. Must be a 64x64 image under 256kb.

unicode_emojihikari.undefined.UndefinedNoneOr[str]

If provided, the new unicode emoji to set as the role icon.

mentionablehikari.undefined.UndefinedOr[bool]

If provided, whether to make the role mentionable.

reasonhikari.undefined.UndefinedOr[str]

If provided, the reason that will be recorded in the audit logs. Maximum of 512 characters.

Returns:
hikari.guilds.Role

The edited role.

Raises:
TypeError

If both color and colour are specified or if both icon and unicode_emoji are specified.

hikari.errors.BadRequestError

If any of the fields that are passed have an invalid value.

hikari.errors.ForbiddenError

If you are missing the MANAGE_ROLES permission.

hikari.errors.UnauthorizedError

If you are unauthorized to make the request (invalid/missing token).

hikari.errors.NotFoundError

If the guild or role are not found.

hikari.errors.RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

hikari.errors.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.

hikari.errors.InternalServerError

If an internal error occurs on Discord while handling the request.

abstract async edit_scheduled_event(guild, event, /, *, channel=undefined.UNDEFINED, description=undefined.UNDEFINED, entity_type=undefined.UNDEFINED, image=undefined.UNDEFINED, location=undefined.UNDEFINED, name=undefined.UNDEFINED, privacy_level=undefined.UNDEFINED, start_time=undefined.UNDEFINED, end_time=undefined.UNDEFINED, status=undefined.UNDEFINED, reason=undefined.UNDEFINED)[source]#

Edit a scheduled event.

Parameters:
guildhikari.snowflakes.SnowflakeishOr[hikari.guilds.PartialGuild]

The guild to edit the event in.

eventhikari.snowflakes.SnowflakeishOr[hikari.scheduled_events.ScheduledEvent]

The scheduled event to edit.

Other Parameters:
channelhikari.undefined.UndefinedNoneOr[hikari.snowflakes.SnowflakeishOr[hikari.channels.PartialChannel]]

The channel a VOICE or STAGE event should be associated with.

descriptionhikari.undefined.UndefinedNoneOr[str]

The event’s description.

entity_typehikari.undefined.UndefinedOr[hikari.scheduled_events.ScheduledEventType]

The type of entity the event should target.

imagehikari.undefined.UndefinedOr[hikari.files.Resourceish]

The event’s display image.

locationhikari.undefined.UndefinedOr[str]

The location of an EXTERNAL event.

Must be passed when changing an event to EXTERNAL.

namehikari.undefined.UndefinedOr[str]

The event’s name.

privacy_levelhikari.undefined.UndefinedOr[hikari.scheduled_events.EventPrivacyLevel]

The event’s privacy level.

This effects who can view and subscribe to the event.

start_timehikari.undefined.UndefinedOr[datetime.datetime]

When the event should be scheduled to start.

end_timehikari.undefined.UndefinedNoneOr[datetime.datetime]

When the event should be scheduled to end.

This can only be set to None for STAGE and VOICE events. Must be provided when changing an event to EXTERNAL.

statushikari.undefined.UndefinedOr[hikari.scheduled_events.ScheduledEventStatus]

The event’s new status.

SCHEDULED events can be set to ACTIVE and CANCELED. ACTIVE events can only be set to COMPLETED.

reasonhikari.undefined.UndefinedOr[str]

If provided, the reason that will be recorded in the audit logs. Maximum of 512 characters.

Returns:
hikari.scheduled_events.ScheduledEvent

The edited scheduled event.

Raises:
hikari.errors.BadRequestError

If any of the fields that are passed have an invalid value.

hikari.errors.UnauthorizedError

If you are unauthorized to make the request (invalid/missing token).

hikari.errors.ForbiddenError

If you are missing permissions to edit the scheduled event.

For VOICE and STAGE_INSTANCE events, you need the following permissions in the event’s associated channel: MANAGE_EVENTS, VIEW_CHANNEL and CONNECT.

For EXTERNAL events you just need the MANAGE_EVENTS permission.

hikari.errors.NotFoundError

If the guild or event is not found.

hikari.errors.RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

hikari.errors.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.

hikari.errors.InternalServerError

If an internal error occurs on Discord while handling the request.

abstract async edit_sticker(guild, sticker, *, name=undefined.UNDEFINED, description=undefined.UNDEFINED, tag=undefined.UNDEFINED, reason=undefined.UNDEFINED)[source]#

Edit a sticker in a guild.

Parameters:
guildhikari.snowflakes.SnowflakeishOr[hikari.guilds.PartialGuild]

The guild to edit the sticker on. This can be a guild object or the ID of an existing guild.

stickerhikari.snowflakes.SnowflakeishOr[hikari.stickers.PartialSticker]

The sticker to edit. This can be a sticker object or the ID of an existing sticker.

Other Parameters:
namehikari.undefined.UndefinedOr[str]

If provided, the new name for the sticker.

descriptionhikari.undefined.UndefinedOr[str]

If provided, the new description for the sticker.

taghikari.undefined.UndefinedOr[str]

If provided, the new sticker tag.

reasonhikari.undefined.UndefinedOr[str]

If provided, the reason that will be recorded in the audit logs. Maximum of 512 characters.

Returns:
hikari.stickers.GuildSticker

The edited sticker.

Raises:
hikari.errors.BadRequestError

If any of the fields that are passed have an invalid value.

hikari.errors.ForbiddenError

If you are missing MANAGE_EMOJIS_AND_STICKERS in the server.

hikari.errors.NotFoundError

If the guild or the sticker are not found.

hikari.errors.UnauthorizedError

If you are unauthorized to make the request (invalid/missing token).

hikari.errors.RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

hikari.errors.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.

hikari.errors.InternalServerError

If an internal error occurs on Discord while handling the request.

abstract async edit_template(guild, template, *, name=undefined.UNDEFINED, description=undefined.UNDEFINED)[source]#

Modify a guild template.

Parameters:
guildhikari.snowflakes.SnowflakeishOr[hikari.guilds.PartialGuild]

The guild to edit a template in.

templatetyping.Union[str, hikari.templates.Template]

Object or string code of the template to modify.

Other Parameters:
namehikari.undefined.UndefinedOr[str]

The name to set for this template.

descriptionhikari.undefined.UndefinedNoneOr[str]

The description to set for the template.

Returns:
hikari.templates.Template

The object of the edited template.

Raises:
hikari.errors.ForbiddenError

If you are not part of the guild.

hikari.errors.NotFoundError

If the guild is not found or you are missing the MANAGE_GUILD permission.

hikari.errors.UnauthorizedError

If you are unauthorized to make the request (invalid/missing token).

hikari.errors.RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

hikari.errors.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.

hikari.errors.InternalServerError

If an internal error occurs on Discord while handling the request.

abstract async edit_voice_state(guild, channel, user, *, suppress=undefined.UNDEFINED)[source]#

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.

Parameters:
guildhikari.snowflakes.SnowflakeishOr[hikari.guilds.PartialGuild]

Object or Id of the guild to edit a voice state in.

channelhikari.snowflakes.SnowflakeishOr[hikari.channels.GuildStageChannel]

Object or Id of the channel to edit a voice state in.

userhikari.snowflakes.SnowflakeishOr[hikari.users.PartialUser]

Object or Id of the user to to edit the voice state of.

Other Parameters:
suppresshikari.undefined.UndefinedOr[bool]

If defined, whether the user should be allowed to become a speaker in the target stage channel.

Raises:
hikari.errors.BadRequestError

If you try to target a non-staging channel.

hikari.errors.UnauthorizedError

If you are unauthorized to make the request (invalid/missing token).

hikari.errors.ForbiddenError

If you are missing the MUTE_MEMBERS permission in the channel.

hikari.errors.NotFoundError

If the channel, message or voice state is not found.

hikari.errors.RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

hikari.errors.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.

hikari.errors.InternalServerError

If an internal error occurs on Discord while handling the request.

abstract async edit_webhook(webhook, *, token=undefined.UNDEFINED, name=undefined.UNDEFINED, avatar=undefined.UNDEFINED, channel=undefined.UNDEFINED, reason=undefined.UNDEFINED)[source]#

Edit a webhook.

Parameters:
webhookhikari.snowflakes.SnowflakeishOr[hikari.webhooks.PartialWebhook]

The webhook to edit. This may be the object or the ID of an existing webhook.

Other Parameters:
tokenhikari.undefined.UndefinedOr[str]

If provided, the webhook token that will be used to edit the webhook instead of the token the client was initialized with.

namehikari.undefined.UndefinedOr[str]

If provided, the new webhook name.

avatarhikari.undefined.UndefinedNoneOr[hikari.files.Resourceish]

If provided, the new webhook avatar. If None, will remove the webhook avatar.

channelhikari.undefined.UndefinedOr[hikari.snowflakes.SnowflakeishOr[hikari.channels.WebhookChannelT]]

If provided, the text channel to move the webhook to.

reasonhikari.undefined.UndefinedOr[str]

If provided, the reason that will be recorded in the audit logs. Maximum of 512 characters.

Returns:
hikari.webhooks.PartialWebhook

The edited webhook.

Raises:
hikari.errors.ForbiddenError

If you are missing the MANAGE_WEBHOOKS permission when not using a token.

hikari.errors.UnauthorizedError

If you are unauthorized to make the request (invalid/missing token).

hikari.errors.NotFoundError

If the webhook is not found.

hikari.errors.RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

hikari.errors.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.

hikari.errors.InternalServerError

If an internal error occurs on Discord while handling the request.

abstract async edit_webhook_message(webhook, token, message, content=undefined.UNDEFINED, *, thread=undefined.UNDEFINED, attachment=undefined.UNDEFINED, attachments=undefined.UNDEFINED, component=undefined.UNDEFINED, components=undefined.UNDEFINED, embed=undefined.UNDEFINED, embeds=undefined.UNDEFINED, mentions_everyone=undefined.UNDEFINED, user_mentions=undefined.UNDEFINED, role_mentions=undefined.UNDEFINED)[source]#

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.

Parameters:
webhooktyping.Union[hikari.snowflakes.Snowflakeish, hikari.webhooks.ExecutableWebhook]

The webhook to execute. This may be the object or the ID of an existing webhook.

tokenstr

The webhook token.

messagehikari.snowflakes.SnowflakeishOr[hikari.messages.PartialMessage]

The message to delete. This may be the object or the ID of an existing message.

contenthikari.undefined.UndefinedOr[typing.Any]

If provided, the message content to update with. If hikari.undefined.UNDEFINED, then the content will not be changed. If None, then the content will be removed.

Any other value will be cast to a str before sending.

If this is a hikari.embeds.Embed and neither the embed or embeds kwargs are provided or if this is a hikari.files.Resourceish and neither the attachment or attachments kwargs are provided, the values will be overwritten. This allows for simpler syntax when sending an embed or an attachment alone.

Other Parameters:
threadhikari.undefined.UndefinedOr[hikari.snowflakes.SnowflakeishOr[hikari.channels.GuildThreadChannel]]

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.

attachmenthikari.undefined.UndefinedNoneOr[typing.Union[hikari.files.Resourceish, hikari.messages.Attachment]]

If provided, the attachment to set on the message. If hikari.undefined.UNDEFINED, the previous attachment, if present, is not changed. If this is None, then the attachment is removed, if present. Otherwise, the new attachment that was provided will be attached.

attachmentshikari.undefined.UndefinedNoneOr[typing.Sequence[typing.Union[hikari.files.Resourceish, hikari.messages.Attachment]]]

If provided, the attachments to set on the message. If hikari.undefined.UNDEFINED, the previous attachments, if present, are not changed. If this is None, then the attachments is removed, if present. Otherwise, the new attachments that were provided will be attached.

componenthikari.undefined.UndefinedNoneOr[hikari.api.special_endpoints.ComponentBuilder]

If provided, builder object of the component to set for this message. This component will replace any previously set components and passing None will remove all components.

componentshikari.undefined.UndefinedNoneOr[typing.Sequence[hikari.api.special_endpoints.ComponentBuilder]]

If provided, a sequence of the component builder objects set for this message. These components will replace any previously set components and passing None or an empty sequence will remove all components.

embedhikari.undefined.UndefinedNoneOr[hikari.embeds.Embed]

If provided, the embed to set on the message. If hikari.undefined.UNDEFINED, the previous embed(s) are not changed. If this is None then any present embeds are removed. Otherwise, the new embed that was provided will be used as the replacement.

embedshikari.undefined.UndefinedNoneOr[typing.Sequence[hikari.embeds.Embed]]

If provided, the embeds to set on the message. If hikari.undefined.UNDEFINED, the previous embed(s) are not changed. If this is None then any present embeds are removed. Otherwise, the new embeds that were provided will be used as the replacement.

mentions_everyonehikari.undefined.UndefinedOr[bool]

If provided, sanitation for @everyone mentions. If hikari.undefined.UNDEFINED, then the previous setting is not changed. If True, then @everyone/@here mentions in the message content will show up as mentioning everyone that can view the chat.

user_mentionshikari.undefined.UndefinedOr[typing.Union[hikari.snowflakes.SnowflakeishSequence[hikari.users.PartialUser], bool]]

If provided, and True, all user mentions will be detected. If provided, and False, all user mentions will be ignored if appearing in the message body. Alternatively this may be a collection of hikari.snowflakes.Snowflake, or hikari.users.PartialUser derivatives to enforce mentioning specific users.

role_mentionshikari.undefined.UndefinedOr[typing.Union[hikari.snowflakes.SnowflakeishSequence[hikari.guilds.PartialRole], bool]]

If provided, and True, all role mentions will be detected. If provided, and False, all role mentions will be ignored if appearing in the message body. Alternatively this may be a collection of hikari.snowflakes.Snowflake, or hikari.guilds.PartialRole derivatives to enforce mentioning specific roles.

Returns:
hikari.messages.Message

The edited message.

Raises:
ValueError

If both attachment and attachments, component and components or embed and embeds are specified.

hikari.errors.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.

hikari.errors.UnauthorizedError

If you are unauthorized to make the request (invalid/missing token).

hikari.errors.NotFoundError

If the webhook or the message are not found.

hikari.errors.RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

hikari.errors.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.

hikari.errors.InternalServerError

If an internal error occurs on Discord while handling the request.

abstract async edit_welcome_screen(guild, *, description=undefined.UNDEFINED, enabled=undefined.UNDEFINED, channels=undefined.UNDEFINED)[source]#

Edit the welcome screen of a community guild.

Parameters:
guildhikari.snowflakes.SnowflakeishOr[hikari.guilds.PartialGuild]

ID or object of the guild to edit the welcome screen for.

Other Parameters:
descriptionundefined.UndefinedNoneOr[str]

If provided, the description to set for the guild’s welcome screen. This may be None to unset the description.

enabledundefined.UndefinedOr[bool]

If provided, Whether the guild’s welcome screen should be enabled.

channelshikari.undefined.UndefinedNoneOr[typing.Sequence[hikari.guilds.WelcomeChannel]]

If provided, a sequence of up to 5 public channels to set in this guild’s welcome screen. This may be passed as None to remove all welcome channels

Note

Custom emojis may only be included in a guild’s welcome channels if it’s boost status is tier 2 or above.

Returns:
hikari.guilds.WelcomeScreen

The edited guild welcome screen.

Raises:
hikari.errors.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.

hikari.errors.ForbiddenError

If you are missing the MANAGE_GUILD permission, are not part of the guild or the guild doesn’t have access to the community welcome screen feature.

hikari.errors.NotFoundError

If the guild is not found.

hikari.errors.UnauthorizedError

If you are unauthorized to make the request (invalid/missing token).

hikari.errors.RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

hikari.errors.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.

hikari.errors.InternalServerError

If an internal error occurs on Discord while handling the request.

abstract async edit_widget(guild, *, channel=undefined.UNDEFINED, enabled=undefined.UNDEFINED, reason=undefined.UNDEFINED)[source]#

Fetch a guilds’s widget.

Parameters:
guildhikari.snowflakes.SnowflakeishOr[hikari.guilds.PartialGuild]

The guild to edit the widget in. This can be the object or the ID of an existing guild.

Other Parameters:
channelhikari.undefined.UndefinedNoneOr[hikari.snowflakes.SnowflakeishOr[hikari.channels.GuildChannel]]

If provided, the channel to set the widget to. If None, will not set to any.

enabledhikari.undefined.UndefinedOr[bool]

If provided, whether to enable the widget.

reasonhikari.undefined.UndefinedOr[str]

If provided, the reason that will be recorded in the audit logs. Maximum of 512 characters.

Returns:
hikari.guilds.GuildWidget

The edited guild widget.

Raises:
hikari.errors.ForbiddenError

If you are missing the MANAGE_GUILD permission.

hikari.errors.NotFoundError

If the guild is not found.

hikari.errors.UnauthorizedError

If you are unauthorized to make the request (invalid/missing token).

hikari.errors.RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

hikari.errors.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.

hikari.errors.InternalServerError

If an internal error occurs on Discord while handling the request.

abstract async estimate_guild_prune_count(guild, *, days=undefined.UNDEFINED, include_roles=undefined.UNDEFINED)[source]#

Estimate the guild prune count.

Parameters:
guildhikari.snowflakes.SnowflakeishOr[hikari.guilds.PartialGuild]

The guild to estimate the guild prune count for. This may be the object or the ID of an existing guild.

Other Parameters:
dayshikari.undefined.UndefinedOr[int]

If provided, number of days to count prune for.

include_roleshikari.undefined.UndefinedOr[hikari.snowflakes.SnowflakeishSequence[hikari.guilds.PartialRole]]]

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.

Returns:
int

The estimated guild prune count.

Raises:
hikari.errors.BadRequestError

If any of the fields that are passed have an invalid value.

hikari.errors.UnauthorizedError

If you are unauthorized to make the request (invalid/missing token).

hikari.errors.ForbiddenError

If you are missing the KICK_MEMBERS permission.

hikari.errors.NotFoundError

If the guild is not found.

hikari.errors.RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

hikari.errors.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.

hikari.errors.InternalServerError

If an internal error occurs on Discord while handling the request.

abstract async execute_webhook(webhook, token, content=undefined.UNDEFINED, *, thread=undefined.UNDEFINED, username=undefined.UNDEFINED, avatar_url=undefined.UNDEFINED, attachment=undefined.UNDEFINED, attachments=undefined.UNDEFINED, component=undefined.UNDEFINED, components=undefined.UNDEFINED, embed=undefined.UNDEFINED, embeds=undefined.UNDEFINED, tts=undefined.UNDEFINED, mentions_everyone=undefined.UNDEFINED, user_mentions=undefined.UNDEFINED, role_mentions=undefined.UNDEFINED, flags=undefined.UNDEFINED)[source]#

Execute a webhook.

Warning

As of writing, username and avatar_url are ignored for interaction webhooks.

Parameters:
webhooktyping.Union[hikari.snowflakes.Snowflakeish, hikari.webhooks.ExecutableWebhook]

The webhook to execute. This may be the object or the ID of an existing webhook.

tokenstr

The webhook token.

contenthikari.undefined.UndefinedOr[typing.Any]

If provided, the message contents. If hikari.undefined.UNDEFINED, then nothing will be sent in the content. Any other value here will be cast to a str.

If this is a hikari.embeds.Embed and no embed nor no embeds kwarg is provided, then this will instead update the embed. This allows for simpler syntax when sending an embed alone.

Likewise, if this is a hikari.files.Resource, then the content is instead treated as an attachment if no attachment and no attachments kwargs are provided.

Other Parameters:
threadhikari.undefined.UndefinedOr[hikari.snowflakes.SnowflakeishOr[hikari.channels.GuildThreadChannel]]

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.

usernamehikari.undefined.UndefinedOr[str]

If provided, the username to override the webhook’s username for this request.

avatar_urltyping.Union[hikari.undefined.UndefinedType, hikari.files.URL, str]

If provided, the url of an image to override the webhook’s avatar with for this request.

attachmenthikari.undefined.UndefinedOr[hikari.files.Resourceish]

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.

  • If a pathlib.PurePath or str to a valid URL, the

    resource at the given URL will be streamed to Discord when sending the message. Subclasses of hikari.files.WebResource such as hikari.files.URL, hikari.messages.Attachment, hikari.emojis.Emoji, EmbedResource, etc will also be uploaded this way. This will use bit-inception, so only a small percentage of the resource will remain in memory at any one time, thus aiding in scalability.

  • If a hikari.files.Bytes is passed, or a str

    that contains a valid data URI is passed, then this is uploaded with a randomized file name if not provided.

  • If a hikari.files.File, pathlib.PurePath or

    str that is an absolute or relative path to a file on your file system is passed, then this resource is uploaded as an attachment using non-blocking code internally and streamed using bit-inception where possible. This depends on the type of concurrent.futures.Executor that is being used for the application (default is a thread pool which supports this behaviour).

attachmentshikari.undefined.UndefinedOr[typing.Sequence[hikari.files.Resourceish]]

If provided, the message attachments. These can be resources, or strings consisting of paths on your computer or URLs.

componenthikari.undefined.UndefinedOr[hikari.api.special_endpoints.ComponentBuilder]

If provided, builder object of the component to include in this message.

componentshikari.undefined.UndefinedOr[typing.Sequence[hikari.api.special_endpoints.ComponentBuilder]]

If provided, a sequence of the component builder objects to include in this message.

embedhikari.undefined.UndefinedOr[hikari.embeds.Embed]

If provided, the message embed.

embedshikari.undefined.UndefinedOr[typing.Sequence[hikari.embeds.Embed]]

If provided, the message embeds.

ttshikari.undefined.UndefinedOr[bool]

If provided, whether the message will be read out by a screen reader using Discord’s TTS (text-to-speech) system.

mentions_everyonehikari.undefined.UndefinedOr[bool]

If provided, whether the message should parse @everyone/@here mentions.

user_mentionshikari.undefined.UndefinedOr[typing.Union[hikari.snowflakes.SnowflakeishSequence[hikari.users.PartialUser], bool]]

If provided, and True, all user mentions will be detected. If provided, and False, all user mentions will be ignored if appearing in the message body. Alternatively this may be a collection of hikari.snowflakes.Snowflake, or hikari.users.PartialUser derivatives to enforce mentioning specific users.

role_mentionshikari.undefined.UndefinedOr[typing.Union[hikari.snowflakes.SnowflakeishSequence[hikari.guilds.PartialRole], bool]]

If provided, and True, all role mentions will be detected. If provided, and False, all role mentions will be ignored if appearing in the message body. Alternatively this may be a collection of hikari.snowflakes.Snowflake, or hikari.guilds.PartialRole derivatives to enforce mentioning specific roles.

flagstyping.Union[hikari.undefined.UndefinedType, int, hikari.messages.MessageFlag]

The flags to set for this webhook message.

Warning

As of writing this can only be set for interaction webhooks and the only settable flag is EPHEMERAL; this field is just ignored for non-interaction webhooks.

Returns:
hikari.messages.Message

The created message.

Raises:
ValueError

If more than 100 unique objects/entities are passed for role_mentions or user_mentions or if both attachment and attachments or embed and embeds are specified.

hikari.errors.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.

hikari.errors.UnauthorizedError

If you are unauthorized to make the request (invalid/missing token).

hikari.errors.NotFoundError

If the webhook is not found.

hikari.errors.RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

hikari.errors.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.

hikari.errors.InternalServerError

If an internal error occurs on Discord while handling the request.

abstract async fetch_active_threads(guild, /)[source]#

Fetch a guild’s active threads.

Parameters:
guildhikari.snowflakes.SnowflakeishOr[hikari.guilds.Guild]

Object or ID of the guild to fetch the active threads of.

Returns:
typing.Sequence[hikari.channels.GuildThreadChannel]

A sequence of the guild’s active threads.

Raises:
hikari.errors.BadRequestError

If any of the fields that are passed have an invalid value.

hikari.errors.ForbiddenError

If you access the guild’s active threads.

hikari.errors.NotFoundError

If the guild doesn’t exist.

hikari.errors.UnauthorizedError

If you are unauthorized to make the request (invalid/missing token).

hikari.errors.RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

hikari.errors.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.

hikari.errors.InternalServerError

If an internal error occurs on Discord while handling the request.

abstract async fetch_application()[source]#

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:
hikari.applications.Application

The token’s associated application.

Raises:
hikari.errors.UnauthorizedError

If you are unauthorized to make the request (invalid/missing token).

hikari.errors.RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

hikari.errors.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.

hikari.errors.InternalServerError

If an internal error occurs on Discord while handling the request.

abstract async fetch_application_command(application, command, guild=undefined.UNDEFINED)[source]#

Fetch a command set for an application.

Parameters:
applicationhikari.snowflakes.SnowflakeishOr[hikari.guilds.PartialApplication]

Object or ID of the application to fetch a command for.

commandhikari.snowflakes.SnowflakeishOr[hikari.commands.PartialCommand]

Object or ID of the command to fetch.

Other Parameters:
guildhikari.undefined.UndefinedOr[hikari.snowflakes.SnowflakeishOr[hikari.guilds.PartialGuild]

Object or ID of the guild to fetch the command for. If left as hikari.undefined.UNDEFINED then this will return a global command, otherwise this will return a command made for the specified guild.

Returns:
hikari.commands.PartialCommand

Object of the fetched command.

Raises:
hikari.errors.ForbiddenError

If you cannot access the target command.

hikari.errors.NotFoundError

If the command isn’t found.

hikari.errors.UnauthorizedError

If you are unauthorized to make the request (invalid/missing token).

hikari.errors.RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

hikari.errors.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.

hikari.errors.InternalServerError

If an internal error occurs on Discord while handling the request.

abstract async fetch_application_command_permissions(application, guild, command)[source]#

Fetch the permissions registered for a specific command in a guild.

Parameters:
applicationhikari.snowflakes.SnowflakeishOr[hikari.guilds.PartialApplication]

Object or ID of the application to fetch the command permissions for.

guildhikari.undefined.UndefinedOr[hikari.snowflakes.SnowflakeishOr[hikari.guilds.PartialGuild]]

Object or ID of the guild to fetch the command permissions for.

commandhikari.snowflakes.SnowflakeishOr[hikari.commands.PartialCommand]

Object or ID of the command to fetch the command permissions for.

Returns:
hikari.commands.GuildCommandPermissions

Object of the command permissions set for the specified command.

Raises:
hikari.errors.ForbiddenError

If you cannot access the provided application’s commands or guild.

hikari.errors.NotFoundError

If the provided application or command isn’t found.

hikari.errors.UnauthorizedError

If you are unauthorized to make the request (invalid/missing token).

hikari.errors.RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

hikari.errors.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.

hikari.errors.InternalServerError

If an internal error occurs on Discord while handling the request.

abstract async fetch_application_commands(application, guild=undefined.UNDEFINED)[source]#

Fetch the commands set for an application.

Parameters:
applicationhikari.snowflakes.SnowflakeishOr[hikari.guilds.PartialApplication]

Object or ID of the application to fetch the commands for.

Other Parameters:
guildhikari.undefined.UndefinedOr[hikari.snowflakes.SnowflakeishOr[hikari.guilds.PartialGuild]

Object or ID of the guild to fetch the commands for. If left as hikari.undefined.UNDEFINED then this will only return the global commands, otherwise this will only return the commands set exclusively for the specific guild.

Returns:
typing.Sequence[hikari.commands.PartialCommand]

A sequence of the commands declared for the provided application. This will exclusively either contain the commands set for a specific guild if guild is provided or the global commands if not.

Raises:
hikari.errors.ForbiddenError

If you cannot access the target guild.

hikari.errors.NotFoundError

If the provided application isn’t found.

hikari.errors.UnauthorizedError

If you are unauthorized to make the request (invalid/missing token).

hikari.errors.RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

hikari.errors.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.

hikari.errors.InternalServerError

If an internal error occurs on Discord while handling the request.

abstract async fetch_application_guild_commands_permissions(application, guild)[source]#

Fetch the command permissions registered in a guild.

Parameters:
applicationhikari.snowflakes.SnowflakeishOr[hikari.guilds.PartialApplication]

Object or ID of the application to fetch the command permissions for.

guildhikari.undefined.UndefinedOr[hikari.snowflakes.SnowflakeishOr[hikari.guilds.PartialGuild]]

Object or ID of the guild to fetch the command permissions for.

Returns:
typing.Sequence[hikari.commands.GuildCommandPermissions]

Sequence of the guild command permissions set for the specified guild.

Raises:
hikari.errors.ForbiddenError

If you cannot access the provided application’s commands or guild.

hikari.errors.NotFoundError

If the provided application isn’t found.

hikari.errors.UnauthorizedError

If you are unauthorized to make the request (invalid/missing token).

hikari.errors.RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

hikari.errors.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.

hikari.errors.InternalServerError

If an internal error occurs on Discord while handling the request.

abstract fetch_audit_log(guild, *, before=undefined.UNDEFINED, user=undefined.UNDEFINED, event_type=undefined.UNDEFINED)[source]#

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.

Parameters:
guildhikari.snowflakes.SnowflakeishOr[hikari.guilds.PartialGuild]

The guild to fetch the audit logs from. This can be a guild object or the ID of an existing guild.

Other Parameters:
beforehikari.undefined.UndefinedOr[hikari.snowflakes.SearchableSnowflakeishOr[hikari.snowflakes.Unique]]

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.

userhikari.undefined.UndefinedOr[hikari.snowflakes.SnowflakeishOr[hikari.users.PartialUser]]

If provided, the user to filter for.

event_typehikari.undefined.UndefinedOr[typing.Union[hikari.audit_logs.AuditLogEventType, int]]

If provided, the event type to filter for.

Returns:
hikari.iterators.LazyIterator[hikari.audit_logs.AuditLog]

The guild’s audit log.

Raises:
hikari.errors.BadRequestError

If any of the fields that are passed have an invalid value.

hikari.errors.ForbiddenError

If you are missing the VIEW_AUDIT_LOG permission.

hikari.errors.UnauthorizedError

If you are unauthorized to make the request (invalid/missing token).

hikari.errors.RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

hikari.errors.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.

hikari.errors.InternalServerError

If an internal error occurs on Discord while handling the request.

abstract async fetch_authorization()[source]#

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:
hikari.applications.AuthorizationInformation

The token’s authorization information.

Raises:
hikari.errors.UnauthorizedError

If you are unauthorized to make the request (invalid/missing token).

hikari.errors.RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

hikari.errors.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.

hikari.errors.InternalServerError

If an internal error occurs on Discord while handling the request.

abstract async fetch_available_sticker_packs()[source]#

Fetch the available sticker packs.

Returns:
typing.Sequence[hikari.stickers.StickerPack]

The available sticker packs.

Raises:
hikari.errors.RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

hikari.errors.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.

hikari.errors.InternalServerError

If an internal error occurs on Discord while handling the request.

abstract async fetch_ban(guild, user)[source]#

Fetch the guild’s ban info for a user.

Parameters:
guildhikari.snowflakes.SnowflakeishOr[hikari.guilds.PartialGuild]

The guild to fetch the ban from. This may be the object or the ID of an existing guild.

userhikari.snowflakes.SnowflakeishOr[hikari.users.PartialUser]

The user to fetch the ban of. This may be the object or the ID of an existing user.

Returns:
hikari.guilds.GuildBan

The requested ban info.

Raises:
hikari.errors.ForbiddenError

If you are missing the BAN_MEMBERS permission.

hikari.errors.UnauthorizedError

If you are unauthorized to make the request (invalid/missing token).

hikari.errors.NotFoundError

If the guild or user are not found or if the user is not banned.

hikari.errors.RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

hikari.errors.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.

hikari.errors.InternalServerError

If an internal error occurs on Discord while handling the request.

abstract fetch_bans(guild, /, *, newest_first=False, start_at=undefined.UNDEFINED)[source]#

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.

Parameters:
guildhikari.snowflakes.SnowflakeishOr[hikari.guilds.PartialGuild]

The guild to fetch the bans from. This may be the object or the ID of an existing guild.

Other Parameters:
newest_firstbool

Whether to fetch the newest first or the oldest first.

Defaults to False.

start_atundefined.UndefinedOr[snowflakes.SearchableSnowflakeishOr[users.PartialUser]]

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.

Returns:
hikari.iterators.LazyIterator[hikari.guilds.GuildBan]

The requested bans.

Raises:
hikari.errors.ForbiddenError

If you are missing the BAN_MEMBERS permission.

hikari.errors.UnauthorizedError

If you are unauthorized to make the request (invalid/missing token).

hikari.errors.NotFoundError

If the guild is not found.

hikari.errors.RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

hikari.errors.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.

hikari.errors.InternalServerError

If an internal error occurs on Discord while handling the request.

abstract async fetch_channel(channel)[source]#

Fetch a channel.

Parameters:
channelhikari.snowflakes.SnowflakeishOr[hikari.channels.PartialChannel]

The channel to fetch. This may be the object or the ID of an existing channel.

Returns:
hikari.channels.PartialChannel

The channel. This will be a _derivative_ of hikari.channels.PartialChannel, depending on the type of channel you request for.

This means that you may get one of hikari.channels.DMChannel, hikari.channels.GroupDMChannel, hikari.channels.GuildTextChannel, hikari.channels.GuildVoiceChannel, hikari.channels.GuildStoreChannel, hikari.channels.GuildNewsChannel.

Likewise, the hikari.channels.GuildChannel can be used to determine if a channel is guild-bound, and hikari.channels.TextableChannel can be used to determine if the channel provides textual functionality to the application.

You can check for these using the isinstance builtin function.

Raises:
hikari.errors.UnauthorizedError

If you are unauthorized to make the request (invalid/missing token).

hikari.errors.ForbiddenError

If you are missing the READ_MESSAGES permission in the channel.

hikari.errors.NotFoundError

If the channel is not found.

hikari.errors.RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

hikari.errors.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.

hikari.errors.InternalServerError

If an internal error occurs on Discord while handling the request.

abstract async fetch_channel_invites(channel)[source]#

Fetch all invites pointing to the given guild channel.

Parameters:
channelhikari.snowflakes.SnowflakeishOr[hikari.channels.GuildChannel]

The channel to fetch the invites from. This may be a channel object, or the ID of an existing channel.

Returns:
typing.Sequence[hikari.invites.InviteWithMetadata]

The invites pointing to the given guild channel.

Raises:
hikari.errors.UnauthorizedError

If you are unauthorized to make the request (invalid/missing token).

hikari.errors.ForbiddenError

If you are missing the MANAGE_CHANNEL permission in the channel.

hikari.errors.NotFoundError

If the channel is not found in any guilds you are a member of.

hikari.errors.RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

hikari.errors.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.

hikari.errors.InternalServerError

If an internal error occurs on Discord while handling the request.

abstract async fetch_channel_webhooks(channel)[source]#

Fetch all channel webhooks.

Parameters:
channelhikari.snowflakes.SnowflakeishOr[hikari.channels.WebhookChannelT]

The channel to fetch the webhooks for. This may be an instance of any of the classes which are valid for hikari.channels.WebhookChannelT or the ID of an existing channel.

Returns:
typing.Sequence[hikari.webhooks.PartialWebhook]

The fetched webhooks.

Raises:
hikari.errors.UnauthorizedError

If you are unauthorized to make the request (invalid/missing token).

hikari.errors.ForbiddenError

If you are missing the MANAGE_WEBHOOKS permission.

hikari.errors.NotFoundError

If the channel is not found.

hikari.errors.RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

hikari.errors.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.

hikari.errors.InternalServerError

If an internal error occurs on Discord while handling the request.

abstract async fetch_emoji(guild, emoji)[source]#

Fetch a guild emoji.

Parameters:
guildhikari.snowflakes.SnowflakeishOr[hikari.guilds.PartialGuild]

The guild to fetch the emoji from. This can be a guild object or the ID of an existing guild.

emojihikari.snowflakes.SnowflakeishOr[hikari.emojis.CustomEmoji]

The emoji to fetch. This can be a hikari.emojis.CustomEmoji or the ID of an existing emoji.

Returns:
hikari.emojis.KnownCustomEmoji

The requested emoji.

Raises:
hikari.errors.NotFoundError

If the guild or the emoji are not found.

hikari.errors.UnauthorizedError

If you are unauthorized to make the request (invalid/missing token).

hikari.errors.RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

hikari.errors.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.

hikari.errors.InternalServerError

If an internal error occurs on Discord while handling the request.

abstract async fetch_gateway_bot_info()[source]#

Fetch the gateway info for the bot.

Returns:
hikari.sessions.GatewayBotInfo

The gateway bot information.

Raises:
hikari.errors.UnauthorizedError

If you are unauthorized to make the request (invalid/missing token).

hikari.errors.RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

hikari.errors.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.

hikari.errors.InternalServerError

If an internal error occurs on Discord while handling the request.

abstract async fetch_gateway_url()[source]#

Fetch the gateway url.

Note

This endpoint does not require any valid authorization.

Raises:
hikari.errors.RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

hikari.errors.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.

hikari.errors.InternalServerError

If an internal error occurs on Discord while handling the request.

abstract async fetch_guild(guild)[source]#

Fetch a guild.

Parameters:
guildhikari.snowflakes.SnowflakeishOr[hikari.guilds.PartialGuild]

The guild to fetch. This can be the object or the ID of an existing guild.

Returns:
hikari.guilds.RESTGuild

The requested guild.

Raises:
hikari.errors.ForbiddenError

If you are not part of the guild.

hikari.errors.NotFoundError

If the guild is not found.

hikari.errors.UnauthorizedError

If you are unauthorized to make the request (invalid/missing token).

hikari.errors.RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

hikari.errors.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.

hikari.errors.InternalServerError

If an internal error occurs on Discord while handling the request.

abstract async fetch_guild_channels(guild)[source]#

Fetch the channels in a guild.

Parameters:
guildhikari.snowflakes.SnowflakeishOr[hikari.guilds.PartialGuild]

The guild to fetch the channels from. This may be the object or the ID of an existing guild.

Returns:
typing.Sequence[hikari.channels.GuildChannel]

The requested channels.

Raises:
hikari.errors.UnauthorizedError

If you are unauthorized to make the request (invalid/missing token).

hikari.errors.NotFoundError

If the guild is not found.

hikari.errors.RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

hikari.errors.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.

hikari.errors.InternalServerError

If an internal error occurs on Discord while handling the request.

abstract async fetch_guild_emojis(guild)[source]#

Fetch the emojis of a guild.

Parameters:
guildhikari.snowflakes.SnowflakeishOr[hikari.guilds.PartialGuild]

The guild to fetch the emojis from. This can be a guild object or the ID of an existing guild.

Returns:
typing.Sequence[hikari.emojis.KnownCustomEmoji]

The requested emojis.

Raises:
hikari.errors.NotFoundError

If the guild is not found.

hikari.errors.UnauthorizedError

If you are unauthorized to make the request (invalid/missing token).

hikari.errors.RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

hikari.errors.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.

hikari.errors.InternalServerError

If an internal error occurs on Discord while handling the request.

abstract async fetch_guild_invites(guild)[source]#

Fetch the guild’s invites.

Parameters:
guildhikari.snowflakes.SnowflakeishOr[hikari.guilds.PartialGuild]

The guild to fetch the invites for. This may be the object or the ID of an existing guild.

Returns:
typing.Sequence[hikari.invites.InviteWithMetadata]

The invites for the guild.

Raises:
hikari.errors.ForbiddenError

If you are missing the MANAGE_GUILD permission.

hikari.errors.UnauthorizedError

If you are unauthorized to make the request (invalid/missing token).

hikari.errors.NotFoundError

If the guild is not found.

hikari.errors.RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

hikari.errors.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.

hikari.errors.InternalServerError

If an internal error occurs on Discord while handling the request.

abstract async fetch_guild_preview(guild)[source]#

Fetch a guild preview.

Note

This will only work for guilds you are a part of or are public.

Parameters:
guildhikari.snowflakes.SnowflakeishOr[hikari.guilds.PartialGuild]

The guild to fetch the preview of. This can be a guild object or the ID of an existing guild.

Returns:
hikari.guilds.GuildPreview

The requested guild preview.

Raises:
hikari.errors.NotFoundError

If the guild is not found or you are not part of the guild.

hikari.errors.UnauthorizedError

If you are unauthorized to make the request (invalid/missing token).

hikari.errors.RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

hikari.errors.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.

hikari.errors.InternalServerError

If an internal error occurs on Discord while handling the request.

abstract async fetch_guild_sticker(guild, sticker)[source]#

Fetch a guild sticker.

Parameters:
guildsnowflakes.SnowflakeishOr[stickers.PartialGuild]

The guild the sticker is in. This can be a guild object or the ID of an existing guild.

stickersnowflakes.SnowflakeishOr[stickers.PartialSticker]

The sticker to fetch. This can be a sticker object or the ID of an existing sticker.

Returns:
hikari.stickers.GuildSticker

The requested sticker.

Raises:
hikari.errors.ForbiddenError

If you are not part of the server.

hikari.errors.NotFoundError

If the guild or the sticker are not found.

hikari.errors.UnauthorizedError

If you are unauthorized to make the request (invalid/missing token).

hikari.errors.RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

hikari.errors.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.

hikari.errors.InternalServerError

If an internal error occurs on Discord while handling the request.

abstract async fetch_guild_stickers(guild)[source]#

Fetch a standard sticker.

Parameters:
guildsnowflakes.SnowflakeishOr[stickers.PartialGuild]

The guild to request stickers for. This can be a guild object or the ID of an existing guild.

Returns:
typing.Sequence[hikari.stickers.GuildSticker]

The requested stickers.

Raises:
hikari.errors.ForbiddenError

If you are not part of the server.

hikari.errors.NotFoundError

If the guild is not found.

hikari.errors.UnauthorizedError

If you are unauthorized to make the request (invalid/missing token).

hikari.errors.RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

hikari.errors.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.

hikari.errors.InternalServerError

If an internal error occurs on Discord while handling the request.

abstract async fetch_guild_templates(guild)[source]#

Fetch the templates for a guild.

Parameters:
guildhikari.snowflakes.SnowflakeishOr[hikari.guilds.PartialGuild]

The object or ID of the guild to get the templates for.

Returns:
typing.Sequence[hikari.templates.Template]

A sequence of the found template objects.

Raises:
hikari.errors.ForbiddenError

If you are not part of the guild.

hikari.errors.NotFoundError

If the guild is not found or are missing the MANAGE_GUILD permission.

hikari.errors.UnauthorizedError

If you are unauthorized to make the request (invalid/missing token).

hikari.errors.RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

hikari.errors.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.

hikari.errors.InternalServerError

If an internal error occurs on Discord while handling the request.

abstract async fetch_guild_voice_regions(guild)[source]#

Fetch the available voice regions for a guild.

Parameters:
guildhikari.snowflakes.SnowflakeishOr[hikari.guilds.PartialGuild]

The guild to fetch the voice regions for. This may be the object or the ID of an existing guild.

Returns:
typing.Sequence[hikari.voices.VoiceRegion]

The available voice regions for the guild.

Raises:
hikari.errors.UnauthorizedError

If you are unauthorized to make the request (invalid/missing token).

hikari.errors.NotFoundError

If the guild is not found.

hikari.errors.RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

hikari.errors.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.

hikari.errors.InternalServerError

If an internal error occurs on Discord while handling the request.

abstract async fetch_guild_webhooks(guild)[source]#

Fetch all guild webhooks.

Parameters:
guildhikari.snowflakes.SnowflakeishOr[hikari.guilds.PartialGuild]

The guild to fetch the webhooks for. This may be the object or the ID of an existing guild.

Returns:
typing.Sequence[hikari.webhooks.PartialWebhook]

The fetched webhooks.

Raises:
hikari.errors.UnauthorizedError

If you are unauthorized to make the request (invalid/missing token).

hikari.errors.ForbiddenError

If you are missing the MANAGE_WEBHOOKS permission.

hikari.errors.NotFoundError

If the guild is not found.

hikari.errors.RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

hikari.errors.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.

hikari.errors.InternalServerError

If an internal error occurs on Discord while handling the request.

abstract async fetch_integrations(guild)[source]#

Fetch the guild’s integrations.

Parameters:
guildhikari.snowflakes.SnowflakeishOr[hikari.guilds.PartialGuild]

The guild to fetch the integrations for. This may be the object or the ID of an existing guild.

Returns:
typing.Sequence[hikari.guilds.Integration]

The integrations for the guild.

Raises:
hikari.errors.ForbiddenError

If you are missing the MANAGE_GUILD permission.

hikari.errors.UnauthorizedError

If you are unauthorized to make the request (invalid/missing token).

hikari.errors.NotFoundError

If the guild is not found.

hikari.errors.RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

hikari.errors.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.

hikari.errors.InternalServerError

If an internal error occurs on Discord while handling the request.

abstract async fetch_interaction_response(application, token)[source]#

Fetch the initial response for an interaction.

Parameters:
applicationhikari.snowflakes.SnowflakeishOr[hikari.guilds.PartialApplication]

Object or ID of the application to fetch a command for.

tokenstr

Token of the interaction to get the initial response for.

Returns:
hikari.messages.Message

Message object of the initial response.

Raises:
hikari.errors.ForbiddenError

If you cannot access the target interaction.

hikari.errors.NotFoundError

If the initial response isn’t found.

hikari.errors.UnauthorizedError

If you are unauthorized to make the request (invalid/missing token).

hikari.errors.RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

hikari.errors.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.

hikari.errors.InternalServerError

If an internal error occurs on Discord while handling the request.

abstract async fetch_invite(invite, with_counts=True, with_expiration=True)[source]#

Fetch an existing invite.

Parameters:
invitetyping.Union[hikari.invites.InviteCode, str]

The invite to fetch. This may be an invite object or the code of an existing invite.

with_countsbool

Whether the invite should contain the approximate member counts.

Defaults to True.

with_expiration: bool

Whether the invite should contain the expiration date.

Defaults to True.

Returns:
hikari.invites.Invite

The requested invite.

Raises:
hikari.errors.UnauthorizedError

If you are unauthorized to make the request (invalid/missing token).

hikari.errors.NotFoundError

If the invite is not found.

hikari.errors.RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

hikari.errors.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.

hikari.errors.InternalServerError

If an internal error occurs on Discord while handling the request.

abstract fetch_joined_private_archived_threads(channel, /, *, before=undefined.UNDEFINED)[source]#

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.

Parameters:
channelhikari.undefined.UndefinedOr[hikari.channels.PermissibleGuildChannel]

Object or ID of the channel to fetch the private archived threads of.

Other Parameters:
beforehikari.undefined.UndefinedOr[hikari.snowflakes.SearchableSnowflakeishOr[hikari.channels.GuildThreadChannel]]

If provided, fetch joined threads before this snowflake. If you provide a datetime object, it will be transformed into a snowflake.

Returns:
hikari.iterators.LazyIterator[hikari.channels.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 hikari.iterators for the full API for this iterator type.

Raises:
hikari.errors.UnauthorizedError

If you are unauthorized to make the request (invalid/missing token).

hikari.errors.ForbiddenError

If you cannot access the channel.

hikari.errors.NotFoundError

If the channel is not found.

hikari.errors.RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

hikari.errors.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.

hikari.errors.InternalServerError

If an internal error occurs on Discord while handling the request.

abstract async fetch_member(guild, user)[source]#

Fetch a guild member.

Parameters:
guildhikari.snowflakes.SnowflakeishOr[hikari.guilds.PartialGuild]

The guild to get the member from. This may be the object or the ID of an existing guild.

userhikari.snowflakes.SnowflakeishOr[hikari.users.PartialUser]

The user to get the member for. This may be the object or the ID of an existing user.

Returns:
hikari.guilds.Member

The requested member.

Raises:
hikari.errors.UnauthorizedError

If you are unauthorized to make the request (invalid/missing token).

hikari.errors.NotFoundError

If the guild or the user are not found.

hikari.errors.RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

hikari.errors.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.

hikari.errors.InternalServerError

If an internal error occurs on Discord while handling the request.

abstract fetch_members(guild)[source]#

Fetch the members from a guild.

Warning

This endpoint requires the 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 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.

Parameters:
guildhikari.snowflakes.SnowflakeishOr[hikari.guilds.PartialGuild]

The guild to fetch the members of. This may be the object or the ID of an existing guild.

Returns:
hikari.iterators.LazyIterator[hikari.guilds.Member]

An iterator to fetch the members.

Raises:
hikari.errors.UnauthorizedError

If you are unauthorized to make the request (invalid/missing token).

hikari.errors.NotFoundError

If the guild is not found.

hikari.errors.RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

hikari.errors.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.

hikari.errors.InternalServerError

If an internal error occurs on Discord while handling the request.

abstract async fetch_message(channel, message)[source]#

Fetch a specific message in the given text channel.

Parameters:
channelhikari.snowflakes.SnowflakeishOr[hikari.channels.TextableChannel]

The channel to fetch messages in. This may be the object or the ID of an existing channel.

messagehikari.snowflakes.SnowflakeishOr[hikari.messages.PartialMessage]

The message to fetch. This may be the object or the ID of an existing message.

Returns:
hikari.messages.Message

The requested message.

Raises:
hikari.errors.UnauthorizedError

If you are unauthorized to make the request (invalid/missing token).

hikari.errors.ForbiddenError

If you are missing the READ_MESSAGE_HISTORY in the channel.

hikari.errors.NotFoundError

If the channel is not found or the message is not found in the given text channel.

hikari.errors.RateLimitTooLongError

Raised in the event that a rate limit occurs