Skip to content

hikari.impl.rest#

Implementation of a V10 compatible REST API for Discord.

This also includes implementations designed towards providing RESTful functionality.

ClientCredentialsStrategy #

ClientCredentialsStrategy(
    client: SnowflakeishOr[PartialApplication],
    client_secret: str,
    *,
    scopes: Sequence[Union[OAuth2Scope, str]] = (
        applications.OAuth2Scope.APPLICATIONS_COMMANDS_UPDATE,
        applications.OAuth2Scope.IDENTIFY,
    )
)

Bases: TokenStrategy

Strategy class for handling client credential OAuth2 authorization.

PARAMETER DESCRIPTION
client

Object or ID of the application this client credentials strategy should authorize as.

TYPE: Optional[SnowflakeishOr[PartialApplication]]

client_secret

Client secret to use when authorizing.

TYPE: Optional[str]

PARAMETER DESCRIPTION
scopes

The scopes to authorize for.

TYPE: Sequence[str]

client_id property #

client_id: Snowflake

ID of the application this token strategy authenticates with.

scopes property #

Sequence of scopes this token strategy authenticates for.

token_type property #

token_type: TokenType

Type of token this strategy returns.

acquire async #

acquire(client: RESTClient) -> str

Acquire an authorization token (including the prefix).

PARAMETER DESCRIPTION
client

The rest client to use to acquire the token.

TYPE: RESTClient

RETURNS DESCRIPTION
str

The current authorization token to use for this client and it's prefix.

invalidate #

invalidate(token: Optional[str]) -> None

Invalidate the cached token in this handler.

Note

token may be provided in-order to avoid newly generated tokens from being invalidated due to multiple calls being made by separate subroutines which are handling the same token.

PARAMETER DESCRIPTION
token

The token to specifically invalidate. If provided then this will only invalidate the cached token if it matches this, otherwise it'll be invalidated regardless.

TYPE: Optional[str]

RESTApp #

RESTApp(
    *,
    executor: Optional[Executor] = None,
    http_settings: Optional[HTTPSettings] = None,
    dumps: JSONEncoder = data_binding.default_json_dumps,
    loads: JSONDecoder = data_binding.default_json_loads,
    max_rate_limit: float = 300.0,
    max_retries: int = 3,
    proxy_settings: Optional[ProxySettings] = None,
    url: Optional[str] = None
)

Bases: ExecutorAware

The base for a HTTP-only Discord application.

This comprises of a shared TCP connector connection pool, and can have hikari.impl.rest.RESTClientImpl instances for specific credentials acquired from it.

PARAMETER DESCRIPTION
executor

The executor to use for blocking file IO operations. If None is passed, then the default concurrent.futures.ThreadPoolExecutor for the asyncio.AbstractEventLoop will be used instead.

TYPE: Optional[Executor] DEFAULT: None

http_settings

HTTP settings to use. Sane defaults are used if this is None.

TYPE: Optional[HTTPSettings] DEFAULT: None

dumps

The JSON encoder this application should use.

TYPE: JSONEncoder DEFAULT: default_json_dumps

loads

The JSON decoder this application should use.

TYPE: JSONDecoder DEFAULT: default_json_loads

max_rate_limit

Maximum number of seconds to sleep for when rate limited. If a rate limit occurs that is longer than this value, then a hikari.errors.RateLimitTooLongError will be raised instead of waiting.

This is provided since some endpoints may respond with non-sensible rate limits.

Defaults to five minutes if unspecified.

TYPE: float DEFAULT: 300.0

max_retries

Maximum number of times a request will be retried if it fails with a 5xx status.

Defaults to 3 if set to None.

TYPE: Optional[int] DEFAULT: 3

proxy_settings

Proxy settings to use. If None then no proxy configuration will be used.

TYPE: Optional[ProxySettings] DEFAULT: None

url

The base URL for the API. You can generally leave this as being None and the correct default API base URL will be generated.

TYPE: Optional[str] DEFAULT: None

executor property #

executor: Optional[Executor]

Executor to use for blocking operations.

This may return None if the default asyncio thread pool should be used instead.

acquire #

acquire(
    token: Union[str, TokenStrategy, None] = None,
    token_type: Union[str, TokenType, None] = None,
) -> RESTClientImpl

Acquire an instance of this REST client.

Note

The returned REST client should be started before it can be used, either by calling hikari.impl.rest.RESTClientImpl.start or by using it as an asynchronous context manager.

Examples:

    rest_app = RESTApp()
    await rest_app.start()

    # Using the returned client as a context manager to implicitly start
    # and stop it.
    async with rest_app.acquire("A token", "Bot") as client:
        user = await client.fetch_my_user()

    await rest_app.close()
PARAMETER DESCRIPTION
token

The bot or bearer token. If no token is to be used, this can be undefined.

TYPE: Union[str, None, TokenStrategy] DEFAULT: None

token_type

The type of token in use. This should only be passed when str is passed for token, can be "Bot" or "Bearer" and will be defaulted to "Bearer" in this situation.

This should be left as None when either hikari.api.rest.TokenStrategy or None is passed for token.

TYPE: Union[str, TokenType, None] DEFAULT: None

RETURNS DESCRIPTION
RESTClientImpl

An instance of the REST client.

RAISES DESCRIPTION
ValueError

If token_type is provided when a token strategy is passed for token.

RESTClientImpl #

RESTClientImpl(
    *,
    cache: Optional[MutableCache],
    entity_factory: EntityFactory,
    executor: Optional[Executor],
    http_settings: HTTPSettings,
    bucket_manager: Optional[RESTBucketManager] = None,
    bucket_manager_owner: bool = True,
    client_session: Optional[ClientSession] = None,
    client_session_owner: bool = True,
    max_rate_limit: float = 300.0,
    max_retries: int = 3,
    proxy_settings: ProxySettings,
    dumps: JSONEncoder = data_binding.default_json_dumps,
    loads: JSONDecoder = data_binding.default_json_loads,
    token: Union[str, None, TokenStrategy],
    token_type: Union[TokenType, str, None],
    rest_url: Optional[str]
)

Bases: RESTClient

Implementation of the V10-compatible Discord HTTP API.

This manages making HTTP/1.1 requests to the API and using the entity factory within the passed application instance to deserialize JSON responses to Pythonic data classes that are used throughout this library.

PARAMETER DESCRIPTION
entity_factory

The entity factory to use.

TYPE: EntityFactory

executor

The executor to use for blocking IO.

Defaults to the asyncio thread pool if set to None.

TYPE: Optional[Executor]

max_retries

Maximum number of times a request will be retried if it fails with a 5xx status.

Defaults to 3 if set to None.

TYPE: Optional[int] DEFAULT: 3

dumps

The JSON encoder this application should use.

TYPE: JSONEncoder DEFAULT: default_json_dumps

loads

The JSON decoder this application should use.

TYPE: JSONDecoder DEFAULT: default_json_loads

token

The bot or bearer token. If no token is to be used, this can be undefined.

TYPE: Union[str, None, TokenStrategy]

token_type

The type of token in use. This must be passed when a str is passed for token but and can be "Bot" or "Bearer".

This should be left as None when either hikari.api.rest.TokenStrategy or None is passed for token.

TYPE: Union[str, TokenType, None]

rest_url

The HTTP API base URL. This can contain format-string specifiers to interpolate information such as API version in use.

TYPE: str

RAISES DESCRIPTION
ValueError

If token_type is provided when a token strategy is passed for token, if token_type is left as None when a string is passed for token or if a value greater than 5 is provided for max_retries.

entity_factory property #

entity_factory: EntityFactory

Entity factory used by this REST client.

http_settings property #

http_settings: HTTPSettings

HTTP settings in use by this component.

is_alive property #

is_alive: bool

Whether this component is alive.

proxy_settings property #

proxy_settings: ProxySettings

Proxy settings in use by this component.

token_type property #

token_type: Union[str, TokenType, None]

Type of token this client is using for most requests.

If this is None then this client will likely only work for some endpoints such as public and webhook ones.

add_reaction async #

add_reaction(
    channel: SnowflakeishOr[TextableChannel],
    message: SnowflakeishOr[PartialMessage],
    emoji: Union[str, Emoji],
    emoji_id: UndefinedOr[SnowflakeishOr[CustomEmoji]] = undefined.UNDEFINED,
) -> None

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

PARAMETER DESCRIPTION
channel

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

TYPE: SnowflakeishOr[TextableChannel]

message

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

TYPE: SnowflakeishOr[PartialMessage]

emoji

Object or name of the emoji to react with.

TYPE: Union[str, Emoji]

PARAMETER DESCRIPTION
emoji_id

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

TYPE: UndefinedOr[SnowflakeishOr[CustomEmoji]]

RAISES DESCRIPTION
BadRequestError

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

UnauthorizedError

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

ForbiddenError

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

NotFoundError

If the channel or message is not found.

RateLimitTooLongError

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

InternalServerError

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

add_role_to_member async #

add_role_to_member(
    guild: SnowflakeishOr[PartialGuild],
    user: SnowflakeishOr[PartialUser],
    role: SnowflakeishOr[PartialRole],
    *,
    reason: UndefinedOr[str] = undefined.UNDEFINED
) -> None

Add a role to a member.

PARAMETER DESCRIPTION
guild

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

TYPE: SnowflakeishOr[PartialGuild]

user

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

TYPE: SnowflakeishOr[PartialUser]

role

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

TYPE: SnowflakeishOr[PartialRole]

PARAMETER DESCRIPTION
reason

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

TYPE: UndefinedOr[str]

RAISES DESCRIPTION
ForbiddenError

If you are missing the hikari.permissions.Permissions.MANAGE_ROLES permission.

UnauthorizedError

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

NotFoundError

If the guild, user or role are not found.

RateLimitTooLongError

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

InternalServerError

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

add_thread_member async #

add_thread_member(
    channel: SnowflakeishOr[GuildThreadChannel],
    user: SnowflakeishOr[PartialUser],
) -> None

Add a user to a thread channel.

PARAMETER DESCRIPTION
channel

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

TYPE: SnowflakeishOr[GuildTextChannel]

user

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

TYPE: SnowflakeishOr[PartialUser]

RAISES DESCRIPTION
BadRequestError

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

ForbiddenError

If you cannot add a user to this thread.

NotFoundError

If the thread channel doesn't exist.

UnauthorizedError

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

RateLimitTooLongError

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

InternalServerError

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

add_user_to_guild async #

add_user_to_guild(
    access_token: Union[str, PartialOAuth2Token],
    guild: SnowflakeishOr[PartialGuild],
    user: SnowflakeishOr[PartialUser],
    *,
    nickname: UndefinedOr[str] = undefined.UNDEFINED,
    nick: UndefinedOr[str] = undefined.UNDEFINED,
    roles: UndefinedOr[SnowflakeishSequence[PartialRole]] = undefined.UNDEFINED,
    mute: UndefinedOr[bool] = undefined.UNDEFINED,
    deaf: UndefinedOr[bool] = undefined.UNDEFINED
) -> Optional[Member]

Add a user to a guild.

Note

This requires the access_token to have the hikari.applications.OAuth2Scope.GUILDS_JOIN scope enabled along with the authorization of a Bot which has hikari.permissions.Permissions.CREATE_INSTANT_INVITE permission within the target guild.

PARAMETER DESCRIPTION
access_token

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

TYPE: Union[str, PartialOAuth2Token]

guild

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

TYPE: SnowflakeishOr[PartialGuild]

user

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

TYPE: SnowflakeishOr[PartialUser]

PARAMETER DESCRIPTION
nickname

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

Requires the hikari.permissions.Permissions.MANAGE_NICKNAMES permission on the guild.

TYPE: UndefinedOr[str]

roles

If provided, the roles to add to the user when he joins the guild. This may be a collection objects or IDs of existing roles.

Requires the hikari.permissions.Permissions.MANAGE_ROLES permission on the guild.

TYPE: UndefinedOr[SnowflakeishSequence[PartialRole]]

mute

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

Requires the hikari.permissions.Permissions.MUTE_MEMBERS permission on the guild.

TYPE: UndefinedOr[bool]

deaf

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

Requires the hikari.permissions.Permissions.DEAFEN_MEMBERS permission on the guild.

TYPE: UndefinedOr[bool]

RETURNS DESCRIPTION
Optional[Member]

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

RAISES DESCRIPTION
BadRequestError

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

ForbiddenError

If you are not part of the guild you want to add the user to, if you are missing permissions to do one of the things you specified, if you are using an access token for another user, if the token is bound to another bot or if the access token doesn't have the hikari.applications.OAuth2Scope.GUILDS_JOIN scope enabled.

UnauthorizedError

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

NotFoundError

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

RateLimitTooLongError

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

InternalServerError

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

authorize_access_token async #

authorize_access_token(
    client: SnowflakeishOr[PartialApplication],
    client_secret: str,
    code: str,
    redirect_uri: str,
) -> OAuth2AuthorizationToken

Authorize an OAuth2 token using the authorize code grant type.

PARAMETER DESCRIPTION
client

Object or ID of the application to authorize with.

TYPE: SnowflakeishOr[PartialApplication]

client_secret

Secret of the application to authorize with.

TYPE: str

code

The authorization code to exchange for an OAuth2 access token.

TYPE: str

redirect_uri

The redirect uri that was included in the authorization request.

TYPE: str

RETURNS DESCRIPTION
OAuth2AuthorizationToken

Object of the authorized OAuth2 token.

RAISES DESCRIPTION
BadRequestError

If an invalid redirect uri or code is passed.

UnauthorizedError

When an client or client secret is passed.

RateLimitTooLongError

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

InternalServerError

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

authorize_client_credentials_token async #

authorize_client_credentials_token(
    client: SnowflakeishOr[PartialApplication],
    client_secret: str,
    scopes: Sequence[Union[OAuth2Scope, str]],
) -> PartialOAuth2Token

Authorize a client credentials token for an application.

PARAMETER DESCRIPTION
client

Object or ID of the application to authorize as.

TYPE: SnowflakeishOr[PartialApplication]

client_secret

Secret of the application to authorize as.

TYPE: str

scopes

The scopes to authorize for.

TYPE: Sequence[Union[OAuth2Scope, str]]

RETURNS DESCRIPTION
PartialOAuth2Token

Object of the authorized partial OAuth2 token.

RAISES DESCRIPTION
BadRequestError

If invalid any invalid or malformed scopes are passed.

UnauthorizedError

When an client or client secret is passed.

RateLimitTooLongError

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

InternalServerError

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

ban_member #

ban_member(
    guild: SnowflakeishOr[PartialGuild],
    user: SnowflakeishOr[PartialUser],
    *,
    delete_message_seconds: UndefinedOr[Intervalish] = undefined.UNDEFINED,
    reason: UndefinedOr[str] = undefined.UNDEFINED
) -> Coroutine[Any, Any, None]

ban_user async #

ban_user(
    guild: SnowflakeishOr[PartialGuild],
    user: SnowflakeishOr[PartialUser],
    *,
    delete_message_seconds: UndefinedOr[Intervalish] = undefined.UNDEFINED,
    reason: UndefinedOr[str] = undefined.UNDEFINED
) -> None

Ban the given user from this guild.

PARAMETER DESCRIPTION
guild

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

TYPE: SnowflakeishOr[PartialGuild]

user

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

TYPE: SnowflakeishOr[PartialUser]

PARAMETER DESCRIPTION
delete_message_seconds

If provided, the number of seconds to delete messages for. This can be represented as either an int/float between 0 and 604800 (7 days), or a datetime.timedelta object.

TYPE: UndefinedNoneOr[Intervalish]

reason

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

TYPE: UndefinedOr[str]

RAISES DESCRIPTION
BadRequestError

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

ForbiddenError

If you are missing the hikari.permissions.Permissions.BAN_MEMBERS permission.

UnauthorizedError

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

NotFoundError

If the guild or user are not found.

RateLimitTooLongError

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

InternalServerError

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

begin_guild_prune async #

begin_guild_prune(
    guild: SnowflakeishOr[PartialGuild],
    *,
    days: UndefinedOr[int] = undefined.UNDEFINED,
    compute_prune_count: UndefinedOr[bool] = undefined.UNDEFINED,
    include_roles: UndefinedOr[
        SnowflakeishSequence[PartialRole]
    ] = undefined.UNDEFINED,
    reason: UndefinedOr[str] = undefined.UNDEFINED
) -> Optional[int]

Begin the guild prune.

PARAMETER DESCRIPTION
guild

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

TYPE: SnowflakeishOr[PartialGuild]

PARAMETER DESCRIPTION
days

If provided, number of days to count prune for.

TYPE: UndefinedOr[int]

compute_prune_count

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

TYPE: SnowflakeishOr[bool]

include_roles

If provided, the role(s) to include. By default, this endpoint will not count users with roles. Providing roles using this attribute will make members with the specified roles also get included into the count.

TYPE: UndefinedOr[SnowflakeishSequence[PartialRole]]

reason

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

TYPE: UndefinedOr[str]

RETURNS DESCRIPTION
Optional[int]

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

RAISES DESCRIPTION
BadRequestError

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

UnauthorizedError

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

ForbiddenError

If you are missing the hikari.permissions.Permissions.KICK_MEMBERS permission.

NotFoundError

If the guild is not found.

RateLimitTooLongError

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

InternalServerError

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

build_message_action_row #

build_message_action_row() -> MessageActionRowBuilder

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

RETURNS DESCRIPTION
MessageActionRowBuilder

The initialised action row builder.

build_modal_action_row #

build_modal_action_row() -> ModalActionRowBuilder

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

RETURNS DESCRIPTION
ModalActionRowBuilder

The initialised action row builder.

close async #

close() -> None

Close the HTTP client and any open HTTP connections.

context_menu_command_builder #

context_menu_command_builder(
    type: Union[CommandType, int], name: str
) -> ContextMenuCommandBuilder

Create a command builder to use in hikari.api.rest.RESTClient.set_application_commands.

PARAMETER DESCRIPTION
type

The commands's type.

TYPE: CommandType

name

The command's name.

TYPE: str

RETURNS DESCRIPTION
ContextMenuCommandBuilder

The created command builder object.

create_autocomplete_response async #

create_autocomplete_response(
    interaction: SnowflakeishOr[PartialInteraction],
    token: str,
    choices: Sequence[AutocompleteChoiceBuilder],
) -> None

Create the initial response for an autocomplete interaction.

PARAMETER DESCRIPTION
interaction

Object or ID of the interaction this response is for.

TYPE: SnowflakeishOr[PartialInteraction]

token

The command interaction's token.

TYPE: str

choices

The autocomplete choices themselves.

TYPE: Sequence[AutocompleteChoiceBuilder]

RAISES DESCRIPTION
UnauthorizedError

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

NotFoundError

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

RateLimitTooLongError

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

InternalServerError

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

create_context_menu_command async #

create_context_menu_command(
    application: SnowflakeishOr[PartialApplication],
    type: Union[CommandType, int],
    name: str,
    *,
    guild: UndefinedOr[SnowflakeishOr[PartialGuild]] = undefined.UNDEFINED,
    name_localizations: UndefinedOr[
        Mapping[Union[Locale, str], str]
    ] = undefined.UNDEFINED,
    default_member_permissions: Union[
        UndefinedType, int, Permissions
    ] = undefined.UNDEFINED,
    dm_enabled: UndefinedOr[bool] = undefined.UNDEFINED,
    nsfw: UndefinedOr[bool] = undefined.UNDEFINED
) -> ContextMenuCommand

Create an application command.

PARAMETER DESCRIPTION
application

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

TYPE: SnowflakeishOr[PartialApplication]

type

The type of menu command to make.

Only USER and MESSAGE are valid here.

TYPE: Union[CommandType, int]

name

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.

TYPE: str

PARAMETER DESCRIPTION
guild

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.

TYPE: hikari.undefined.UndefinedOr[hikari.snowflakes.SnowflakeishOr[hikari.guilds.PartialGuild]

name_localizations

The name localizations for this command.

TYPE: UndefinedOr[Mapping[Union[Locale, str], str]]

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

TYPE: Union[UndefinedType, int, Permissions]

dm_enabled

Whether this command is enabled in DMs with the bot.

This can only be applied to non-guild commands.

TYPE: UndefinedOr[bool]

nsfw

Whether this command should be age-restricted.

TYPE: UndefinedOr[bool]

RETURNS DESCRIPTION
ContextMenuCommand

Object of the created command.

RAISES DESCRIPTION
ForbiddenError

If you cannot access the provided application's commands.

NotFoundError

If the provided application isn't found.

BadRequestError

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

UnauthorizedError

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

RateLimitTooLongError

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

InternalServerError

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

create_dm_channel async #

create_dm_channel(user: SnowflakeishOr[PartialUser]) -> DMChannel

Create a DM channel with a user.

PARAMETER DESCRIPTION
user

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

TYPE: SnowflakeishOr[PartialUser]

RETURNS DESCRIPTION
DMChannel

The created DM channel.

RAISES DESCRIPTION
BadRequestError

If the user is not found.

UnauthorizedError

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

RateLimitTooLongError

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

InternalServerError

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

create_emoji async #

create_emoji(
    guild: SnowflakeishOr[PartialGuild],
    name: str,
    image: Resourceish,
    *,
    roles: UndefinedOr[SnowflakeishSequence[PartialRole]] = undefined.UNDEFINED,
    reason: UndefinedOr[str] = undefined.UNDEFINED
) -> KnownCustomEmoji

Create an emoji in a guild.

PARAMETER DESCRIPTION
guild

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

TYPE: SnowflakeishOr[PartialGuild]

name

The name for the emoji.

TYPE: str

image

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

TYPE: Resourceish

PARAMETER DESCRIPTION
roles

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.

TYPE: UndefinedOr[SnowflakeishSequence[PartialRole]]

reason

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

TYPE: UndefinedOr[str]

RETURNS DESCRIPTION
KnownCustomEmoji

The created emoji.

RAISES DESCRIPTION
BadRequestError

If any of the fields that are passed have an invalid value or if there are no more spaces for the type of emoji in the guild.

ForbiddenError
NotFoundError

If the guild is not found.

UnauthorizedError

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

RateLimitTooLongError

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

InternalServerError

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

create_external_event async #

create_external_event(
    guild: SnowflakeishOr[PartialGuild],
    name: str,
    /,
    location: str,
    start_time: datetime,
    end_time: datetime,
    *,
    description: UndefinedOr[str] = undefined.UNDEFINED,
    image: UndefinedOr[Resourceish] = undefined.UNDEFINED,
    privacy_level: Union[
        int, EventPrivacyLevel
    ] = scheduled_events.EventPrivacyLevel.GUILD_ONLY,
    reason: UndefinedOr[str] = undefined.UNDEFINED,
) -> ScheduledExternalEvent

Create a scheduled external event.

PARAMETER DESCRIPTION
guild

The guild to create the event in.

TYPE: SnowflakeishOr[PartialGuild]

name

The name of the event.

TYPE: str

location

The location the event.

TYPE: str

start_time

When the event is scheduled to start.

TYPE: datetime

end_time

When the event is scheduled to end.

TYPE: datetime

PARAMETER DESCRIPTION
description

The event's description.

TYPE: UndefinedOr[str]

image

The event's display image.

TYPE: UndefinedOr[Resourceish]

privacy_level

The event's privacy level.

This effects who can view and subscribe to the event.

TYPE: UndefinedOr[EventPrivacyLevel]

reason

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

TYPE: UndefinedOr[str]

RETURNS DESCRIPTION
ScheduledExternalEvent

The created scheduled external event.

RAISES DESCRIPTION
BadRequestError

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

UnauthorizedError

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

ForbiddenError

If you are missing the hikari.permissions.Permissions.MANAGE_EVENTS permission.

NotFoundError

If the guild or event is not found.

RateLimitTooLongError

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

InternalServerError

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

create_forum_post async #

create_forum_post(
    channel: SnowflakeishOr[PermissibleGuildChannel],
    name: str,
    /,
    content: UndefinedOr[Any] = undefined.UNDEFINED,
    *,
    attachment: UndefinedOr[Resourceish] = undefined.UNDEFINED,
    attachments: UndefinedOr[Sequence[Resourceish]] = undefined.UNDEFINED,
    component: UndefinedOr[ComponentBuilder] = undefined.UNDEFINED,
    components: UndefinedOr[Sequence[ComponentBuilder]] = undefined.UNDEFINED,
    embed: UndefinedOr[Embed] = undefined.UNDEFINED,
    embeds: UndefinedOr[Sequence[Embed]] = undefined.UNDEFINED,
    sticker: UndefinedOr[SnowflakeishOr[PartialSticker]] = undefined.UNDEFINED,
    stickers: UndefinedOr[
        SnowflakeishSequence[PartialSticker]
    ] = undefined.UNDEFINED,
    tts: UndefinedOr[bool] = undefined.UNDEFINED,
    mentions_everyone: UndefinedOr[bool] = undefined.UNDEFINED,
    mentions_reply: UndefinedOr[bool] = undefined.UNDEFINED,
    user_mentions: UndefinedOr[
        Union[SnowflakeishSequence[PartialUser], bool]
    ] = undefined.UNDEFINED,
    role_mentions: UndefinedOr[
        Union[SnowflakeishSequence[PartialRole], bool]
    ] = undefined.UNDEFINED,
    flags: Union[UndefinedType, int, MessageFlag] = undefined.UNDEFINED,
    auto_archive_duration: UndefinedOr[Intervalish] = datetime.timedelta(
        days=1
    ),
    rate_limit_per_user: UndefinedOr[Intervalish] = undefined.UNDEFINED,
    tags: UndefinedOr[Sequence[SnowflakeishOr[ForumTag]]] = undefined.UNDEFINED,
    reason: UndefinedOr[str] = undefined.UNDEFINED,
) -> GuildPublicThread

Create a post in a forum channel.

PARAMETER DESCRIPTION
channel

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

TYPE: SnowflakeishOr[PermissibleGuildChannel]

name

Name of the post.

TYPE: str

content

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.

TYPE: UndefinedOr[Any] DEFAULT: UNDEFINED

PARAMETER DESCRIPTION
attachment

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

Attachments can be passed as many different things, to aid in convenience.

TYPE: UndefinedOr[Resourceish]

attachments

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

TYPE: UndefinedOr[Sequence[Resourceish]]

component

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

TYPE: UndefinedOr[ComponentBuilder]

components

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

TYPE: UndefinedOr[Sequence[ComponentBuilder]]

embed

If provided, the message embed.

TYPE: UndefinedOr[Embed]

embeds

If provided, the message embeds.

TYPE: UndefinedOr[Sequence[Embed]]

sticker

If provided, the object or ID of a sticker to send on the message.

As of writing, bots can only send custom stickers from the current guild.

TYPE: UndefinedOr[SnowflakeishOr[PartialSticker]]

stickers

If provided, a sequence of the objects and IDs of up to 3 stickers to send on the message.

As of writing, bots can only send custom stickers from the current guild.

TYPE: UndefinedOr[SnowflakeishSequence[PartialSticker]]

tts

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

TYPE: UndefinedOr[bool]

mentions_everyone

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

TYPE: UndefinedOr[bool]

mentions_reply

If provided, whether to mention the author of the message that is being replied to.

This will not do anything if not being used with reply.

TYPE: UndefinedOr[bool]

user_mentions

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.

TYPE: UndefinedOr[Union[SnowflakeishSequence[PartialUser], bool]]

role_mentions

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.

TYPE: UndefinedOr[Union[SnowflakeishSequence[PartialRole], bool]]

flags

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 hikari.messages.MessageFlag.NONE and hikari.messages.MessageFlag.SUPPRESS_EMBEDS.

TYPE: UndefinedOr[MessageFlag]

auto_archive_duration

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

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

TYPE: UndefinedOr[Intervalish]

rate_limit_per_user

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

TYPE: UndefinedOr[Intervalish]

tags

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

TYPE: UndefinedOr[Sequence[SnowflakeishOr[ForumTag]]]

reason

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

TYPE: UndefinedOr[str]

RETURNS DESCRIPTION
GuildPublicThread

The created post.

RAISES DESCRIPTION
BadRequestError

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

ForbiddenError

If you are missing the hikari.permissions.Permissions.SEND_MESSAGES permission in the channel.

UnauthorizedError

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

RateLimitTooLongError

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

InternalServerError

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

create_guild_category async #

create_guild_category(
    guild: SnowflakeishOr[PartialGuild],
    name: str,
    *,
    position: UndefinedOr[int] = undefined.UNDEFINED,
    permission_overwrites: UndefinedOr[
        Sequence[PermissionOverwrite]
    ] = undefined.UNDEFINED,
    reason: UndefinedOr[str] = undefined.UNDEFINED
) -> GuildCategory

Create a category in a guild.

PARAMETER DESCRIPTION
guild

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

TYPE: SnowflakeishOr[PartialGuild]

name

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

TYPE: str

PARAMETER DESCRIPTION
position

If provided, the position of the category.

TYPE: UndefinedOr[int]

permission_overwrites

If provided, the permission overwrites for the category.

TYPE: UndefinedOr[Sequence[PermissionOverwrite]]

reason

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

TYPE: UndefinedOr[str]

RETURNS DESCRIPTION
GuildCategory

The created category.

RAISES DESCRIPTION
BadRequestError

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

ForbiddenError

If you are missing the hikari.permissions.Permissions.MANAGE_CHANNELS permission.

UnauthorizedError

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

NotFoundError

If the guild is not found.

RateLimitTooLongError

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

InternalServerError

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

create_guild_forum_channel async #

create_guild_forum_channel(
    guild: SnowflakeishOr[PartialGuild],
    name: str,
    *,
    position: UndefinedOr[int] = undefined.UNDEFINED,
    category: UndefinedOr[SnowflakeishOr[GuildCategory]] = undefined.UNDEFINED,
    permission_overwrites: UndefinedOr[
        Sequence[PermissionOverwrite]
    ] = undefined.UNDEFINED,
    topic: UndefinedOr[str] = undefined.UNDEFINED,
    nsfw: UndefinedOr[bool] = undefined.UNDEFINED,
    rate_limit_per_user: UndefinedOr[Intervalish] = undefined.UNDEFINED,
    default_auto_archive_duration: UndefinedOr[
        Intervalish
    ] = undefined.UNDEFINED,
    default_thread_rate_limit_per_user: UndefinedOr[
        Intervalish
    ] = undefined.UNDEFINED,
    default_forum_layout: UndefinedOr[
        Union[ForumLayoutType, int]
    ] = undefined.UNDEFINED,
    default_sort_order: UndefinedOr[
        Union[ForumSortOrderType, int]
    ] = undefined.UNDEFINED,
    available_tags: UndefinedOr[Sequence[ForumTag]] = undefined.UNDEFINED,
    default_reaction_emoji: Union[
        str, Emoji, UndefinedType, Snowflake
    ] = undefined.UNDEFINED,
    reason: UndefinedOr[str] = undefined.UNDEFINED
) -> GuildForumChannel

Create a forum channel in a guild.

PARAMETER DESCRIPTION
guild

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

TYPE: SnowflakeishOr[PartialGuild]

name

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

TYPE: str

PARAMETER DESCRIPTION
position

If provided, the position of the category.

TYPE: UndefinedOr[int]

category

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

TYPE: UndefinedOr[SnowflakeishOr[GuildCategory]]

permission_overwrites

If provided, the permission overwrites for the category.

TYPE: UndefinedOr[Sequence[PermissionOverwrite]]

topic

If provided, the channels topic. Maximum 1024 characters.

TYPE: UndefinedOr[str]

nsfw

If provided, whether to mark the channel as NSFW.

TYPE: UndefinedOr[bool]

rate_limit_per_user

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

TYPE: UndefinedOr[Intervalish]

default_auto_archive_duration

If provided, the auto archive duration Discord's end user client should default to when creating threads in this channel.

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

TYPE: UndefinedOr[Intervalish]

default_thread_rate_limit_per_user

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

TYPE: UndefinedOr[Intervalish]

default_forum_layout

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

TYPE: UndefinedOr[Union[ForumLayoutType, int]]

default_sort_order

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

TYPE: UndefinedOr[Union[ForumSortOrderType, int]]

available_tags

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

TYPE: UndefinedOr[Sequence[ForumTag]]

default_reaction_emoji

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

TYPE: Union[str, Emoji, UndefinedType, Snowflake]

reason

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

TYPE: UndefinedOr[str]

RETURNS DESCRIPTION
GuildForumChannel

The created forum channel.

RAISES DESCRIPTION
BadRequestError

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

ForbiddenError

If you are missing the hikari.permissions.Permissions.MANAGE_CHANNELS permission.

UnauthorizedError

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

NotFoundError

If the guild is not found.

RateLimitTooLongError

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

InternalServerError

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

create_guild_from_template async #

create_guild_from_template(
    template: Union[str, Template],
    name: str,
    *,
    icon: UndefinedOr[Resourceish] = undefined.UNDEFINED
) -> RESTGuild

Make a guild from a template.

Note

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

PARAMETER DESCRIPTION
template

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

TYPE: Union[str, Template]

name

The new guilds name.

TYPE: str

PARAMETER DESCRIPTION
icon

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

TYPE: UndefinedOr[Resourceish]

RETURNS DESCRIPTION
RESTGuild

Object of the created guild.

RAISES DESCRIPTION
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.

UnauthorizedError

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

RateLimitTooLongError

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

InternalServerError

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

create_guild_news_channel async #

create_guild_news_channel(
    guild: SnowflakeishOr[PartialGuild],
    name: str,
    *,
    position: UndefinedOr[int] = undefined.UNDEFINED,
    topic: UndefinedOr[str] = undefined.UNDEFINED,
    nsfw: UndefinedOr[bool] = undefined.UNDEFINED,
    rate_limit_per_user: UndefinedOr[Intervalish] = undefined.UNDEFINED,
    permission_overwrites: UndefinedOr[
        Sequence[PermissionOverwrite]
    ] = undefined.UNDEFINED,
    category: UndefinedOr[SnowflakeishOr[GuildCategory]] = undefined.UNDEFINED,
    default_auto_archive_duration: UndefinedOr[
        Intervalish
    ] = undefined.UNDEFINED,
    reason: UndefinedOr[str] = undefined.UNDEFINED
) -> GuildNewsChannel

Create a news channel in a guild.

PARAMETER DESCRIPTION
guild

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

TYPE: SnowflakeishOr[PartialGuild]

name

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

TYPE: str

PARAMETER DESCRIPTION
position

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

TYPE: UndefinedOr[int]

topic

If provided, the channels topic. Maximum 1024 characters.

TYPE: UndefinedOr[str]

nsfw

If provided, whether to mark the channel as NSFW.

TYPE: UndefinedOr[bool]

rate_limit_per_user

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

TYPE: UndefinedOr[Intervalish]

permission_overwrites

If provided, the permission overwrites for the channel.

TYPE: UndefinedOr[Sequence[PermissionOverwrite]]

category

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

TYPE: UndefinedOr[SnowflakeishOr[GuildCategory]]

default_auto_archive_duration

If provided, the auto archive duration Discord's end user client should default to when creating threads in this channel.

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

TYPE: UndefinedOr[Intervalish]

reason

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

TYPE: UndefinedOr[str]

RETURNS DESCRIPTION
GuildNewsChannel

The created channel.

RAISES DESCRIPTION
BadRequestError

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

ForbiddenError

If you are missing the hikari.permissions.Permissions.MANAGE_CHANNELS permission.

UnauthorizedError

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

NotFoundError

If the guild is not found.

RateLimitTooLongError

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

InternalServerError

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

create_guild_stage_channel async #

create_guild_stage_channel(
    guild: SnowflakeishOr[PartialGuild],
    name: str,
    *,
    position: UndefinedOr[int] = undefined.UNDEFINED,
    user_limit: UndefinedOr[int] = undefined.UNDEFINED,
    bitrate: UndefinedOr[int] = undefined.UNDEFINED,
    permission_overwrites: UndefinedOr[
        Sequence[PermissionOverwrite]
    ] = undefined.UNDEFINED,
    region: UndefinedOr[Union[VoiceRegion, str]] = undefined.UNDEFINED,
    category: UndefinedOr[SnowflakeishOr[GuildCategory]] = undefined.UNDEFINED,
    reason: UndefinedOr[str] = undefined.UNDEFINED
) -> GuildStageChannel

Create a stage channel in a guild.

PARAMETER DESCRIPTION
guild

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

TYPE: SnowflakeishOr[PartialGuild]

name

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

TYPE: str

PARAMETER DESCRIPTION
position

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

TYPE: UndefinedOr[int]

user_limit

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

TYPE: UndefinedOr[int]

bitrate

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

TYPE: UndefinedOr[int]

permission_overwrites

If provided, the permission overwrites for the channel.

TYPE: UndefinedOr[Sequence[PermissionOverwrite]]

region

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.

TYPE: UndefinedOr[Union[VoiceRegion, str]]

category

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

TYPE: UndefinedOr[SnowflakeishOr[GuildCategory]]

reason

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

TYPE: UndefinedOr[str]

RETURNS DESCRIPTION
GuildStageChannel

The created channel.

RAISES DESCRIPTION
BadRequestError

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

ForbiddenError

If you are missing the hikari.permissions.Permissions.MANAGE_CHANNELS permission.

UnauthorizedError

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

NotFoundError

If the guild is not found.

RateLimitTooLongError

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

InternalServerError

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

create_guild_text_channel async #

create_guild_text_channel(
    guild: SnowflakeishOr[PartialGuild],
    name: str,
    *,
    position: UndefinedOr[int] = undefined.UNDEFINED,
    topic: UndefinedOr[str] = undefined.UNDEFINED,
    nsfw: UndefinedOr[bool] = undefined.UNDEFINED,
    rate_limit_per_user: UndefinedOr[Intervalish] = undefined.UNDEFINED,
    permission_overwrites: UndefinedOr[
        Sequence[PermissionOverwrite]
    ] = undefined.UNDEFINED,
    category: UndefinedOr[SnowflakeishOr[GuildCategory]] = undefined.UNDEFINED,
    default_auto_archive_duration: UndefinedOr[
        Intervalish
    ] = undefined.UNDEFINED,
    reason: UndefinedOr[str] = undefined.UNDEFINED
) -> GuildTextChannel

Create a text channel in a guild.

PARAMETER DESCRIPTION
guild

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

TYPE: SnowflakeishOr[PartialGuild]

name

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

TYPE: str

PARAMETER DESCRIPTION
position

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

TYPE: UndefinedOr[int]

topic

If provided, the channels topic. Maximum 1024 characters.

TYPE: UndefinedOr[str]

nsfw

If provided, whether to mark the channel as NSFW.

TYPE: UndefinedOr[bool]

rate_limit_per_user

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

TYPE: UndefinedOr[Intervalish]

permission_overwrites

If provided, the permission overwrites for the channel.

TYPE: UndefinedOr[Sequence[PermissionOverwrite]]

category

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

TYPE: UndefinedOr[SnowflakeishOr[GuildCategory]]

default_auto_archive_duration

If provided, the auto archive duration Discord's end user client should default to when creating threads in this channel.

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

TYPE: UndefinedOr[Intervalish]

reason

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

TYPE: UndefinedOr[str]

RETURNS DESCRIPTION
GuildTextChannel

The created channel.

RAISES DESCRIPTION
BadRequestError

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

ForbiddenError

If you are missing the hikari.permissions.Permissions.MANAGE_CHANNELS permission.

UnauthorizedError

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

NotFoundError

If the guild is not found.

RateLimitTooLongError

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

InternalServerError

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

create_guild_voice_channel async #

create_guild_voice_channel(
    guild: SnowflakeishOr[PartialGuild],
    name: str,
    *,
    position: UndefinedOr[int] = undefined.UNDEFINED,
    user_limit: UndefinedOr[int] = undefined.UNDEFINED,
    bitrate: UndefinedOr[int] = undefined.UNDEFINED,
    video_quality_mode: UndefinedOr[
        Union[VideoQualityMode, int]
    ] = undefined.UNDEFINED,
    permission_overwrites: UndefinedOr[
        Sequence[PermissionOverwrite]
    ] = undefined.UNDEFINED,
    region: UndefinedOr[Union[VoiceRegion, str]] = undefined.UNDEFINED,
    category: UndefinedOr[SnowflakeishOr[GuildCategory]] = undefined.UNDEFINED,
    reason: UndefinedOr[str] = undefined.UNDEFINED
) -> GuildVoiceChannel

Create a voice channel in a guild.

PARAMETER DESCRIPTION
guild

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

TYPE: SnowflakeishOr[PartialGuild]

name

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

TYPE: str

PARAMETER DESCRIPTION
position

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

TYPE: UndefinedOr[int]

user_limit

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

TYPE: UndefinedOr[int]

bitrate

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

TYPE: UndefinedOr[int]

video_quality_mode

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

TYPE: UndefinedOr[Union[VideoQualityMode, int]]

permission_overwrites

If provided, the permission overwrites for the channel.

TYPE: UndefinedOr[Sequence[PermissionOverwrite]]

region

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.

TYPE: UndefinedOr[Union[VoiceRegion, str]]

category

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

TYPE: UndefinedOr[SnowflakeishOr[GuildCategory]]

reason

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

TYPE: UndefinedOr[str]

RETURNS DESCRIPTION
GuildVoiceChannel

The created channel.

RAISES DESCRIPTION
BadRequestError

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

ForbiddenError

If you are missing the hikari.permissions.Permissions.MANAGE_CHANNELS permission.

UnauthorizedError

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

NotFoundError

If the guild is not found.

RateLimitTooLongError

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

InternalServerError

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

create_interaction_response async #

create_interaction_response(
    interaction: SnowflakeishOr[PartialInteraction],
    token: str,
    response_type: Union[int, ResponseType],
    content: UndefinedNoneOr[Any] = undefined.UNDEFINED,
    *,
    flags: Union[int, MessageFlag, UndefinedType] = undefined.UNDEFINED,
    tts: UndefinedOr[bool] = undefined.UNDEFINED,
    attachment: UndefinedNoneOr[Resourceish] = undefined.UNDEFINED,
    attachments: UndefinedNoneOr[Sequence[Resourceish]] = undefined.UNDEFINED,
    component: UndefinedNoneOr[ComponentBuilder] = undefined.UNDEFINED,
    components: UndefinedNoneOr[
        Sequence[ComponentBuilder]
    ] = undefined.UNDEFINED,
    embed: UndefinedNoneOr[Embed] = undefined.UNDEFINED,
    embeds: UndefinedNoneOr[Sequence[Embed]] = undefined.UNDEFINED,
    mentions_everyone: UndefinedOr[bool] = undefined.UNDEFINED,
    user_mentions: UndefinedOr[
        Union[SnowflakeishSequence[PartialUser], bool]
    ] = undefined.UNDEFINED,
    role_mentions: UndefinedOr[
        Union[SnowflakeishSequence[PartialRole], bool]
    ] = undefined.UNDEFINED
) -> None

Create the initial response for a interaction.

Warning

Calling this with an interaction which already has an initial response will result in this raising a hikari.errors.NotFoundError. This includes if the REST interaction server has already responded to the request.

PARAMETER DESCRIPTION
interaction

Object or ID of the interaction this response is for.

TYPE: SnowflakeishOr[PartialInteraction]

token

The command interaction's token.

TYPE: str

response_type

The type of interaction response this is.

TYPE: Union[int, ResponseType]

PARAMETER DESCRIPTION
content

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.

TYPE: UndefinedOr[Any]

attachment

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

TYPE: UndefinedNoneOr[Union[Resourceish, Attachment]]

attachments

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

TYPE: UndefinedNoneOr[Sequence[Union[Resourceish, Attachment]]]

component

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

TYPE: UndefinedNoneOr[ComponentBuilder]

components

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

TYPE: UndefinedNoneOr[Sequence[ComponentBuilder]]

embed

If provided, the message embed.

TYPE: UndefinedNoneOr[Embed]

embeds

If provided, the message embeds.

TYPE: UndefinedNoneOr[Sequence[Embed]]

flags

If provided, the message flags this response should have.

As of writing the only message flags which can be set here are hikari.messages.MessageFlag.EPHEMERAL, hikari.messages.MessageFlag.SUPPRESS_NOTIFICATIONS and hikari.messages.MessageFlag.SUPPRESS_EMBEDS.

TYPE: Union[int, MessageFlag, UndefinedType]

tts

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

TYPE: UndefinedOr[bool]

mentions_everyone

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

TYPE: UndefinedOr[bool]

user_mentions

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.

TYPE: UndefinedOr[Union[SnowflakeishSequence[PartialUser], bool]]

role_mentions

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.

TYPE: UndefinedOr[Union[SnowflakeishSequence[PartialRole], bool]]

RAISES DESCRIPTION
ValueError

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

TypeError

If both embed and embeds are specified.

BadRequestError

This may be raised in several discrete situations, such as messages being empty with no embeds; messages with more than 2000 characters in them, embeds that exceed one of the many embed limits invalid image URLs in embeds.

UnauthorizedError

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

NotFoundError

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

RateLimitTooLongError

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

InternalServerError

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

create_invite async #

create_invite(
    channel: SnowflakeishOr[GuildChannel],
    *,
    max_age: UndefinedOr[Intervalish] = undefined.UNDEFINED,
    max_uses: UndefinedOr[int] = undefined.UNDEFINED,
    temporary: UndefinedOr[bool] = undefined.UNDEFINED,
    unique: UndefinedOr[bool] = undefined.UNDEFINED,
    target_type: UndefinedOr[TargetType] = undefined.UNDEFINED,
    target_user: UndefinedOr[SnowflakeishOr[PartialUser]] = undefined.UNDEFINED,
    target_application: UndefinedOr[
        SnowflakeishOr[PartialApplication]
    ] = undefined.UNDEFINED,
    reason: UndefinedOr[str] = undefined.UNDEFINED
) -> InviteWithMetadata

Create an invite to the given guild channel.

PARAMETER DESCRIPTION
channel

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

TYPE: SnowflakeishOr[GuildChannel]

PARAMETER DESCRIPTION
max_age

If provided, the duration of the invite before expiry.

TYPE: UndefinedOr[Union[timedelta, float, int]]

max_uses

If provided, the max uses the invite can have.

TYPE: UndefinedOr[int]

temporary

If provided, whether the invite only grants temporary membership.

TYPE: UndefinedOr[bool]

unique

If provided, whether the invite should be unique.

TYPE: UndefinedOr[bool]

target_type

If provided, the target type of this invite.

TYPE: UndefinedOr[TargetType]

target_user

If provided, the target user id for this invite. This may be the object or the ID of an existing user.

Note

This is required if target_type is hikari.invites.TargetType.STREAM and the targeted user must be streaming into the channel.

TYPE: UndefinedOr[SnowflakeishOr[PartialUser]]

target_application

If provided, the target application id for this invite. This may be the object or the ID of an existing application.

Note

This is required if target_type is hikari.invites.TargetType.EMBEDDED_APPLICATION and the targeted application must have the hikari.applications.ApplicationFlags.EMBEDDED flag.

TYPE: UndefinedOr[SnowflakeishOr[PartialApplication]]

reason

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

TYPE: UndefinedOr[str]

RETURNS DESCRIPTION
InviteWithMetadata

The invite to the given guild channel.

RAISES DESCRIPTION
BadRequestError

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

UnauthorizedError

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

ForbiddenError

If you are missing the hikari.permissions.Permissions.MANAGE_CHANNELS permission.

NotFoundError

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

RateLimitTooLongError

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

InternalServerError

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

create_message async #

create_message(
    channel: SnowflakeishOr[TextableChannel],
    content: UndefinedOr[Any] = undefined.UNDEFINED,
    *,
    attachment: UndefinedOr[Resourceish] = undefined.UNDEFINED,
    attachments: UndefinedOr[Sequence[Resourceish]] = undefined.UNDEFINED,
    component: UndefinedOr[ComponentBuilder] = undefined.UNDEFINED,
    components: UndefinedOr[Sequence[ComponentBuilder]] = undefined.UNDEFINED,
    embed: UndefinedOr[Embed] = undefined.UNDEFINED,
    embeds: UndefinedOr[Sequence[Embed]] = undefined.UNDEFINED,
    sticker: UndefinedOr[SnowflakeishOr[PartialSticker]] = undefined.UNDEFINED,
    stickers: UndefinedOr[
        SnowflakeishSequence[PartialSticker]
    ] = undefined.UNDEFINED,
    tts: UndefinedOr[bool] = undefined.UNDEFINED,
    reply: UndefinedOr[SnowflakeishOr[PartialMessage]] = undefined.UNDEFINED,
    reply_must_exist: UndefinedOr[bool] = undefined.UNDEFINED,
    mentions_everyone: UndefinedOr[bool] = undefined.UNDEFINED,
    mentions_reply: UndefinedOr[bool] = undefined.UNDEFINED,
    user_mentions: UndefinedOr[
        Union[SnowflakeishSequence[PartialUser], bool]
    ] = undefined.UNDEFINED,
    role_mentions: UndefinedOr[
        Union[SnowflakeishSequence[PartialRole], bool]
    ] = undefined.UNDEFINED,
    flags: Union[UndefinedType, int, MessageFlag] = undefined.UNDEFINED
) -> Message

Create a message in the given channel.

PARAMETER DESCRIPTION
channel

The channel to create the message in.

TYPE: SnowflakeishOr[TextableChannel]

content

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.

TYPE: UndefinedOr[Any] DEFAULT: UNDEFINED

PARAMETER DESCRIPTION
attachment

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

Attachments can be passed as many different things, to aid in convenience.

TYPE: UndefinedOr[Resourceish]

attachments

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

TYPE: UndefinedOr[Sequence[Resourceish]]

component

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

TYPE: UndefinedOr[ComponentBuilder]

components

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

TYPE: UndefinedOr[Sequence[ComponentBuilder]]

embed

If provided, the message embed.

TYPE: UndefinedOr[Embed]

embeds

If provided, the message embeds.

TYPE: UndefinedOr[Sequence[Embed]]

sticker

If provided, the object or ID of a sticker to send on the message.

As of writing, bots can only send custom stickers from the current guild.

TYPE: UndefinedOr[SnowflakeishOr[PartialSticker]]

stickers

If provided, a sequence of the objects and IDs of up to 3 stickers to send on the message.

As of writing, bots can only send custom stickers from the current guild.

TYPE: UndefinedOr[SnowflakeishSequence[PartialSticker]]

tts

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

TYPE: UndefinedOr[bool]

reply

If provided, the message to reply to.

TYPE: UndefinedOr[SnowflakeishOr[PartialMessage]]

reply_must_exist

If provided, whether to error if the message being replied to does not exist instead of sending as a normal (non-reply) message.

This will not do anything if not being used with reply.

TYPE: UndefinedOr[bool]

mentions_everyone

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

TYPE: UndefinedOr[bool]

mentions_reply

If provided, whether to mention the author of the message that is being replied to.

This will not do anything if not being used with reply.

TYPE: UndefinedOr[bool]

user_mentions

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.

TYPE: UndefinedOr[Union[SnowflakeishSequence[PartialUser], bool]]

role_mentions

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.

TYPE: UndefinedOr[Union[SnowflakeishSequence[PartialRole], bool]]

flags

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 [hikari.messages.MessageFlag.SUPPRESS_NOTIFICATIONS] and [hikari.messages.MessageFlag.SUPPRESS_EMBEDS].

TYPE: UndefinedOr[MessageFlag]

RETURNS DESCRIPTION
Message

The created message.

RAISES DESCRIPTION
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.

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.

UnauthorizedError

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

ForbiddenError

If you are missing the [hikari.permissions.Permissions.SEND_MESSAGES] in the channel or the person you are trying to message has the DM's disabled.

NotFoundError

If the channel is not found.

RateLimitTooLongError

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

InternalServerError

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

create_message_thread async #

create_message_thread(
    channel: SnowflakeishOr[PermissibleGuildChannel],
    message: SnowflakeishOr[PartialMessage],
    name: str,
    /,
    *,
    auto_archive_duration: UndefinedOr[Intervalish] = datetime.timedelta(
        days=1
    ),
    rate_limit_per_user: UndefinedOr[Intervalish] = undefined.UNDEFINED,
    reason: UndefinedOr[str] = undefined.UNDEFINED,
) -> Union[GuildPublicThread, GuildNewsThread]

Create a public or news thread on a message in a guild channel.

Note

This call may create a public or news thread dependent on the target channel's type and cannot create private threads.

PARAMETER DESCRIPTION
channel

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

TYPE: SnowflakeishOr[PermissibleGuildChannel]

message

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

TYPE: SnowflakeishOr[PartialMessage]

name

Name of the thread channel.

TYPE: str

PARAMETER DESCRIPTION
auto_archive_duration

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

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

TYPE: UndefinedOr[Intervalish]

rate_limit_per_user

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

TYPE: UndefinedOr[Intervalish]

reason

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

TYPE: UndefinedOr[str]

RETURNS DESCRIPTION
Union[GuildPublicThread, GuildNewsThread]

The created public or news thread channel.

RAISES DESCRIPTION
BadRequestError

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

ForbiddenError

If you are missing the hikari.permissions.Permissions.CREATE_PUBLIC_THREADS permission or if you can't send messages in the target channel.

UnauthorizedError

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

RateLimitTooLongError

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

InternalServerError

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

create_modal_response async #

create_modal_response(
    interaction: SnowflakeishOr[PartialInteraction],
    token: str,
    *,
    title: str,
    custom_id: str,
    component: UndefinedOr[ComponentBuilder] = undefined.UNDEFINED,
    components: UndefinedOr[Sequence[ComponentBuilder]] = undefined.UNDEFINED
) -> None

Create a response by sending a modal.

PARAMETER DESCRIPTION
interaction

Object or ID of the interaction this response is for.

TYPE: SnowflakeishOr[PartialInteraction]

token

The command interaction's token.

TYPE: str

title

The title that will show up in the modal.

TYPE: str

custom_id

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

TYPE: str

PARAMETER DESCRIPTION
component

A component builders to send in this modal.

TYPE: UndefinedOr[Sequence[ComponentBuilder]]

components

A sequence of component builders to send in this modal.

TYPE: UndefinedOr[Sequence[ComponentBuilder]]

RAISES DESCRIPTION
ValueError

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

create_role async #

create_role(
    guild: SnowflakeishOr[PartialGuild],
    *,
    name: UndefinedOr[str] = undefined.UNDEFINED,
    permissions: UndefinedOr[Permissions] = permissions_.Permissions.NONE,
    color: UndefinedOr[Colorish] = undefined.UNDEFINED,
    colour: UndefinedOr[Colorish] = undefined.UNDEFINED,
    hoist: UndefinedOr[bool] = undefined.UNDEFINED,
    icon: UndefinedOr[Resourceish] = undefined.UNDEFINED,
    unicode_emoji: UndefinedOr[str] = undefined.UNDEFINED,
    mentionable: UndefinedOr[bool] = undefined.UNDEFINED,
    reason: UndefinedOr[str] = undefined.UNDEFINED
) -> Role

Create a role.

PARAMETER DESCRIPTION
guild

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

TYPE: SnowflakeishOr[PartialGuild]

PARAMETER DESCRIPTION
name

If provided, the name for the role.

TYPE: UndefinedOr[str]

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.

TYPE: UndefinedOr[Permissions]

color

If provided, the role's color.

TYPE: UndefinedOr[Colorish]

colour

An alias for color.

TYPE: UndefinedOr[Colorish]

hoist

If provided, whether to hoist the role.

TYPE: UndefinedOr[bool]

icon

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

TYPE: UndefinedOr[Resourceish]

unicode_emoji

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

TYPE: UndefinedOr[str]

mentionable

If provided, whether to make the role mentionable.

TYPE: UndefinedOr[bool]

reason

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

TYPE: UndefinedOr[str]

RETURNS DESCRIPTION
Role

The created role.

RAISES DESCRIPTION
TypeError

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

BadRequestError

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

ForbiddenError

If you are missing the hikari.permissions.Permissions.MANAGE_ROLES permission.

UnauthorizedError

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

NotFoundError

If the guild is not found.

RateLimitTooLongError

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

InternalServerError

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

create_slash_command async #

create_slash_command(
    application: SnowflakeishOr[PartialApplication],
    name: str,
    description: str,
    *,
    guild: UndefinedOr[SnowflakeishOr[PartialGuild]] = undefined.UNDEFINED,
    options: UndefinedOr[Sequence[CommandOption]] = undefined.UNDEFINED,
    name_localizations: UndefinedOr[
        Mapping[Union[Locale, str], str]
    ] = undefined.UNDEFINED,
    description_localizations: UndefinedOr[
        Mapping[Union[Locale, str], str]
    ] = undefined.UNDEFINED,
    default_member_permissions: Union[
        UndefinedType, int, Permissions
    ] = undefined.UNDEFINED,
    dm_enabled: UndefinedOr[bool] = undefined.UNDEFINED,
    nsfw: UndefinedOr[bool] = undefined.UNDEFINED
) -> SlashCommand

Create an application command.

PARAMETER DESCRIPTION
application

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

TYPE: SnowflakeishOr[PartialApplication]

name

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

TYPE: str

description

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

TYPE: str

PARAMETER DESCRIPTION
guild

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.

TYPE: hikari.undefined.UndefinedOr[hikari.snowflakes.SnowflakeishOr[hikari.guilds.PartialGuild]

options

A sequence of up to 10 options for this command.

TYPE: UndefinedOr[Sequence[CommandOption]]

name_localizations

The name localizations for this command.

TYPE: UndefinedOr[Mapping[Union[Locale, str], str]]

description_localizations

The description localizations for this command.

TYPE: UndefinedOr[Mapping[Union[Locale, str], str]]

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

TYPE: Union[UndefinedType, int, Permissions]

dm_enabled

Whether this command is enabled in DMs with the bot.

This can only be applied to non-guild commands.

TYPE: UndefinedOr[bool]

nsfw

Whether this command should be age-restricted.

TYPE: UndefinedOr[bool]

RETURNS DESCRIPTION
SlashCommand

Object of the created command.

RAISES DESCRIPTION
ForbiddenError

If you cannot access the provided application's commands.

NotFoundError

If the provided application isn't found.

BadRequestError

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

UnauthorizedError

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

RateLimitTooLongError

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

InternalServerError

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

create_stage_event async #

create_stage_event(
    guild: SnowflakeishOr[PartialGuild],
    channel: SnowflakeishOr[PartialChannel],
    name: str,
    /,
    start_time: datetime,
    *,
    description: UndefinedOr[str] = undefined.UNDEFINED,
    end_time: UndefinedOr[datetime] = undefined.UNDEFINED,
    image: UndefinedOr[Resourceish] = undefined.UNDEFINED,
    privacy_level: Union[
        int, EventPrivacyLevel
    ] = scheduled_events.EventPrivacyLevel.GUILD_ONLY,
    reason: UndefinedOr[str] = undefined.UNDEFINED,
) -> ScheduledStageEvent

Create a scheduled stage event.

PARAMETER DESCRIPTION
guild

The guild to create the event in.

TYPE: SnowflakeishOr[PartialGuild]

channel

The stage channel to create the event in.

TYPE: SnowflakeishOr[PartialChannel]

name

The name of the event.

TYPE: str

start_time

When the event is scheduled to start.

TYPE: datetime

PARAMETER DESCRIPTION
description

The event's description.

TYPE: UndefinedOr[str]

end_time

When the event should be scheduled to end.

TYPE: UndefinedOr[datetime]

image

The event's display image.

TYPE: UndefinedOr[Resourceish]

privacy_level

The event's privacy level.

This effects who can view and subscribe to the event.

TYPE: UndefinedOr[EventPrivacyLevel]

reason

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

TYPE: UndefinedOr[str]

RETURNS DESCRIPTION
ScheduledStageEvent

The created scheduled stage event.

RAISES DESCRIPTION
BadRequestError

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

UnauthorizedError

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

ForbiddenError

If you are missing permissions to create the scheduled event.

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

NotFoundError

If the guild or event is not found.

RateLimitTooLongError

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

InternalServerError

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

create_sticker async #

create_sticker(
    guild: SnowflakeishOr[PartialGuild],
    name: str,
    tag: str,
    image: Resourceish,
    *,
    description: UndefinedOr[str] = undefined.UNDEFINED,
    reason: UndefinedOr[str] = undefined.UNDEFINED
) -> GuildSticker

Create a sticker in a guild.

PARAMETER DESCRIPTION
guild

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

TYPE: SnowflakeishOr[PartialGuild]

name

The name for the sticker.

TYPE: str

tag

The tag for the sticker.

TYPE: str

image

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

Note

Lottie support is only available for verified and partnered servers.

TYPE: Resourceish

PARAMETER DESCRIPTION
description

If provided, the description of the sticker.

TYPE: UndefinedOr[str]

reason

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

TYPE: UndefinedOr[str]

RETURNS DESCRIPTION
GuildSticker

The created sticker.

RAISES DESCRIPTION
BadRequestError

If any of the fields that are passed have an invalid value or if there are no more spaces for the sticker in the guild.

ForbiddenError
NotFoundError

If the guild is not found.

UnauthorizedError

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

RateLimitTooLongError

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

InternalServerError

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

create_template async #

create_template(
    guild: SnowflakeishOr[PartialGuild],
    name: str,
    *,
    description: UndefinedNoneOr[str] = undefined.UNDEFINED
) -> Template

Create a guild template.

PARAMETER DESCRIPTION
guild

The guild to create a template from.

TYPE: SnowflakeishOr[PartialGuild]

name

The name to use for the created template.

TYPE: str

PARAMETER DESCRIPTION
description

The description to set for the template.

TYPE: UndefinedNoneOr[str]

RETURNS DESCRIPTION
Template

The object of the created template.

RAISES DESCRIPTION
ForbiddenError

If you are not part of the guild.

NotFoundError

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

UnauthorizedError

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

RateLimitTooLongError

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

InternalServerError

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

create_thread async #

create_thread(
    channel: SnowflakeishOr[PermissibleGuildChannel],
    type: Union[ChannelType, int],
    name: str,
    /,
    *,
    auto_archive_duration: UndefinedOr[Intervalish] = datetime.timedelta(
        days=1
    ),
    invitable: UndefinedOr[bool] = undefined.UNDEFINED,
    rate_limit_per_user: UndefinedOr[Intervalish] = undefined.UNDEFINED,
    reason: UndefinedOr[str] = undefined.UNDEFINED,
) -> GuildThreadChannel

Create a thread in a guild channel.

Warning

Private and public threads can only be made in guild text channels, and news threads can only be made in guild news channels.

PARAMETER DESCRIPTION
channel

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

TYPE: SnowflakeishOr[PermissibleGuildChannel]

type

The thread type to create.

TYPE: Union[ChannelType, int]

name

Name of the thread channel.

TYPE: str

PARAMETER DESCRIPTION
auto_archive_duration

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

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

TYPE: UndefinedOr[Intervalish]

invitable

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

This only applies to private threads.

TYPE: UndefinedOr[bool]

rate_limit_per_user

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

TYPE: UndefinedOr[Intervalish]

reason

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

TYPE: UndefinedOr[str]

RETURNS DESCRIPTION
GuildThreadChannel

The created thread channel.

RAISES DESCRIPTION
BadRequestError

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

ForbiddenError

If you are missing the hikari.permissions.Permissions.CREATE_PUBLIC_THREADS permission or if you can't send messages in the target channel.

UnauthorizedError

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

RateLimitTooLongError

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

InternalServerError

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

create_voice_event async #

create_voice_event(
    guild: SnowflakeishOr[PartialGuild],
    channel: SnowflakeishOr[PartialChannel],
    name: str,
    /,
    start_time: datetime,
    *,
    description: UndefinedOr[str] = undefined.UNDEFINED,
    end_time: UndefinedOr[datetime] = undefined.UNDEFINED,
    image: UndefinedOr[Resourceish] = undefined.UNDEFINED,
    privacy_level: Union[
        int, EventPrivacyLevel
    ] = scheduled_events.EventPrivacyLevel.GUILD_ONLY,
    reason: UndefinedOr[str] = undefined.UNDEFINED,
) -> ScheduledVoiceEvent

Create a scheduled voice event.

PARAMETER DESCRIPTION
guild

The guild to create the event in.

TYPE: SnowflakeishOr[PartialGuild]

channel

The voice channel to create the event in.

TYPE: SnowflakeishOr[PartialChannel]

name

The name of the event.

TYPE: str

start_time

When the event is scheduled to start.

TYPE: datetime

PARAMETER DESCRIPTION
description

The event's description.

TYPE: UndefinedOr[str]

end_time

When the event should be scheduled to end.

TYPE: UndefinedOr[datetime]

image

The event's display image.

TYPE: UndefinedOr[Resourceish]

privacy_level

The event's privacy level.

This effects who can view and subscribe to the event.

TYPE: UndefinedOr[EventPrivacyLevel]

reason

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

TYPE: UndefinedOr[str]

RETURNS DESCRIPTION
ScheduledVoiceEvent

The created scheduled voice event.

RAISES DESCRIPTION
BadRequestError

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

UnauthorizedError

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

ForbiddenError

If you are missing permissions to create the scheduled event.

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

NotFoundError

If the guild or event is not found.

RateLimitTooLongError

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

InternalServerError

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

create_webhook async #

create_webhook(
    channel: SnowflakeishOr[WebhookChannelT],
    name: str,
    *,
    avatar: UndefinedOr[Resourceish] = undefined.UNDEFINED,
    reason: UndefinedOr[str] = undefined.UNDEFINED
) -> IncomingWebhook

Create webhook in a channel.

PARAMETER DESCRIPTION
channel

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

TYPE: SnowflakeishOr[WebhookChannelT]

name

The name for the webhook. This cannot be clyde.

TYPE: str

PARAMETER DESCRIPTION
avatar

If provided, the avatar for the webhook.

TYPE: Optional[Resourceish]

reason

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

TYPE: UndefinedOr[str]

RETURNS DESCRIPTION
IncomingWebhook

The created webhook.

RAISES DESCRIPTION
BadRequestError

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

ForbiddenError

If you are missing the hikari.permissions.Permissions.MANAGE_WEBHOOKS permission.

UnauthorizedError

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

NotFoundError

If the channel is not found.

RateLimitTooLongError

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

InternalServerError

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

crosspost_message async #

crosspost_message(
    channel: SnowflakeishOr[GuildNewsChannel],
    message: SnowflakeishOr[PartialMessage],
) -> Message

Broadcast an announcement message.

PARAMETER DESCRIPTION
channel

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

TYPE: SnowflakeishOr[GuildNewsChannel]

message

The object or ID of the message to crosspost.

TYPE: SnowflakeishOr[PartialMessage]

RETURNS DESCRIPTION
Message

The message object that was crossposted.

RAISES DESCRIPTION
BadRequestError

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

UnauthorizedError

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

ForbiddenError

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

NotFoundError

If the channel or message is not found.

RateLimitTooLongError

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

InternalServerError

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

delete_all_reactions async #

delete_all_reactions(
    channel: SnowflakeishOr[TextableChannel],
    message: SnowflakeishOr[PartialMessage],
) -> None

Delete all reactions from a message.

PARAMETER DESCRIPTION
channel

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

TYPE: SnowflakeishOr[TextableChannel]

message

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

TYPE: SnowflakeishOr[PartialMessage]

RAISES DESCRIPTION
BadRequestError

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

ForbiddenError

If you are missing the hikari.permissions.Permissions.MANAGE_MESSAGES permission.

UnauthorizedError

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

NotFoundError

If the channel or message is not found.

RateLimitTooLongError

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

InternalServerError

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

delete_all_reactions_for_emoji async #

delete_all_reactions_for_emoji(
    channel: SnowflakeishOr[TextableChannel],
    message: SnowflakeishOr[PartialMessage],
    emoji: Union[str, Emoji],
    emoji_id: UndefinedOr[SnowflakeishOr[CustomEmoji]] = undefined.UNDEFINED,
) -> None

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

PARAMETER DESCRIPTION
channel

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

TYPE: SnowflakeishOr[TextableChannel]

message

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

TYPE: SnowflakeishOr[PartialMessage]

emoji

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

TYPE: Union[str, Emoji]

PARAMETER DESCRIPTION
emoji_id

ID of the custom emoji to remove all the reactions for. This should only be provided when a custom emoji's name is passed for emoji.

TYPE: UndefinedOr[SnowflakeishOr[CustomEmoji]]

RAISES DESCRIPTION
BadRequestError

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

ForbiddenError

If you are missing the hikari.permissions.Permissions.MANAGE_MESSAGES permission.

UnauthorizedError

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

NotFoundError

If the channel or message is not found.

RateLimitTooLongError

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

InternalServerError

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

delete_application_command async #

delete_application_command(
    application: SnowflakeishOr[PartialApplication],
    command: SnowflakeishOr[PartialCommand],
    guild: UndefinedOr[SnowflakeishOr[PartialGuild]] = undefined.UNDEFINED,
) -> None

Delete a registered application command.

PARAMETER DESCRIPTION
application

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

TYPE: SnowflakeishOr[PartialApplication]

command

Object or ID of the command to delete.

TYPE: SnowflakeishOr[PartialCommand]

PARAMETER DESCRIPTION
guild

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.

TYPE: UndefinedOr[SnowflakeishOr[PartialGuild]]

RAISES DESCRIPTION
ForbiddenError

If you cannot access the provided application's commands.

NotFoundError

If the provided application or command isn't found.

UnauthorizedError

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

RateLimitTooLongError

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

InternalServerError

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

delete_channel async #

delete_channel(channel: SnowflakeishOr[PartialChannel]) -> PartialChannel

Delete a channel in a guild, or close a DM.

Note

For Public servers, the set 'Rules' or 'Guidelines' channels and the 'Public Server Updates' channel cannot be deleted.

PARAMETER DESCRIPTION
channel

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

TYPE: SnowflakeishOr[PartialChannel]

RETURNS DESCRIPTION
PartialChannel

Object of the channel that was deleted.

RAISES DESCRIPTION
UnauthorizedError

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

ForbiddenError

If you are missing the hikari.permissions.Permissions.MANAGE_CHANNELS permission in the channel.

NotFoundError

If the channel is not found.

RateLimitTooLongError

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

InternalServerError

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

delete_emoji async #

delete_emoji(
    guild: SnowflakeishOr[PartialGuild],
    emoji: SnowflakeishOr[CustomEmoji],
    *,
    reason: UndefinedOr[str] = undefined.UNDEFINED
) -> None

Delete an emoji in a guild.

PARAMETER DESCRIPTION
guild

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

TYPE: SnowflakeishOr[PartialGuild]

emoji

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

TYPE: SnowflakeishOr[CustomEmoji]

PARAMETER DESCRIPTION
reason

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

TYPE: UndefinedOr[str]

RAISES DESCRIPTION
ForbiddenError
NotFoundError

If the guild or the emoji are not found.

UnauthorizedError

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

RateLimitTooLongError

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

InternalServerError

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

delete_guild async #

delete_guild(guild: SnowflakeishOr[PartialGuild]) -> None

Delete a guild.

PARAMETER DESCRIPTION
guild

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

TYPE: SnowflakeishOr[PartialGuild]

RAISES DESCRIPTION
ForbiddenError

If you are not the owner of the guild.

UnauthorizedError

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

NotFoundError

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

RateLimitTooLongError

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

InternalServerError

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

delete_interaction_response async #

delete_interaction_response(
    application: SnowflakeishOr[PartialApplication], token: str
) -> None

Delete the initial response of an interaction.

PARAMETER DESCRIPTION
application

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

TYPE: SnowflakeishOr[PartialApplication]

token

The interaction's token.

TYPE: str

RAISES DESCRIPTION
UnauthorizedError

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

NotFoundError

If the interaction or response is not found.

RateLimitTooLongError

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

InternalServerError

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

delete_invite async #

delete_invite(invite: Union[InviteCode, str]) -> Invite

Delete an existing invite.

PARAMETER DESCRIPTION
invite

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

TYPE: Union[InviteCode, str]

RETURNS DESCRIPTION
Invite

Object of the invite that was deleted.

RAISES DESCRIPTION
ForbiddenError

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

UnauthorizedError

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

NotFoundError

If the invite is not found.

RateLimitTooLongError

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

InternalServerError

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

delete_message async #

delete_message(
    channel: SnowflakeishOr[TextableChannel],
    message: SnowflakeishOr[PartialMessage],
) -> None

Delete a given message in a given channel.

PARAMETER DESCRIPTION
channel

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

TYPE: SnowflakeishOr[TextableChannel]

message

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

TYPE: SnowflakeishOr[PartialMessage]

RAISES DESCRIPTION
UnauthorizedError

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

ForbiddenError

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

NotFoundError

If the channel or message is not found.

RateLimitTooLongError

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

InternalServerError

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

delete_messages async #

Bulk-delete messages from the channel.

Note

This API endpoint will only be able to delete 100 messages at a time. For anything more than this, multiple requests will be executed one-after-the-other, since the rate limits for this endpoint do not favour more than one request per bucket.

If one message is left over from chunking per 100 messages, or only one message is passed to this coroutine function, then the logic is expected to defer to delete_message. The implication of this is that the delete_message endpoint is rate limited by a different bucket with different usage rates.

Warning

This endpoint is not atomic. If an error occurs midway through a bulk delete, you will not be able to revert any changes made up to this point.

Warning

Specifying any messages more than 14 days old will cause the call to fail, potentially with partial completion.

PARAMETER DESCRIPTION
channel

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

TYPE: SnowflakeishOr[TextableChannel]

messages

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

TYPE: Union[SnowflakeishOr[PartialMessage], Iterable[SnowflakeishOr[PartialMessage]], AsyncIterable[SnowflakeishOr[PartialMessage]]]

PARAMETER DESCRIPTION
*other_messages

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

TYPE: SnowflakeishOr[PartialMessage]

RAISES DESCRIPTION
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.

delete_my_reaction async #

delete_my_reaction(
    channel: SnowflakeishOr[TextableChannel],
    message: SnowflakeishOr[PartialMessage],
    emoji: Union[str, Emoji],
    emoji_id: UndefinedOr[SnowflakeishOr[CustomEmoji]] = undefined.UNDEFINED,
) -> None

Delete a reaction that your application user created.

PARAMETER DESCRIPTION
channel

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

TYPE: SnowflakeishOr[TextableChannel]

message

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

TYPE: SnowflakeishOr[PartialMessage]

emoji

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

TYPE: Union[str, Emoji]

PARAMETER DESCRIPTION
emoji_id

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

TYPE: UndefinedOr[SnowflakeishOr[CustomEmoji]]

RAISES DESCRIPTION
BadRequestError

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

UnauthorizedError

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

NotFoundError

If the channel or message is not found.

RateLimitTooLongError

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

InternalServerError

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

delete_permission_overwrite async #

delete_permission_overwrite(
    channel: SnowflakeishOr[GuildChannel],
    target: Union[PermissionOverwrite, PartialRole, PartialUser, Snowflakeish],
) -> None

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

PARAMETER DESCRIPTION
channel

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

TYPE: SnowflakeishOr[GuildChannel]

target

The channel overwrite to delete.

TYPE: Union[PartialUser, PartialRole, PermissionOverwrite, Snowflakeish]

RAISES DESCRIPTION
UnauthorizedError

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

ForbiddenError

If you are missing the MANAGE_PERMISSIONS permission in the channel.

NotFoundError

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

RateLimitTooLongError

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

InternalServerError

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

delete_reaction async #

delete_reaction(
    channel: SnowflakeishOr[TextableChannel],
    message: SnowflakeishOr[PartialMessage],
    user: SnowflakeishOr[PartialUser],
    emoji: Union[str, Emoji],
    emoji_id: UndefinedOr[SnowflakeishOr[CustomEmoji]] = undefined.UNDEFINED,
) -> None

Delete a reaction from a message.

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

PARAMETER DESCRIPTION
channel

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

TYPE: SnowflakeishOr[TextableChannel]

message

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

TYPE: SnowflakeishOr[PartialMessage]

user

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

TYPE: SnowflakeishOr[PartialUser]

emoji

Object or name of the emoji to react with.

TYPE: Union[str, Emoji]

PARAMETER DESCRIPTION
emoji_id

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

TYPE: UndefinedOr[SnowflakeishOr[CustomEmoji]]

RAISES DESCRIPTION
BadRequestError

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

ForbiddenError

If you are missing the hikari.permissions.Permissions.MANAGE_MESSAGES permission.

UnauthorizedError

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

NotFoundError

If the channel or message is not found.

RateLimitTooLongError

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

InternalServerError

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

delete_role async #

delete_role(
    guild: SnowflakeishOr[PartialGuild], role: SnowflakeishOr[PartialRole]
) -> None

Delete a role.

PARAMETER DESCRIPTION
guild

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

TYPE: SnowflakeishOr[PartialGuild]

role

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

TYPE: SnowflakeishOr[PartialRole]

RAISES DESCRIPTION
ForbiddenError

If you are missing the hikari.permissions.Permissions.MANAGE_ROLES permission.

UnauthorizedError

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

NotFoundError

If the guild or role are not found.

RateLimitTooLongError

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

InternalServerError

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

delete_scheduled_event async #

delete_scheduled_event(
    guild: SnowflakeishOr[PartialGuild], event: SnowflakeishOr[ScheduledEvent]
) -> None

Delete a scheduled event.

PARAMETER DESCRIPTION
guild

The guild to delete the event from.

TYPE: SnowflakeishOr[PartialGuild]

event

The scheduled event to delete.

TYPE: SnowflakeishOr[ScheduledEvent]

RAISES DESCRIPTION
UnauthorizedError

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

ForbiddenError

If you are missing the hikari.permissions.Permissions.MANAGE_EVENTS permission.

NotFoundError

If the guild or event is not found.

RateLimitTooLongError

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

InternalServerError

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

delete_sticker async #

delete_sticker(
    guild: SnowflakeishOr[PartialGuild],
    sticker: SnowflakeishOr[PartialSticker],
    *,
    reason: UndefinedOr[str] = undefined.UNDEFINED
) -> None

Delete a sticker in a guild.

PARAMETER DESCRIPTION
guild

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

TYPE: SnowflakeishOr[PartialGuild]

sticker

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

TYPE: SnowflakeishOr[PartialSticker]

PARAMETER DESCRIPTION
reason

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

TYPE: UndefinedOr[str]

RAISES DESCRIPTION
ForbiddenError
NotFoundError

If the guild or the sticker are not found.

UnauthorizedError

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

RateLimitTooLongError

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

InternalServerError

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

delete_template async #

delete_template(
    guild: SnowflakeishOr[PartialGuild], template: Union[str, Template]
) -> Template

Delete a guild template.

PARAMETER DESCRIPTION
guild

The guild to delete a template in.

TYPE: SnowflakeishOr[PartialGuild]

template

Object or string code of the template to delete.

TYPE: Union[str, Template]

RETURNS DESCRIPTION
Template

The deleted template's object.

RAISES DESCRIPTION
ForbiddenError

If you are not part of the guild.

NotFoundError

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

UnauthorizedError

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

RateLimitTooLongError

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

InternalServerError

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

delete_webhook async #

delete_webhook(
    webhook: SnowflakeishOr[PartialWebhook],
    *,
    token: UndefinedOr[str] = undefined.UNDEFINED
) -> None

Delete a webhook.

PARAMETER DESCRIPTION
webhook

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

TYPE: SnowflakeishOr[PartialWebhook]

PARAMETER DESCRIPTION
token

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

TYPE: UndefinedOr[str]

RAISES DESCRIPTION
ForbiddenError

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

UnauthorizedError

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

NotFoundError

If the webhook is not found.

RateLimitTooLongError

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

InternalServerError

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

delete_webhook_message async #

delete_webhook_message(
    webhook: Union[ExecutableWebhook, Snowflakeish],
    token: str,
    message: SnowflakeishOr[Message],
    *,
    thread: Union[
        UndefinedType, SnowflakeishOr[GuildThreadChannel]
    ] = undefined.UNDEFINED
) -> None

Delete a given message in a given channel.

PARAMETER DESCRIPTION
webhook

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

TYPE: Union[Snowflakeish, ExecutableWebhook]

token

The webhook token.

TYPE: str

message

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

TYPE: SnowflakeishOr[PartialMessage]

PARAMETER DESCRIPTION
thread

If provided then the message will be deleted from the target thread within the webhook's channel, otherwise it will be deleted from the webhook's target channel.

This is required when trying to delete a thread message.

TYPE: UndefinedOr[SnowflakeishOr[GuildThreadChannel]]

RAISES DESCRIPTION
UnauthorizedError

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

NotFoundError

If the webhook or the message are not found.

RateLimitTooLongError

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

InternalServerError

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

edit_application_command async #

edit_application_command(
    application: SnowflakeishOr[PartialApplication],
    command: SnowflakeishOr[PartialCommand],
    guild: UndefinedOr[SnowflakeishOr[PartialGuild]] = undefined.UNDEFINED,
    *,
    name: UndefinedOr[str] = undefined.UNDEFINED,
    description: UndefinedOr[str] = undefined.UNDEFINED,
    options: UndefinedOr[Sequence[CommandOption]] = undefined.UNDEFINED,
    default_member_permissions: Union[
        UndefinedType, int, Permissions
    ] = undefined.UNDEFINED,
    dm_enabled: UndefinedOr[bool] = undefined.UNDEFINED,
    nsfw: UndefinedOr[bool] = undefined.UNDEFINED
) -> PartialCommand

Edit a registered application command.

PARAMETER DESCRIPTION
application

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

TYPE: SnowflakeishOr[PartialApplication]

command

Object or ID of the command to modify.

TYPE: SnowflakeishOr[PartialCommand]

PARAMETER DESCRIPTION
guild

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.

TYPE: UndefinedOr[SnowflakeishOr[PartialGuild]]

name

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

TYPE: UndefinedOr[str]

description

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

TYPE: UndefinedOr[str]

options

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

TYPE: UndefinedOr[Sequence[CommandOption]]

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

TYPE: Union[UndefinedType, int, Permissions]

dm_enabled

Whether this command is enabled in DMs with the bot.

This can only be applied to non-guild commands.

TYPE: UndefinedOr[bool]

RETURNS DESCRIPTION
PartialCommand

The edited command object.

RAISES DESCRIPTION
ForbiddenError

If you cannot access the provided application's commands.

NotFoundError

If the provided application or command isn't found.

BadRequestError

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

UnauthorizedError

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

RateLimitTooLongError

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

InternalServerError

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

edit_channel async #

edit_channel(
    channel: SnowflakeishOr[GuildChannel],
    /,
    *,
    name: UndefinedOr[str] = undefined.UNDEFINED,
    flags: UndefinedOr[ChannelFlag] = undefined.UNDEFINED,
    position: UndefinedOr[int] = undefined.UNDEFINED,
    topic: UndefinedOr[str] = undefined.UNDEFINED,
    nsfw: UndefinedOr[bool] = undefined.UNDEFINED,
    bitrate: UndefinedOr[int] = undefined.UNDEFINED,
    video_quality_mode: UndefinedOr[
        Union[VideoQualityMode, int]
    ] = undefined.UNDEFINED,
    user_limit: UndefinedOr[int] = undefined.UNDEFINED,
    rate_limit_per_user: UndefinedOr[Intervalish] = undefined.UNDEFINED,
    region: UndefinedNoneOr[Union[VoiceRegion, str]] = undefined.UNDEFINED,
    permission_overwrites: UndefinedOr[
        Sequence[PermissionOverwrite]
    ] = undefined.UNDEFINED,
    parent_category: UndefinedOr[
        SnowflakeishOr[GuildCategory]
    ] = undefined.UNDEFINED,
    default_auto_archive_duration: UndefinedOr[
        Intervalish
    ] = undefined.UNDEFINED,
    default_thread_rate_limit_per_user: UndefinedOr[
        Intervalish
    ] = undefined.UNDEFINED,
    default_forum_layout: UndefinedOr[
        Union[ForumLayoutType, int]
    ] = undefined.UNDEFINED,
    default_sort_order: UndefinedOr[
        Union[ForumSortOrderType, int]
    ] = undefined.UNDEFINED,
    available_tags: UndefinedOr[Sequence[ForumTag]] = undefined.UNDEFINED,
    default_reaction_emoji: Union[
        str, Emoji, UndefinedType, Snowflake, None
    ] = undefined.UNDEFINED,
    archived: UndefinedOr[bool] = undefined.UNDEFINED,
    locked: UndefinedOr[bool] = undefined.UNDEFINED,
    invitable: UndefinedOr[bool] = undefined.UNDEFINED,
    auto_archive_duration: UndefinedOr[Intervalish] = undefined.UNDEFINED,
    applied_tags: UndefinedOr[
        SnowflakeishSequence[ForumTag]
    ] = undefined.UNDEFINED,
    reason: UndefinedOr[str] = undefined.UNDEFINED,
) -> PartialChannel

Edit a channel.

PARAMETER DESCRIPTION
channel

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

TYPE: SnowflakeishOr[GuildChannel]

PARAMETER DESCRIPTION
name

If provided, the new name for the channel.

TYPE: UndefinedOr[str]

flags

If provided, the new channel flags to use for the channel. This can only be used on a forum channel to apply hikari.channels.ChannelFlag.REQUIRE_TAG, or on a forum thread to apply hikari.channels.ChannelFlag.PINNED.

TYPE: UndefinedOr[ChannelFlag]

position

If provided, the new position for the channel.

TYPE: UndefinedOr[int]

topic

If provided, the new topic for the channel.

TYPE: UndefinedOr[str]

nsfw

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

TYPE: UndefinedOr[bool]

bitrate

If provided, the new bitrate for the channel.

TYPE: UndefinedOr[int]

video_quality_mode

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

TYPE: UndefinedOr[Union[VideoQualityMode, int]]

user_limit

If provided, the new user limit in the channel.

TYPE: UndefinedOr[int]

rate_limit_per_user

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

TYPE: UndefinedOr[Intervalish]

region

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.

TYPE: UndefinedNoneOr[Union[str, VoiceRegion]]

permission_overwrites

If provided, the new permission overwrites for the channel.

TYPE: UndefinedOr[Sequence[PermissionOverwrite]]

parent_category

If provided, the new guild category for the channel.

TYPE: UndefinedOr[SnowflakeishOr[GuildCategory]]

default_auto_archive_duration

If provided, the auto archive duration Discord's end user client should default to when creating threads in this channel.

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

TYPE: UndefinedOr[Intervalish]

default_thread_rate_limit_per_user

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

This only applies to forum channels.

TYPE: UndefinedOr[Intervalish]

default_forum_layout

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

TYPE: UndefinedOr[Union[ForumLayoutType, int]]

default_sort_order

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

TYPE: UndefinedOr[Union[ForumSortOrderType, int]]

available_tags

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

This only applies to forum channels.

TYPE: UndefinedOr[Sequence[ForumTag]]

default_reaction_emoji

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

This only applies to forum channels.

TYPE: Union[str, Emoji, UndefinedType, Snowflake]

archived

If provided, the new archived state for the thread. This only applies to threads.

TYPE: UndefinedOr[bool]

locked

If provided, the new locked state for the thread. This only applies to threads.

If it's locked then only people with hikari.permissions.Permissions.MANAGE_THREADS can unarchive it.

TYPE: UndefinedOr[bool]

invitable

If provided, the new setting for whether non-moderators can invite new members to a private thread. This only applies to threads.

TYPE: UndefinedOr[bool]

auto_archive_duration

If provided, the new auto archive duration for this thread. This only applies to threads.

This should be either 60, 1440, 4320 or 10080 minutes, as of writing.

TYPE: UndefinedOr[Intervalish]

applied_tags

If provided, the new tags to apply to the thread. This only applies to threads in a forum channel.

TYPE: UndefinedOr[SnowflakeishSequence[ForumTag]]

reason

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

TYPE: UndefinedOr[str]

RETURNS DESCRIPTION
PartialChannel

The edited channel.

RAISES DESCRIPTION
BadRequestError

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

UnauthorizedError

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

ForbiddenError

If you are missing permissions to edit the channel.

NotFoundError

If the channel is not found.

RateLimitTooLongError

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

InternalServerError

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

edit_emoji async #

edit_emoji(
    guild: SnowflakeishOr[PartialGuild],
    emoji: SnowflakeishOr[CustomEmoji],
    *,
    name: UndefinedOr[str] = undefined.UNDEFINED,
    roles: UndefinedOr[SnowflakeishSequence[PartialRole]] = undefined.UNDEFINED,
    reason: UndefinedOr[str] = undefined.UNDEFINED
) -> KnownCustomEmoji

Edit an emoji in a guild.

PARAMETER DESCRIPTION
guild

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

TYPE: SnowflakeishOr[PartialGuild]

emoji

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

TYPE: SnowflakeishOr[CustomEmoji]

PARAMETER DESCRIPTION
name

If provided, the new name for the emoji.

TYPE: UndefinedOr[str]

roles

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.

TYPE: UndefinedOr[SnowflakeishSequence[PartialRole]]

reason

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

TYPE: UndefinedOr[str]

RETURNS DESCRIPTION
KnownCustomEmoji

The edited emoji.

RAISES DESCRIPTION
BadRequestError

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

ForbiddenError
NotFoundError

If the guild or the emoji are not found.

UnauthorizedError

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

RateLimitTooLongError

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

InternalServerError

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

edit_guild async #

edit_guild(
    guild: SnowflakeishOr[PartialGuild],
    *,
    name: UndefinedOr[str] = undefined.UNDEFINED,
    verification_level: UndefinedOr[
        GuildVerificationLevel
    ] = undefined.UNDEFINED,
    default_message_notifications: UndefinedOr[
        GuildMessageNotificationsLevel
    ] = undefined.UNDEFINED,
    explicit_content_filter_level: UndefinedOr[
        GuildExplicitContentFilterLevel
    ] = undefined.UNDEFINED,
    afk_channel: UndefinedOr[
        SnowflakeishOr[GuildVoiceChannel]
    ] = undefined.UNDEFINED,
    afk_timeout: UndefinedOr[Intervalish] = undefined.UNDEFINED,
    icon: UndefinedNoneOr[Resourceish] = undefined.UNDEFINED,
    owner: UndefinedOr[SnowflakeishOr[PartialUser]] = undefined.UNDEFINED,
    splash: UndefinedNoneOr[Resourceish] = undefined.UNDEFINED,
    banner: UndefinedNoneOr[Resourceish] = undefined.UNDEFINED,
    system_channel: UndefinedNoneOr[
        SnowflakeishOr[GuildTextChannel]
    ] = undefined.UNDEFINED,
    rules_channel: UndefinedNoneOr[
        SnowflakeishOr[GuildTextChannel]
    ] = undefined.UNDEFINED,
    public_updates_channel: UndefinedNoneOr[
        SnowflakeishOr[GuildTextChannel]
    ] = undefined.UNDEFINED,
    preferred_locale: UndefinedOr[Union[str, Locale]] = undefined.UNDEFINED,
    features: UndefinedOr[
        Sequence[Union[str, GuildFeature]]
    ] = undefined.UNDEFINED,
    reason: UndefinedOr[str] = undefined.UNDEFINED
) -> RESTGuild

Edit a guild.

PARAMETER DESCRIPTION
guild

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

TYPE: SnowflakeishOr[PartialGuild]

PARAMETER DESCRIPTION
name

If provided, the new name for the guild.

TYPE: UndefinedOr[str]

verification_level

If provided, the new verification level.

TYPE: UndefinedOr[GuildVerificationLevel]

default_message_notifications

If provided, the new default message notifications level.

TYPE: UndefinedOr[GuildMessageNotificationsLevel]

explicit_content_filter_level

If provided, the new explicit content filter level.

TYPE: UndefinedOr[GuildExplicitContentFilterLevel]

afk_channel

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

TYPE: UndefinedOr[SnowflakeishOr[GuildVoiceChannel]]

afk_timeout

If provided, the new afk timeout.

TYPE: UndefinedOr[Intervalish]

icon

If provided, the new guild icon. Must be a 1024x1024 image or can be an animated gif when the guild has the hikari.guilds.GuildFeature.ANIMATED_ICON feature.

TYPE: UndefinedOr[Resourceish]

owner

If provided, the new guild owner.

Warning

You need to be the owner of the server to use this.

TYPE: hikari.undefined.UndefinedOr[hikari.snowflakes.SnowflakeishOr[hikari.users.PartialUser]]]

splash

If provided, the new guild splash. Must be a 16:9 image and the guild must have the hikari.guilds.GuildFeature.INVITE_SPLASH feature.

TYPE: UndefinedNoneOr[Resourceish]

banner

If provided, the new guild banner. Must be a 16:9 image and the guild must have the hikari.guilds.GuildFeature.BANNER feature.

TYPE: UndefinedNoneOr[Resourceish]

system_channel

If provided, the new system channel.

TYPE: UndefinedNoneOr[SnowflakeishOr[GuildTextChannel]]

rules_channel

If provided, the new rules channel.

TYPE: UndefinedNoneOr[SnowflakeishOr[GuildTextChannel]]

public_updates_channel

If provided, the new public updates channel.

TYPE: UndefinedNoneOr[SnowflakeishOr[GuildTextChannel]]

preferred_locale

If provided, the new preferred locale.

TYPE: UndefinedNoneOr[str]

features

If provided, the guild features to be enabled. Features not provided will be disabled.

.. warning:: At the time of writing, Discord ignores non-mutable features <https://discord.com/developers/docs/resources/guild#guild-object-mutable-guild-features>_. This behaviour can change in the future. You should refer to the aforementioned link for the most up-to-date information, and only supply mutable features.

TYPE: UndefinedOr[Sequence[GuildFeature]]

reason

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

TYPE: UndefinedOr[str]

RETURNS DESCRIPTION
RESTGuild

The edited guild.

RAISES DESCRIPTION
BadRequestError

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

ForbiddenError

If you are missing the hikari.permissions.Permissions.MANAGE_GUILD permission or if you tried to pass ownership without being the server owner.

UnauthorizedError

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

NotFoundError

If the guild is not found.

RateLimitTooLongError

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

InternalServerError

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

edit_interaction_response async #

edit_interaction_response(
    application: SnowflakeishOr[PartialApplication],
    token: str,
    content: UndefinedNoneOr[Any] = undefined.UNDEFINED,
    *,
    attachment: UndefinedNoneOr[
        Union[Resourceish, Attachment]
    ] = undefined.UNDEFINED,
    attachments: UndefinedNoneOr[
        Sequence[Union[Resourceish, Attachment]]
    ] = undefined.UNDEFINED,
    component: UndefinedNoneOr[ComponentBuilder] = undefined.UNDEFINED,
    components: UndefinedNoneOr[
        Sequence[ComponentBuilder]
    ] = undefined.UNDEFINED,
    embed: UndefinedNoneOr[Embed] = undefined.UNDEFINED,
    embeds: UndefinedNoneOr[Sequence[Embed]] = undefined.UNDEFINED,
    mentions_everyone: UndefinedOr[bool] = undefined.UNDEFINED,
    user_mentions: UndefinedOr[
        Union[SnowflakeishSequence[PartialUser], bool]
    ] = undefined.UNDEFINED,
    role_mentions: UndefinedOr[
        Union[SnowflakeishSequence[PartialRole], bool]
    ] = undefined.UNDEFINED
) -> Message

Edit the initial response to a command interaction.

Note

Mentioning everyone, roles, or users in message edits currently will not send a push notification showing a new mention to people on Discord. It will still highlight in their chat as if they were mentioned, however.

Also important to note that if you specify a text content, mentions_everyone, mentions_reply, user_mentions, and role_mentions will default to False as the message will be re-parsed for mentions. This will also occur if only one of the four are specified

This is a limitation of Discord's design. If in doubt, specify all four of them each time.

PARAMETER DESCRIPTION
application

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

TYPE: SnowflakeishOr[PartialApplication]

token

The interaction's token.

TYPE: str

PARAMETER DESCRIPTION
content

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.

TYPE: UndefinedOr[Any]

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.

TYPE: UndefinedNoneOr[Union[Resourceish, Attachment]]

attachments

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.

TYPE: UndefinedNoneOr[Sequence[Union[Resourceish, Attachment]]]

component

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.

TYPE: UndefinedNoneOr[ComponentBuilder]

components

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.

TYPE: UndefinedNoneOr[Sequence[ComponentBuilder]]

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.

TYPE: UndefinedNoneOr[Embed]

embeds

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.

TYPE: UndefinedNoneOr[Sequence[Embed]]

mentions_everyone

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

TYPE: UndefinedOr[bool]

user_mentions

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.

TYPE: UndefinedOr[Union[SnowflakeishSequence[PartialUser], bool]]

role_mentions

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.

TYPE: UndefinedOr[Union[SnowflakeishSequence[PartialRole], bool]]

RETURNS DESCRIPTION
Message

The edited message.

RAISES DESCRIPTION
ValueError

If both attachment and attachments, component and components or embed and embeds are specified.

BadRequestError

This may be raised in several discrete situations, such as messages being empty with no attachments or embeds; messages with more than 2000 characters in them, embeds that exceed one of the many embed limits; too many attachments; attachments that are too large; invalid image URLs in embeds; too many components.

UnauthorizedError

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

NotFoundError

If the interaction or the message are not found.

RateLimitTooLongError

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

InternalServerError

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

edit_member async #

edit_member(
    guild: SnowflakeishOr[PartialGuild],
    user: SnowflakeishOr[PartialUser],
    *,
    nickname: UndefinedNoneOr[str] = undefined.UNDEFINED,
    nick: UndefinedNoneOr[str] = undefined.UNDEFINED,
    roles: UndefinedOr[SnowflakeishSequence[PartialRole]] = undefined.UNDEFINED,
    mute: UndefinedOr[bool] = undefined.UNDEFINED,
    deaf: UndefinedOr[bool] = undefined.UNDEFINED,
    voice_channel: UndefinedNoneOr[
        SnowflakeishOr[GuildVoiceChannel]
    ] = undefined.UNDEFINED,
    communication_disabled_until: UndefinedNoneOr[
        datetime
    ] = undefined.UNDEFINED,
    reason: UndefinedOr[str] = undefined.UNDEFINED
) -> Member

Edit a guild member.

PARAMETER DESCRIPTION
guild

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

TYPE: SnowflakeishOr[PartialGuild]

user

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

TYPE: SnowflakeishOr[PartialUser]

PARAMETER DESCRIPTION
nickname

If provided, the new nick for the member. If None, will remove the members nick.

Requires the hikari.permissions.Permissions.MANAGE_NICKNAMES permission.

TYPE: UndefinedNoneOr[str]

roles

If provided, the new roles for the member.

Requires the hikari.permissions.Permissions.MANAGE_ROLES permission.

TYPE: UndefinedOr[SnowflakeishSequence[PartialRole]]

mute

If provided, the new server mute state for the member.

Requires the hikari.permissions.Permissions.MUTE_MEMBERS permission.

TYPE: UndefinedOr[bool]

deaf

If provided, the new server deaf state for the member.

Requires the hikari.permissions.Permissions.DEAFEN_MEMBERS permission.

TYPE: UndefinedOr[bool]

voice_channel

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 hikari.permissions.Permissions.MOVE_MEMBERS permission and the hikari.permissions.Permissions.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.

TYPE: hikari.undefined.UndefinedOr[hikari.snowflakes.SnowflakeishOr[hikari.channels.GuildVoiceChannel]]]

communication_disabled_until

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 hikari.permissions.Permissions.MODERATE_MEMBERS permission.

TYPE: UndefinedNoneOr[datetime]

reason

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

TYPE: UndefinedOr[str]

RETURNS DESCRIPTION
Member

Object of the member that was updated.

RAISES DESCRIPTION
BadRequestError

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

ForbiddenError

If you are missing a permission to do an action.

UnauthorizedError

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

NotFoundError

If the guild or the user are not found.

RateLimitTooLongError

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

InternalServerError

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

edit_message async #

edit_message(
    channel: SnowflakeishOr[TextableChannel],
    message: SnowflakeishOr[PartialMessage],
    content: UndefinedOr[Any] = undefined.UNDEFINED,
    *,
    attachment: UndefinedNoneOr[
        Union[Resourceish, Attachment]
    ] = undefined.UNDEFINED,
    attachments: UndefinedNoneOr[
        Sequence[Union[Resourceish, Attachment]]
    ] = undefined.UNDEFINED,
    component: UndefinedNoneOr[ComponentBuilder] = undefined.UNDEFINED,
    components: UndefinedNoneOr[
        Sequence[ComponentBuilder]
    ] = undefined.UNDEFINED,
    embed: UndefinedNoneOr[Embed] = undefined.UNDEFINED,
    embeds: UndefinedNoneOr[Sequence[Embed]] = undefined.UNDEFINED,
    mentions_everyone: UndefinedOr[bool] = undefined.UNDEFINED,
    mentions_reply: UndefinedOr[bool] = undefined.UNDEFINED,
    user_mentions: UndefinedOr[
        Union[SnowflakeishSequence[PartialUser], bool]
    ] = undefined.UNDEFINED,
    role_mentions: UndefinedOr[
        Union[SnowflakeishSequence[PartialRole], bool]
    ] = undefined.UNDEFINED,
    flags: Union[UndefinedType, int, MessageFlag] = undefined.UNDEFINED
) -> Message

Edit an existing message in a given channel.

Warning

If the message was not sent by your user, the only parameter you may provide to this call is the flags parameter. Anything else will result in a hikari.errors.ForbiddenError being raised.

Note

Mentioning everyone, roles, or users in message edits currently will not send a push notification showing a new mention to people on Discord. It will still highlight in their chat as if they were mentioned, however.

Also important to note that if you specify a text content, mentions_everyone, mentions_reply, user_mentions, and role_mentions will default to False as the message will be re-parsed for mentions. This will also occur if only one of the four are specified

This is a limitation of Discord's design. If in doubt, specify all four of them each time.

PARAMETER DESCRIPTION
channel

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

TYPE: SnowflakeishOr[TextableChannel]

message

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

TYPE: SnowflakeishOr[PartialMessage]

content

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.

TYPE: UndefinedOr[Any] DEFAULT: UNDEFINED

PARAMETER DESCRIPTION
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.

TYPE: UndefinedNoneOr[Union[Resourceish, Attachment]]

attachments

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.

TYPE: UndefinedNoneOr[Sequence[Union[Resourceish, Attachment]]]

component

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.

TYPE: UndefinedNoneOr[ComponentBuilder]

components

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.

TYPE: UndefinedNoneOr[Sequence[ComponentBuilder]]

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.

TYPE: UndefinedNoneOr[Embed]

embeds

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.

TYPE: UndefinedNoneOr[Sequence[Embed]]

mentions_everyone

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.

TYPE: UndefinedOr[bool]

mentions_reply

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.

TYPE: UndefinedOr[bool]

user_mentions

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.

TYPE: UndefinedOr[Union[SnowflakeishSequence[PartialUser], bool]]

role_mentions

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.

TYPE: UndefinedOr[Union[SnowflakeishSequence[PartialRole], bool]]

flags

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 hikari.messages.MessageFlag.NONE and hikari.messages.MessageFlag.SUPPRESS_EMBEDS. If you have hikari.permissions.Permissions.MANAGE_MESSAGES permissions, you can use this call to suppress embeds on another user's message.

TYPE: UndefinedOr[MessageFlag]

RETURNS DESCRIPTION
Message

The edited message.

RAISES DESCRIPTION
ValueError

If both attachment and attachments, component and components or embed and embeds are specified.

BadRequestError

This may be raised in several discrete situations, such as messages being empty with no embeds; messages with more than 2000 characters in them, embeds that exceed one of the many embed limits; invalid image URLs in embeds.

UnauthorizedError

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

ForbiddenError

If you are missing the hikari.permissions.Permissions.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 hikari.permissions.Permissions.MANAGE_MESSAGES permission.

NotFoundError

If the channel or message is not found.

RateLimitTooLongError

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

InternalServerError

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

edit_my_member async #

edit_my_member(
    guild: SnowflakeishOr[PartialGuild],
    *,
    nickname: UndefinedNoneOr[str] = undefined.UNDEFINED,
    reason: UndefinedOr[str] = undefined.UNDEFINED
) -> Member

Edit the current user's member in a guild.

PARAMETER DESCRIPTION
guild

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

TYPE: SnowflakeishOr[PartialGuild]

PARAMETER DESCRIPTION
nickname

If provided, the new nickname for the member. If None, will remove the members nickname.

Requires the hikari.permissions.Permissions.CHANGE_NICKNAME permission. If provided, the reason that will be recorded in the audit logs. Maximum of 512 characters.

TYPE: UndefinedNoneOr[str]

reason

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

TYPE: UndefinedOr[str]

RETURNS DESCRIPTION
Member

Object of the member that was updated.

RAISES DESCRIPTION
BadRequestError

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

ForbiddenError

If you are missing a permission to do an action.

UnauthorizedError

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

NotFoundError

If the guild is not found.

RateLimitTooLongError

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

InternalServerError

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

edit_my_user async #

edit_my_user(
    *,
    username: UndefinedOr[str] = undefined.UNDEFINED,
    avatar: UndefinedNoneOr[Resourceish] = undefined.UNDEFINED,
    banner: UndefinedNoneOr[Resourceish] = undefined.UNDEFINED
) -> OwnUser

Edit the token's associated user.

PARAMETER DESCRIPTION
username

If provided, the new username.

TYPE: UndefinedOr[str]

avatar

If provided, the new avatar. If None, the avatar will be removed.

TYPE: UndefinedNoneOr[Resourceish]

banner

If provided, the new banner. If None, the banner will be removed.

TYPE: UndefinedNoneOr[Resourceish]

RETURNS DESCRIPTION
OwnUser

The edited token's associated user.

RAISES DESCRIPTION
BadRequestError

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

Discord also returns this on a rate limit: https://github.com/discord/discord-api-docs/issues/1462

UnauthorizedError

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

InternalServerError

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

edit_my_voice_state async #

edit_my_voice_state(
    guild: SnowflakeishOr[PartialGuild],
    channel: SnowflakeishOr[GuildStageChannel],
    *,
    suppress: UndefinedOr[bool] = undefined.UNDEFINED,
    request_to_speak: Union[UndefinedType, bool, datetime] = undefined.UNDEFINED
) -> None

Edit the current user's voice state in a stage channel.

Note

The current user has to have already joined the target stage channel before any calls can be made to this endpoint.

PARAMETER DESCRIPTION
guild

Object or Id of the guild to edit a voice state in.

TYPE: SnowflakeishOr[PartialGuild]

channel

Object or Id of the channel to edit a voice state in.

TYPE: SnowflakeishOr[GuildStageChannel]

PARAMETER DESCRIPTION
suppress

If specified, whether the user should be allowed to become a speaker in the target stage channel with True suppressing them from becoming one.

TYPE: UndefinedOr[bool]

request_to_speak

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.

TYPE: Union[UndefinedType, bool, datetime]

RAISES DESCRIPTION
BadRequestError

If you try to target a non-staging channel.

UnauthorizedError

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

ForbiddenError

If you are missing the hikari.permissions.Permissions.MUTE_MEMBERS permission in the channel.

NotFoundError

If the channel, message or voice state is not found.

RateLimitTooLongError

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

InternalServerError

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

edit_permission_overwrite async #

edit_permission_overwrite(
    channel: SnowflakeishOr[GuildChannel],
    target: Union[Snowflakeish, PartialUser, PartialRole, PermissionOverwrite],
    *,
    target_type: UndefinedOr[
        Union[PermissionOverwriteType, int]
    ] = undefined.UNDEFINED,
    allow: UndefinedOr[Permissions] = undefined.UNDEFINED,
    deny: UndefinedOr[Permissions] = undefined.UNDEFINED,
    reason: UndefinedOr[str] = undefined.UNDEFINED
) -> None

Edit permissions for a specific entity in the given guild channel.

PARAMETER DESCRIPTION
channel

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

TYPE: SnowflakeishOr[GuildChannel]

target

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

TYPE: Union[PartialUser, PartialRole, PermissionOverwrite, Snowflakeish]

PARAMETER DESCRIPTION
target_type

If provided, the type of the target to update. If unset, will attempt to get the type from target.

TYPE: UndefinedOr[Union[PermissionOverwriteType, int]]

allow

If provided, the new value of all allowed permissions.

TYPE: UndefinedOr[Permissions]

deny

If provided, the new value of all disallowed permissions.

TYPE: UndefinedOr[Permissions]

reason

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

TYPE: UndefinedOr[str]

RAISES DESCRIPTION
TypeError

If target_type is unset and we were unable to determine the type from target.

BadRequestError

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

UnauthorizedError

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

ForbiddenError

If you are missing the MANAGE_PERMISSIONS permission in the channel.

NotFoundError

If the channel is not found or the target is not found if it is a role.

RateLimitTooLongError

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

InternalServerError

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

edit_role async #

edit_role(
    guild: SnowflakeishOr[PartialGuild],
    role: SnowflakeishOr[PartialRole],
    *,
    name: UndefinedOr[str] = undefined.UNDEFINED,
    permissions: UndefinedOr[Permissions] = undefined.UNDEFINED,
    color: UndefinedOr[Colorish] = undefined.UNDEFINED,
    colour: UndefinedOr[Colorish] = undefined.UNDEFINED,
    hoist: UndefinedOr[bool] = undefined.UNDEFINED,
    icon: UndefinedNoneOr[Resourceish] = undefined.UNDEFINED,
    unicode_emoji: UndefinedNoneOr[str] = undefined.UNDEFINED,
    mentionable: UndefinedOr[bool] = undefined.UNDEFINED,
    reason: UndefinedOr[str] = undefined.UNDEFINED
) -> Role

Edit a role.

PARAMETER DESCRIPTION
guild

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

TYPE: SnowflakeishOr[PartialGuild]

role

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

TYPE: SnowflakeishOr[PartialRole]

PARAMETER DESCRIPTION
name

If provided, the new name for the role.

TYPE: UndefinedOr[str]

permissions

If provided, the new permissions for the role.

TYPE: UndefinedOr[Permissions]

color

If provided, the new color for the role.

TYPE: UndefinedOr[Colorish]

colour

An alias for color.

TYPE: UndefinedOr[Colorish]

hoist

If provided, whether to hoist the role.

TYPE: UndefinedOr[bool]

icon

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

TYPE: UndefinedNoneOr[Resourceish]

unicode_emoji

If provided, the new unicode emoji to set as the role icon.

TYPE: UndefinedNoneOr[str]

mentionable

If provided, whether to make the role mentionable.

TYPE: UndefinedOr[bool]

reason

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

TYPE: UndefinedOr[str]

RETURNS DESCRIPTION
Role

The edited role.

RAISES DESCRIPTION
TypeError

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

BadRequestError

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

ForbiddenError

If you are missing the hikari.permissions.Permissions.MANAGE_ROLES permission.

UnauthorizedError

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

NotFoundError

If the guild or role are not found.

RateLimitTooLongError

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

InternalServerError

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

edit_scheduled_event async #

edit_scheduled_event(
    guild: SnowflakeishOr[PartialGuild],
    event: SnowflakeishOr[ScheduledEvent],
    /,
    *,
    channel: UndefinedNoneOr[
        SnowflakeishOr[PartialChannel]
    ] = undefined.UNDEFINED,
    description: UndefinedNoneOr[str] = undefined.UNDEFINED,
    entity_type: UndefinedOr[
        Union[int, ScheduledEventType]
    ] = undefined.UNDEFINED,
    image: UndefinedOr[Resourceish] = undefined.UNDEFINED,
    location: UndefinedOr[str] = undefined.UNDEFINED,
    name: UndefinedOr[str] = undefined.UNDEFINED,
    privacy_level: UndefinedOr[
        Union[int, EventPrivacyLevel]
    ] = undefined.UNDEFINED,
    start_time: UndefinedOr[datetime] = undefined.UNDEFINED,
    end_time: UndefinedNoneOr[datetime] = undefined.UNDEFINED,
    status: UndefinedOr[Union[int, ScheduledEventStatus]] = undefined.UNDEFINED,
    reason: UndefinedOr[str] = undefined.UNDEFINED,
) -> ScheduledEvent

Edit a scheduled event.

PARAMETER DESCRIPTION
guild

The guild to edit the event in.

TYPE: SnowflakeishOr[PartialGuild]

event

The scheduled event to edit.

TYPE: SnowflakeishOr[ScheduledEvent]

PARAMETER DESCRIPTION
channel

The channel a VOICE or STAGE event should be associated with.

TYPE: UndefinedNoneOr[SnowflakeishOr[PartialChannel]]

description

The event's description.

TYPE: UndefinedNoneOr[str]

entity_type

The type of entity the event should target.

TYPE: UndefinedOr[ScheduledEventType]

image

The event's display image.

TYPE: UndefinedOr[Resourceish]

location

The location of an EXTERNAL event.

Must be passed when changing an event to EXTERNAL.

TYPE: UndefinedOr[str]

name

The event's name.

TYPE: UndefinedOr[str]

privacy_level

The event's privacy level.

This effects who can view and subscribe to the event.

TYPE: UndefinedOr[EventPrivacyLevel]

start_time

When the event should be scheduled to start.

TYPE: UndefinedOr[datetime]

end_time

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.

TYPE: UndefinedNoneOr[datetime]

status

The event's new status.

SCHEDULED events can be set to ACTIVE and CANCELED. ACTIVE events can only be set to COMPLETED.

TYPE: UndefinedOr[ScheduledEventStatus]

reason

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

TYPE: UndefinedOr[str]

RETURNS DESCRIPTION
ScheduledEvent

The edited scheduled event.

RAISES DESCRIPTION
BadRequestError

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

UnauthorizedError

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

ForbiddenError

If you are missing permissions to edit the scheduled event.

For VOICE and STAGE_INSTANCE events, you need the following permissions in the event's associated channel: hikari.permissions.Permissions.MANAGE_EVENTS, hikari.permissions.Permissions.VIEW_CHANNEL and hikari.permissions.Permissions.CONNECT.

For EXTERNAL events you just need the hikari.permissions.Permissions.MANAGE_EVENTS permission.

NotFoundError

If the guild or event is not found.

RateLimitTooLongError

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

InternalServerError

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

edit_sticker async #

edit_sticker(
    guild: SnowflakeishOr[PartialGuild],
    sticker: SnowflakeishOr[PartialSticker],
    *,
    name: UndefinedOr[str] = undefined.UNDEFINED,
    description: UndefinedOr[str] = undefined.UNDEFINED,
    tag: UndefinedOr[str] = undefined.UNDEFINED,
    reason: UndefinedOr[str] = undefined.UNDEFINED
) -> GuildSticker

Edit a sticker in a guild.

PARAMETER DESCRIPTION
guild

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

TYPE: SnowflakeishOr[PartialGuild]

sticker

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

TYPE: SnowflakeishOr[PartialSticker]

PARAMETER DESCRIPTION
name

If provided, the new name for the sticker.

TYPE: UndefinedOr[str]

description

If provided, the new description for the sticker.

TYPE: UndefinedOr[str]

tag

If provided, the new sticker tag.

TYPE: UndefinedOr[str]

reason

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

TYPE: UndefinedOr[str]

RETURNS DESCRIPTION
GuildSticker

The edited sticker.

RAISES DESCRIPTION
BadRequestError

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

ForbiddenError
NotFoundError

If the guild or the sticker are not found.

UnauthorizedError

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

RateLimitTooLongError

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

InternalServerError

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

edit_template async #

edit_template(
    guild: SnowflakeishOr[PartialGuild],
    template: Union[str, Template],
    *,
    name: UndefinedOr[str] = undefined.UNDEFINED,
    description: UndefinedNoneOr[str] = undefined.UNDEFINED
) -> Template

Modify a guild template.

PARAMETER DESCRIPTION
guild

The guild to edit a template in.

TYPE: SnowflakeishOr[PartialGuild]

template

Object or string code of the template to modify.

TYPE: Union[str, Template]

PARAMETER DESCRIPTION
name

The name to set for this template.

TYPE: UndefinedOr[str]

description

The description to set for the template.

TYPE: UndefinedNoneOr[str]

RETURNS DESCRIPTION
Template

The object of the edited template.

RAISES DESCRIPTION
ForbiddenError

If you are not part of the guild.

NotFoundError

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

UnauthorizedError

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

RateLimitTooLongError

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

InternalServerError

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

edit_voice_state async #

edit_voice_state(
    guild: SnowflakeishOr[PartialGuild],
    channel: SnowflakeishOr[GuildStageChannel],
    user: SnowflakeishOr[PartialUser],
    *,
    suppress: UndefinedOr[bool] = undefined.UNDEFINED
) -> None

Edit an existing voice state in a stage channel.

Note

The target user must already be present in the stage channel before any calls are made to this endpoint.

PARAMETER DESCRIPTION
guild

Object or ID of the guild to edit a voice state in.

TYPE: SnowflakeishOr[PartialGuild]

channel

Object or ID of the channel to edit a voice state in.

TYPE: SnowflakeishOr[GuildStageChannel]

user

Object or ID of the user to edit the voice state of.

TYPE: SnowflakeishOr[PartialUser]

PARAMETER DESCRIPTION
suppress

If defined, whether the user should be allowed to become a speaker in the target stage channel.

TYPE: UndefinedOr[bool]

RAISES DESCRIPTION
BadRequestError

If you try to target a non-staging channel.

UnauthorizedError

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

ForbiddenError

If you are missing the hikari.permissions.Permissions.MUTE_MEMBERS permission in the channel.

NotFoundError

If the channel, message or voice state is not found.

RateLimitTooLongError

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

InternalServerError

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

edit_webhook async #

edit_webhook(
    webhook: SnowflakeishOr[PartialWebhook],
    *,
    token: UndefinedOr[str] = undefined.UNDEFINED,
    name: UndefinedOr[str] = undefined.UNDEFINED,
    avatar: UndefinedNoneOr[Resourceish] = undefined.UNDEFINED,
    channel: UndefinedOr[SnowflakeishOr[WebhookChannelT]] = undefined.UNDEFINED,
    reason: UndefinedOr[str] = undefined.UNDEFINED
) -> PartialWebhook

Edit a webhook.

PARAMETER DESCRIPTION
webhook

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

TYPE: SnowflakeishOr[PartialWebhook]

PARAMETER DESCRIPTION
token

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

TYPE: UndefinedOr[str]

name

If provided, the new webhook name.

TYPE: UndefinedOr[str]

avatar

If provided, the new webhook avatar. If None, will remove the webhook avatar.

TYPE: UndefinedNoneOr[Resourceish]

channel

If provided, the text channel to move the webhook to.

TYPE: UndefinedOr[SnowflakeishOr[WebhookChannelT]]

reason

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

TYPE: UndefinedOr[str]

RETURNS DESCRIPTION
PartialWebhook

The edited webhook.

RAISES DESCRIPTION
ForbiddenError

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

UnauthorizedError

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

NotFoundError

If the webhook is not found.

RateLimitTooLongError

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

InternalServerError

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

edit_webhook_message async #

edit_webhook_message(
    webhook: Union[ExecutableWebhook, Snowflakeish],
    token: str,
    message: SnowflakeishOr[Message],
    content: UndefinedNoneOr[Any] = undefined.UNDEFINED,
    *,
    thread: Union[
        UndefinedType, SnowflakeishOr[GuildThreadChannel]
    ] = undefined.UNDEFINED,
    attachment: UndefinedNoneOr[
        Union[Resourceish, Attachment]
    ] = undefined.UNDEFINED,
    attachments: UndefinedNoneOr[
        Sequence[Union[Resourceish, Attachment]]
    ] = undefined.UNDEFINED,
    component: UndefinedNoneOr[ComponentBuilder] = undefined.UNDEFINED,
    components: UndefinedNoneOr[
        Sequence[ComponentBuilder]
    ] = undefined.UNDEFINED,
    embed: UndefinedNoneOr[Embed] = undefined.UNDEFINED,
    embeds: UndefinedNoneOr[Sequence[Embed]] = undefined.UNDEFINED,
    mentions_everyone: UndefinedOr[bool] = undefined.UNDEFINED,
    user_mentions: UndefinedOr[
        Union[SnowflakeishSequence[PartialUser], bool]
    ] = undefined.UNDEFINED,
    role_mentions: UndefinedOr[
        Union[SnowflakeishSequence[PartialRole], bool]
    ] = undefined.UNDEFINED
) -> Message

Edit a message sent by a webhook.

!!! note Mentioning everyone, roles, or users in message edits currently will not send a push notification showing a new mention to people on Discord. It will still highlight in their chat as if they were mentioned, however.

Also important to note that if you specify a text `content`, `mentions_everyone`,
`mentions_reply`, `user_mentions`, and `role_mentions` will default
to [`False`][] as the message will be re-parsed for mentions. This will
also occur if only one of the four are specified

This is a limitation of Discord's design. If in doubt, specify all
four of them each time.
PARAMETER DESCRIPTION
webhook

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

TYPE: Union[Snowflakeish, ExecutableWebhook]

token

The webhook token.

TYPE: str

message

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

TYPE: SnowflakeishOr[PartialMessage]

content

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.

TYPE: UndefinedOr[Any] DEFAULT: UNDEFINED

PARAMETER DESCRIPTION
thread

If provided then the message will be edited in the target thread within the webhook's channel, otherwise it will be edited in the webhook's target channel.

This is required when trying to edit a thread message.

TYPE: UndefinedOr[SnowflakeishOr[GuildThreadChannel]]

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.

TYPE: UndefinedNoneOr[Union[Resourceish, Attachment]]

attachments

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.

TYPE: UndefinedNoneOr[Sequence[Union[Resourceish, Attachment]]]

component

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.

TYPE: UndefinedNoneOr[ComponentBuilder]

components

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.

TYPE: UndefinedNoneOr[Sequence[ComponentBuilder]]

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.

TYPE: UndefinedNoneOr[Embed]

embeds

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.

TYPE: UndefinedNoneOr[Sequence[Embed]]

mentions_everyone

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.

TYPE: UndefinedOr[bool]

user_mentions

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.

TYPE: UndefinedOr[Union[SnowflakeishSequence[PartialUser], bool]]

role_mentions

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.

TYPE: UndefinedOr[Union[SnowflakeishSequence[PartialRole], bool]]

RETURNS DESCRIPTION
Message

The edited message.

RAISES DESCRIPTION
ValueError

If both attachment and attachments, component and components or embed and embeds are specified.

BadRequestError

This may be raised in several discrete situations, such as messages being empty with no attachments or embeds; messages with more than 2000 characters in them, embeds that exceed one of the many embed limits; too many attachments; attachments that are too large; invalid image URLs in embeds; too many components.

UnauthorizedError

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

NotFoundError

If the webhook or the message are not found.

RateLimitTooLongError

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

InternalServerError

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

edit_welcome_screen async #

edit_welcome_screen(
    guild: SnowflakeishOr[PartialGuild],
    *,
    description: UndefinedNoneOr[str] = undefined.UNDEFINED,
    enabled: UndefinedOr[bool] = undefined.UNDEFINED,
    channels: UndefinedNoneOr[Sequence[WelcomeChannel]] = undefined.UNDEFINED
) -> WelcomeScreen

Edit the welcome screen of a community guild.

PARAMETER DESCRIPTION
guild

ID or object of the guild to edit the welcome screen for.

TYPE: SnowflakeishOr[PartialGuild]

PARAMETER DESCRIPTION
description

If provided, the description to set for the guild's welcome screen. This may be None to unset the description.

TYPE: UndefinedNoneOr[str]

enabled

If provided, Whether the guild's welcome screen should be enabled.

TYPE: UndefinedOr[bool]

channels

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.

TYPE: UndefinedNoneOr[Sequence[WelcomeChannel]]

RETURNS DESCRIPTION
WelcomeScreen

The edited guild welcome screen.

RAISES DESCRIPTION
BadRequestError

If more than 5 welcome channels are provided or if a custom emoji is included on a welcome channel in a guild that doesn't have tier 2 of above boost status or if a private channel is included as a welcome channel.

ForbiddenError

If you are missing the hikari.permissions.Permissions.MANAGE_GUILD permission, are not part of the guild or the guild doesn't have access to the community welcome screen feature.

NotFoundError

If the guild is not found.

UnauthorizedError

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

RateLimitTooLongError

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

InternalServerError

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

edit_widget async #

edit_widget(
    guild: SnowflakeishOr[PartialGuild],
    *,
    channel: UndefinedNoneOr[
        SnowflakeishOr[GuildChannel]
    ] = undefined.UNDEFINED,
    enabled: UndefinedOr[bool] = undefined.UNDEFINED,
    reason: UndefinedOr[str] = undefined.UNDEFINED
) -> GuildWidget

Fetch a guilds's widget.

PARAMETER DESCRIPTION
guild

The guild to edit the widget in. This can be the object or the ID of an existing guild.

TYPE: SnowflakeishOr[PartialGuild]

PARAMETER DESCRIPTION
channel

If provided, the channel to set the widget to. If None, will not set to any.

TYPE: UndefinedNoneOr[SnowflakeishOr[GuildChannel]]

enabled

If provided, whether to enable the widget.

TYPE: UndefinedOr[bool]

reason

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

TYPE: UndefinedOr[str]

RETURNS DESCRIPTION
GuildWidget

The edited guild widget.

RAISES DESCRIPTION
ForbiddenError

If you are missing the hikari.permissions.Permissions.MANAGE_GUILD permission.

NotFoundError

If the guild is not found.

UnauthorizedError

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

RateLimitTooLongError

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

InternalServerError

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

estimate_guild_prune_count async #

estimate_guild_prune_count(
    guild: SnowflakeishOr[PartialGuild],
    *,
    days: UndefinedOr[int] = undefined.UNDEFINED,
    include_roles: UndefinedOr[
        SnowflakeishSequence[PartialRole]
    ] = undefined.UNDEFINED
) -> int

Estimate the guild prune count.

PARAMETER DESCRIPTION
guild

The guild to estimate the guild prune count for. This may be the object or the ID of an existing guild.

TYPE: SnowflakeishOr[PartialGuild]

PARAMETER DESCRIPTION
days

If provided, number of days to count prune for.

TYPE: UndefinedOr[int]

include_roles

If provided, the role(s) to include. By default, this endpoint will not count users with roles. Providing roles using this attribute will make members with the specified roles also get included into the count.

TYPE: hikari.undefined.UndefinedOr[hikari.snowflakes.SnowflakeishSequence[hikari.guilds.PartialRole]]]

RETURNS DESCRIPTION
int

The estimated guild prune count.

RAISES DESCRIPTION
BadRequestError

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

UnauthorizedError

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

ForbiddenError

If you are missing the hikari.permissions.Permissions.KICK_MEMBERS permission.

NotFoundError

If the guild is not found.

RateLimitTooLongError

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

InternalServerError

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

execute_webhook async #

execute_webhook(
    webhook: Union[ExecutableWebhook, Snowflakeish],
    token: str,
    content: UndefinedOr[Any] = undefined.UNDEFINED,
    *,
    thread: Union[
        UndefinedType, SnowflakeishOr[GuildThreadChannel]
    ] = undefined.UNDEFINED,
    username: UndefinedOr[str] = undefined.UNDEFINED,
    avatar_url: Union[UndefinedType, str, URL] = undefined.UNDEFINED,
    attachment: UndefinedOr[Resourceish] = undefined.UNDEFINED,
    attachments: UndefinedOr[Sequence[Resourceish]] = undefined.UNDEFINED,
    component: UndefinedOr[ComponentBuilder] = undefined.UNDEFINED,
    components: UndefinedOr[Sequence[ComponentBuilder]] = undefined.UNDEFINED,
    embed: UndefinedOr[Embed] = undefined.UNDEFINED,
    embeds: UndefinedOr[Sequence[Embed]] = undefined.UNDEFINED,
    tts: UndefinedOr[bool] = undefined.UNDEFINED,
    mentions_everyone: UndefinedOr[bool] = undefined.UNDEFINED,
    user_mentions: UndefinedOr[
        Union[SnowflakeishSequence[PartialUser], bool]
    ] = undefined.UNDEFINED,
    role_mentions: UndefinedOr[
        Union[SnowflakeishSequence[PartialRole], bool]
    ] = undefined.UNDEFINED,
    flags: Union[UndefinedType, int, MessageFlag] = undefined.UNDEFINED
) -> Message

Execute a webhook.

Warning

At the time of writing, username and avatar_url are ignored for interaction webhooks.

Additionally, hikari.messages.MessageFlag.SUPPRESS_EMBEDS, hikari.messages.MessageFlag.SUPPRESS_NOTIFICATIONS and hikari.messages.MessageFlag.EPHEMERAL are the only flags that can be set, with hikari.messages.MessageFlag.EPHEMERAL limited to interaction webhooks.

PARAMETER DESCRIPTION
webhook

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

TYPE: Union[Snowflakeish, ExecutableWebhook]

token

The webhook token.

TYPE: str

content

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.

TYPE: UndefinedOr[Any] DEFAULT: UNDEFINED

PARAMETER DESCRIPTION
thread

If provided then the message will be created in the target thread within the webhook's channel, otherwise it will be created in the webhook's target channel.

This is required when trying to create a thread message.

TYPE: UndefinedOr[SnowflakeishOr[GuildThreadChannel]]

username

If provided, the username to override the webhook's username for this request.

TYPE: UndefinedOr[str]

avatar_url

If provided, the url of an image to override the webhook's avatar with for this request.

TYPE: Union[UndefinedType, URL, str]

attachment

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

Attachments can be passed as many different things, to aid in convenience.

  • 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, hikari.embeds.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).

TYPE: UndefinedOr[Resourceish]

attachments

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

TYPE: UndefinedOr[Sequence[Resourceish]]

component

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

TYPE: UndefinedOr[ComponentBuilder]

components

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

TYPE: UndefinedOr[Sequence[ComponentBuilder]]

embed

If provided, the message embed.

TYPE: UndefinedOr[Embed]

embeds

If provided, the message embeds.

TYPE: UndefinedOr[Sequence[Embed]]

tts

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

TYPE: UndefinedOr[bool]

mentions_everyone

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

TYPE: UndefinedOr[bool]

user_mentions

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.

TYPE: UndefinedOr[Union[SnowflakeishSequence[PartialUser], bool]]

role_mentions

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.

TYPE: UndefinedOr[Union[SnowflakeishSequence[PartialRole], bool]]

flags

The flags to set for this webhook message.

TYPE: Union[UndefinedType, int, MessageFlag]

RETURNS DESCRIPTION
Message

The created message.

RAISES DESCRIPTION
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.

BadRequestError

This may be raised in several discrete situations, such as messages being empty with no attachments or embeds; messages with more than 2000 characters in them, embeds that exceed one of the many embed limits; too many attachments; attachments that are too large; invalid image URLs in embeds; too many components.

UnauthorizedError

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

NotFoundError

If the webhook is not found.

RateLimitTooLongError

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

InternalServerError

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

fetch_active_threads async #

fetch_active_threads(
    guild: SnowflakeishOr[Guild],
) -> Sequence[GuildThreadChannel]

Fetch a guild's active threads.

PARAMETER DESCRIPTION
guild

Object or ID of the guild to fetch the active threads of.

TYPE: SnowflakeishOr[Guild]

RETURNS DESCRIPTION
Sequence[GuildThreadChannel]

A sequence of the guild's active threads.

RAISES DESCRIPTION
BadRequestError

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

ForbiddenError

If you access the guild's active threads.

NotFoundError

If the guild doesn't exist.

UnauthorizedError

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

RateLimitTooLongError

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

InternalServerError

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

fetch_application async #

fetch_application() -> Application

Fetch the token's associated application.

Warning

This endpoint can only be used with a Bot token. Using this with a Bearer token will result in a hikari.errors.UnauthorizedError.

RETURNS DESCRIPTION
Application

The token's associated application.

RAISES DESCRIPTION
UnauthorizedError

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

RateLimitTooLongError

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

InternalServerError

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

fetch_application_command async #

fetch_application_command(
    application: SnowflakeishOr[PartialApplication],
    command: SnowflakeishOr[PartialCommand],
    guild: UndefinedOr[SnowflakeishOr[PartialGuild]] = undefined.UNDEFINED,
) -> PartialCommand

Fetch a command set for an application.

PARAMETER DESCRIPTION
application

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

TYPE: SnowflakeishOr[PartialApplication]

command

Object or ID of the command to fetch.

TYPE: SnowflakeishOr[PartialCommand]

PARAMETER DESCRIPTION
guild

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.

TYPE: hikari.undefined.UndefinedOr[hikari.snowflakes.SnowflakeishOr[hikari.guilds.PartialGuild]

RETURNS DESCRIPTION
PartialCommand

Object of the fetched command.

RAISES DESCRIPTION
ForbiddenError

If you cannot access the target command.

NotFoundError

If the command isn't found.

UnauthorizedError

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

RateLimitTooLongError

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

InternalServerError

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

fetch_application_command_permissions async #

fetch_application_command_permissions(
    application: SnowflakeishOr[PartialApplication],
    guild: SnowflakeishOr[PartialGuild],
    command: SnowflakeishOr[PartialCommand],
) -> GuildCommandPermissions

Fetch the permissions registered for a specific command in a guild.

PARAMETER DESCRIPTION
application

Object or ID of the application to fetch the command permissions for.

TYPE: SnowflakeishOr[PartialApplication]

guild

Object or ID of the guild to fetch the command permissions for.

TYPE: UndefinedOr[SnowflakeishOr[PartialGuild]]

command

Object or ID of the command to fetch the command permissions for.

TYPE: SnowflakeishOr[PartialCommand]

RETURNS DESCRIPTION
GuildCommandPermissions

Object of the command permissions set for the specified command.

RAISES DESCRIPTION
ForbiddenError

If you cannot access the provided application's commands or guild.

NotFoundError

If the provided application or command isn't found.

UnauthorizedError

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

RateLimitTooLongError

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

InternalServerError

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

fetch_application_commands async #

fetch_application_commands(
    application: SnowflakeishOr[PartialApplication],
    guild: UndefinedOr[SnowflakeishOr[PartialGuild]] = undefined.UNDEFINED,
) -> Sequence[PartialCommand]

Fetch the commands set for an application.

PARAMETER DESCRIPTION
application

Object or ID of the application to fetch the commands for.

TYPE: SnowflakeishOr[PartialApplication]

PARAMETER DESCRIPTION
guild

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.

TYPE: hikari.undefined.UndefinedOr[hikari.snowflakes.SnowflakeishOr[hikari.guilds.PartialGuild]

RETURNS DESCRIPTION
Sequence[PartialCommand]

A sequence of the commands declared for the provided application. This will exclusively either contain the commands set for a specific guild if guild is provided or the global commands if not.

RAISES DESCRIPTION
ForbiddenError

If you cannot access the target guild.

NotFoundError

If the provided application isn't found.

UnauthorizedError

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

RateLimitTooLongError

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

InternalServerError

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

fetch_application_guild_commands_permissions async #

fetch_application_guild_commands_permissions(
    application: SnowflakeishOr[PartialApplication],
    guild: SnowflakeishOr[PartialGuild],
) -> Sequence[GuildCommandPermissions]

Fetch the command permissions registered in a guild.

PARAMETER DESCRIPTION
application

Object or ID of the application to fetch the command permissions for.

TYPE: SnowflakeishOr[PartialApplication]

guild

Object or ID of the guild to fetch the command permissions for.

TYPE: UndefinedOr[SnowflakeishOr[PartialGuild]]

RETURNS DESCRIPTION
Sequence[GuildCommandPermissions]

Sequence of the guild command permissions set for the specified guild.

RAISES DESCRIPTION
ForbiddenError

If you cannot access the provided application's commands or guild.

NotFoundError

If the provided application isn't found.

UnauthorizedError

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

RateLimitTooLongError

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

InternalServerError

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

fetch_application_role_connection_metadata_records async #

fetch_application_role_connection_metadata_records(
    application: SnowflakeishOr[PartialApplication],
) -> Sequence[ApplicationRoleConnectionMetadataRecord]

Fetch the application role connection metadata records.

Note

This requires the token to have the hikari.applications.OAuth2Scope.ROLE_CONNECTIONS_WRITE scope enabled.

PARAMETER DESCRIPTION
application

The application to fetch the application role connection metadata records for.

TYPE: SnowflakeishOr[PartialApplication]

RETURNS DESCRIPTION
Sequence[ApplicationRoleConnectionMetadataRecord]

The requested application role connection metadata records.

RAISES DESCRIPTION
UnauthorizedError

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

NotFoundError

If the application is not found.

RateLimitTooLongError

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

InternalServerError

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

fetch_audit_log #

fetch_audit_log(
    guild: SnowflakeishOr[PartialGuild],
    *,
    before: UndefinedOr[SearchableSnowflakeishOr[Unique]] = undefined.UNDEFINED,
    user: UndefinedOr[SnowflakeishOr[PartialUser]] = undefined.UNDEFINED,
    event_type: UndefinedOr[Union[AuditLogEventType, int]] = undefined.UNDEFINED
) -> LazyIterator[AuditLog]

Fetch pages of the guild's audit log.

Note

This call is not a coroutine function, it returns a special type of lazy iterator that will perform API calls as you iterate across it, thus any errors documented below will happen then.

See hikari.iterators for the full API for this iterator type.

PARAMETER DESCRIPTION
guild

The guild to fetch the audit logs from. This can be a guild object or the ID of an existing guild.

TYPE: SnowflakeishOr[PartialGuild]

PARAMETER DESCRIPTION
before

If provided, filter to only actions before this snowflake. If you provide a datetime object, it will be transformed into a snowflake. This may be any other Discord entity that has an ID. In this case, the date the object was first created will be used.

TYPE: UndefinedOr[SearchableSnowflakeishOr[Unique]]

user

If provided, the user to filter for.

TYPE: UndefinedOr[SnowflakeishOr[PartialUser]]

event_type

If provided, the event type to filter for.

TYPE: UndefinedOr[Union[AuditLogEventType, int]]

RETURNS DESCRIPTION
LazyIterator[AuditLog]

The guild's audit log.

RAISES DESCRIPTION
BadRequestError

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

ForbiddenError

If you are missing the hikari.permissions.Permissions.VIEW_AUDIT_LOG permission.

UnauthorizedError

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

RateLimitTooLongError

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

InternalServerError

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

fetch_authorization async #

fetch_authorization() -> AuthorizationInformation

Fetch the token's authorization information.

Warning

This endpoint can only be used with a Bearer token. Using this with a Bot token will result in a hikari.errors.UnauthorizedError.

RETURNS DESCRIPTION
AuthorizationInformation

The token's authorization information.

RAISES DESCRIPTION
UnauthorizedError

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

RateLimitTooLongError

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

InternalServerError

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

fetch_available_sticker_packs async #

fetch_available_sticker_packs() -> Sequence[StickerPack]

Fetch the available sticker packs.

RETURNS DESCRIPTION
Sequence[StickerPack]

The available sticker packs.

RAISES DESCRIPTION
RateLimitTooLongError

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

InternalServerError

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

fetch_ban async #

Fetch the guild's ban info for a user.

PARAMETER DESCRIPTION
guild

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

TYPE: SnowflakeishOr[PartialGuild]

user

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

TYPE: SnowflakeishOr[PartialUser]

RETURNS DESCRIPTION
GuildBan

The requested ban info.

RAISES DESCRIPTION
ForbiddenError

If you are missing the hikari.permissions.Permissions.BAN_MEMBERS permission.

UnauthorizedError

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

NotFoundError

If the guild or user are not found or if the user is not banned.

RateLimitTooLongError

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

InternalServerError

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

fetch_bans #

fetch_bans(
    guild: SnowflakeishOr[PartialGuild],
    /,
    *,
    newest_first: bool = False,
    start_at: UndefinedOr[
        SearchableSnowflakeishOr[PartialUser]
    ] = undefined.UNDEFINED,
) -> LazyIterator[GuildBan]

Fetch the bans of a guild.

Note

This call is not a coroutine function, it returns a special type of lazy iterator that will perform API calls as you iterate across it. See hikari.iterators for the full API for this iterator type.

PARAMETER DESCRIPTION
guild

The guild to fetch the bans from. This may be the object or the ID of an existing guild.

TYPE: SnowflakeishOr[PartialGuild]

PARAMETER DESCRIPTION
newest_first

Whether to fetch the newest first or the oldest first.

TYPE: bool

start_at

If provided, will start at this snowflake. If you provide a datetime object, it will be transformed into a snowflake. This may also be a scheduled event object object. In this case, the date the object was first created will be used.

TYPE: UndefinedOr[SearchableSnowflakeishOr[PartialUser]]

RETURNS DESCRIPTION
LazyIterator[GuildBan]

The requested bans.

RAISES DESCRIPTION
ForbiddenError

If you are missing the hikari.permissions.Permissions.BAN_MEMBERS permission.

UnauthorizedError

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

NotFoundError

If the guild is not found.

RateLimitTooLongError

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

InternalServerError

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

fetch_channel async #

fetch_channel(channel: SnowflakeishOr[PartialChannel]) -> PartialChannel

Fetch a channel.

PARAMETER DESCRIPTION
channel

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

TYPE: SnowflakeishOr[PartialChannel]

RETURNS DESCRIPTION
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.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 DESCRIPTION
UnauthorizedError

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

ForbiddenError

If you are missing the hikari.permissions.Permissions.VIEW_CHANNEL permission in the channel.

NotFoundError

If the channel is not found.

RateLimitTooLongError

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

InternalServerError

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

fetch_channel_invites async #

fetch_channel_invites(
    channel: SnowflakeishOr[GuildChannel],
) -> Sequence[InviteWithMetadata]

Fetch all invites pointing to the given guild channel.

PARAMETER DESCRIPTION
channel

The channel to fetch the invites from. This may be a channel object, or the ID of an existing channel.

TYPE: SnowflakeishOr[GuildChannel]

RETURNS DESCRIPTION
Sequence[InviteWithMetadata]

The invites pointing to the given guild channel.

RAISES DESCRIPTION
UnauthorizedError

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

ForbiddenError

If you are missing the hikari.permissions.Permissions.MANAGE_CHANNELS permission in the channel.

NotFoundError

If the channel is not found in any guilds you are a member of.

RateLimitTooLongError

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

InternalServerError

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

fetch_channel_webhooks async #

fetch_channel_webhooks(
    channel: SnowflakeishOr[WebhookChannelT],
) -> Sequence[PartialWebhook]

Fetch all channel webhooks.

PARAMETER DESCRIPTION
channel

The channel to fetch the webhooks for. This may be an instance of any of the classes which are valid for hikari.channels.WebhookChannelT or the ID of an existing channel.

TYPE: SnowflakeishOr[WebhookChannelT]

RETURNS DESCRIPTION
Sequence[PartialWebhook]

The fetched webhooks.

RAISES DESCRIPTION
UnauthorizedError

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

ForbiddenError

If you are missing the hikari.permissions.Permissions.MANAGE_WEBHOOKS permission.

NotFoundError

If the channel is not found.

RateLimitTooLongError

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

InternalServerError

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

fetch_emoji async #

Fetch a guild emoji.

PARAMETER DESCRIPTION
guild

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

TYPE: SnowflakeishOr[PartialGuild]

emoji

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

TYPE: SnowflakeishOr[CustomEmoji]

RETURNS DESCRIPTION
KnownCustomEmoji

The requested emoji.

RAISES DESCRIPTION
NotFoundError

If the guild or the emoji are not found.

UnauthorizedError

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

RateLimitTooLongError

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

InternalServerError

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

fetch_gateway_bot_info async #

fetch_gateway_bot_info() -> GatewayBotInfo

Fetch the gateway info for the bot.

RETURNS DESCRIPTION
GatewayBotInfo

The gateway bot information.

RAISES DESCRIPTION
UnauthorizedError

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

RateLimitTooLongError

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

InternalServerError

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

fetch_gateway_url async #

fetch_gateway_url() -> str

Fetch the gateway url.

Note

This endpoint does not require any valid authorization.

RAISES DESCRIPTION
RateLimitTooLongError

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

InternalServerError

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

fetch_guild async #

fetch_guild(guild: SnowflakeishOr[PartialGuild]) -> RESTGuild

Fetch a guild.

PARAMETER DESCRIPTION
guild

The guild to fetch. This can be the object or the ID of an existing guild.

TYPE: SnowflakeishOr[PartialGuild]

RETURNS DESCRIPTION
RESTGuild

The requested guild.

RAISES DESCRIPTION
ForbiddenError

If you are not part of the guild.

NotFoundError

If the guild is not found.

UnauthorizedError

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

RateLimitTooLongError

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

InternalServerError

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

fetch_guild_channels async #

fetch_guild_channels(
    guild: SnowflakeishOr[PartialGuild],
) -> Sequence[GuildChannel]

Fetch the channels in a guild.

PARAMETER DESCRIPTION
guild

The guild to fetch the channels from. This may be the object or the ID of an existing guild.

TYPE: SnowflakeishOr[PartialGuild]

RETURNS DESCRIPTION
Sequence[GuildChannel]

The requested channels.

RAISES DESCRIPTION
UnauthorizedError

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

NotFoundError

If the guild is not found.

RateLimitTooLongError

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

InternalServerError

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

fetch_guild_emojis async #

fetch_guild_emojis(
    guild: SnowflakeishOr[PartialGuild],
) -> Sequence[KnownCustomEmoji]

Fetch the emojis of a guild.

PARAMETER DESCRIPTION
guild

The guild to fetch the emojis from. This can be a guild object or the ID of an existing guild.

TYPE: SnowflakeishOr[PartialGuild]

RETURNS DESCRIPTION
Sequence[KnownCustomEmoji]

The requested emojis.

RAISES DESCRIPTION
NotFoundError

If the guild is not found.

UnauthorizedError

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

RateLimitTooLongError

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

InternalServerError

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

fetch_guild_invites async #

fetch_guild_invites(
    guild: SnowflakeishOr[PartialGuild],
) -> Sequence[InviteWithMetadata]

Fetch the guild's invites.

PARAMETER DESCRIPTION
guild

The guild to fetch the invites for. This may be the object or the ID of an existing guild.

TYPE: SnowflakeishOr[PartialGuild]

RETURNS DESCRIPTION
Sequence[InviteWithMetadata]

The invites for the guild.

RAISES DESCRIPTION
ForbiddenError

If you are missing the hikari.permissions.Permissions.MANAGE_GUILD permission.

UnauthorizedError

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

NotFoundError

If the guild is not found.

RateLimitTooLongError

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

InternalServerError

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

fetch_guild_preview async #

fetch_guild_preview(guild: SnowflakeishOr[PartialGuild]) -> GuildPreview

Fetch a guild preview.

Note

This will only work for guilds you are a part of or are public.

PARAMETER DESCRIPTION
guild

The guild to fetch the preview of. This can be a guild object or the ID of an existing guild.

TYPE: SnowflakeishOr[PartialGuild]

RETURNS DESCRIPTION
GuildPreview

The requested guild preview.

RAISES DESCRIPTION
NotFoundError

If the guild is not found or you are not part of the guild.

UnauthorizedError

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

RateLimitTooLongError

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

InternalServerError

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

fetch_guild_sticker async #

fetch_guild_sticker(
    guild: SnowflakeishOr[PartialGuild], sticker: SnowflakeishOr[PartialSticker]
) -> GuildSticker

Fetch a guild sticker.

PARAMETER DESCRIPTION
guild

The guild the sticker is in. This can be a guild object or the ID of an existing guild.

TYPE: SnowflakeishOr[PartialGuild]

sticker

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

TYPE: SnowflakeishOr[PartialSticker]

RETURNS DESCRIPTION
GuildSticker

The requested sticker.

RAISES DESCRIPTION
ForbiddenError

If you are not part of the server.

NotFoundError

If the guild or the sticker are not found.

UnauthorizedError

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

RateLimitTooLongError

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

InternalServerError

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

fetch_guild_stickers async #

fetch_guild_stickers(
    guild: SnowflakeishOr[PartialGuild],
) -> Sequence[GuildSticker]

Fetch a standard sticker.

PARAMETER DESCRIPTION
guild

The guild to request stickers for. This can be a guild object or the ID of an existing guild.

TYPE: SnowflakeishOr[PartialGuild]

RETURNS DESCRIPTION
Sequence[GuildSticker]

The requested stickers.

RAISES DESCRIPTION
ForbiddenError

If you are not part of the server.

NotFoundError

If the guild is not found.

UnauthorizedError

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

RateLimitTooLongError

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

InternalServerError

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

fetch_guild_templates async #

fetch_guild_templates(
    guild: SnowflakeishOr[PartialGuild],
) -> Sequence[Template]

Fetch the templates for a guild.

PARAMETER DESCRIPTION
guild

The object or ID of the guild to get the templates for.

TYPE: SnowflakeishOr[PartialGuild]

RETURNS DESCRIPTION
Sequence[Template]

A sequence of the found template objects.

RAISES DESCRIPTION
ForbiddenError

If you are not part of the guild.

NotFoundError

If the guild is not found or are missing the hikari.permissions.Permissions.MANAGE_GUILD permission.

UnauthorizedError

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

RateLimitTooLongError

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

InternalServerError

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

fetch_guild_voice_regions async #

fetch_guild_voice_regions(
    guild: SnowflakeishOr[PartialGuild],
) -> Sequence[VoiceRegion]

Fetch the available voice regions for a guild.

PARAMETER DESCRIPTION
guild

The guild to fetch the voice regions for. This may be the object or the ID of an existing guild.

TYPE: SnowflakeishOr[PartialGuild]

RETURNS DESCRIPTION
Sequence[VoiceRegion]

The available voice regions for the guild.

RAISES DESCRIPTION
UnauthorizedError

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

NotFoundError

If the guild is not found.

RateLimitTooLongError

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

InternalServerError

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

fetch_guild_webhooks async #

fetch_guild_webhooks(
    guild: SnowflakeishOr[PartialGuild],
) -> Sequence[PartialWebhook]

Fetch all guild webhooks.

PARAMETER DESCRIPTION
guild

The guild to fetch the webhooks for. This may be the object or the ID of an existing guild.

TYPE: SnowflakeishOr[PartialGuild]

RETURNS DESCRIPTION
Sequence[PartialWebhook]

The fetched webhooks.

RAISES DESCRIPTION
UnauthorizedError

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

ForbiddenError

If you are missing the hikari.permissions.Permissions.MANAGE_WEBHOOKS permission.

NotFoundError

If the guild is not found.

RateLimitTooLongError

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

InternalServerError

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

fetch_integrations async #

fetch_integrations(
    guild: SnowflakeishOr[PartialGuild],
) -> Sequence[Integration]

Fetch the guild's integrations.

PARAMETER DESCRIPTION
guild

The guild to fetch the integrations for. This may be the object or the ID of an existing guild.

TYPE: SnowflakeishOr[PartialGuild]

RETURNS DESCRIPTION
Sequence[Integration]

The integrations for the guild.

RAISES DESCRIPTION
ForbiddenError

If you are missing the hikari.permissions.Permissions.MANAGE_GUILD permission.

UnauthorizedError

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

NotFoundError

If the guild is not found.

RateLimitTooLongError

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

InternalServerError

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

fetch_interaction_response async #

fetch_interaction_response(
    application: SnowflakeishOr[PartialApplication], token: str
) -> Message

Fetch the initial response for an interaction.

PARAMETER DESCRIPTION
application

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

TYPE: SnowflakeishOr[PartialApplication]

token

Token of the interaction to get the initial response for.

TYPE: str

RETURNS DESCRIPTION
Message

Message object of the initial response.

RAISES DESCRIPTION
ForbiddenError

If you cannot access the target interaction.

NotFoundError

If the initial response isn't found.

UnauthorizedError

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

RateLimitTooLongError

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

InternalServerError

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

fetch_invite async #

fetch_invite(
    invite: Union[InviteCode, str],
    with_counts: bool = True,
    with_expiration: bool = True,
) -> Invite

Fetch an existing invite.

PARAMETER DESCRIPTION
invite

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

TYPE: Union[InviteCode, str]

with_counts

Whether the invite should contain the approximate member counts.

TYPE: bool DEFAULT: True

with_expiration

Whether the invite should contain the expiration date.

TYPE: bool DEFAULT: True

RETURNS DESCRIPTION
Invite

The requested invite.

RAISES DESCRIPTION
UnauthorizedError

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

NotFoundError

If the invite is not found.

RateLimitTooLongError

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

InternalServerError

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

fetch_joined_private_archived_threads #

fetch_joined_private_archived_threads(
    channel: SnowflakeishOr[PermissibleGuildChannel],
    /,
    *,
    before: UndefinedOr[
        SearchableSnowflakeishOr[GuildThreadChannel]
    ] = undefined.UNDEFINED,
) -> LazyIterator[GuildPrivateThread]

Fetch the private archived threads you have joined in a channel.

Note

The exceptions on this endpoint will only be raised once the result is awaited or iterated over. Invoking this function itself will not raise anything.

PARAMETER DESCRIPTION
channel

Object or ID of the channel to fetch the private archived threads of.

TYPE: UndefinedOr[PermissibleGuildChannel]

PARAMETER DESCRIPTION
before

If provided, fetch joined threads before this snowflake. If you provide a datetime object, it will be transformed into a snowflake.

TYPE: UndefinedOr[SearchableSnowflakeishOr[GuildThreadChannel]]

RETURNS DESCRIPTION
LazyIterator[GuildPrivateThread]

An iterator to fetch the threads.

Note

This call is not a coroutine function, it returns a special type of lazy iterator that will perform API calls as you iterate across it. See hikari.iterators for the full API for this iterator type.

RAISES DESCRIPTION
UnauthorizedError

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

ForbiddenError

If you cannot access the channel.

NotFoundError

If the channel is not found.

RateLimitTooLongError

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

InternalServerError

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

fetch_member async #

fetch_member(
    guild: SnowflakeishOr[PartialGuild], user: SnowflakeishOr[PartialUser]
) -> Member

Fetch a guild member.

PARAMETER DESCRIPTION
guild

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

TYPE: SnowflakeishOr[PartialGuild]

user

The user to get the member for. This may be the object or the ID of an existing user.

TYPE: SnowflakeishOr[PartialUser]

RETURNS DESCRIPTION
Member

The requested member.

RAISES DESCRIPTION
UnauthorizedError

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

NotFoundError

If the guild or the user are not found.

RateLimitTooLongError

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

InternalServerError

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

fetch_members #

fetch_members(guild: SnowflakeishOr[PartialGuild]) -> LazyIterator[Member]

Fetch the members from a guild.

Warning

This endpoint requires the [hikari.intents.Intents.GUILD_MEMBERS] intent to be enabled in the dashboard, not necessarily authenticated with it if using the gateway. If you don't have the intents you can use hikari.api.rest.RESTClient.search_members which doesn't require any intents.

Note

This call is not a coroutine function, it returns a special type of lazy iterator that will perform API calls as you iterate across it, thus any errors documented below will happen then.

See hikari.iterators for the full API for this iterator type.

PARAMETER DESCRIPTION
guild

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

TYPE: SnowflakeishOr[PartialGuild]

RETURNS DESCRIPTION
LazyIterator[Member]

An iterator to fetch the members.

RAISES DESCRIPTION
UnauthorizedError

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

NotFoundError

If the guild is not found.

RateLimitTooLongError

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

InternalServerError

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

fetch_message async #

fetch_message(
    channel: SnowflakeishOr[TextableChannel],
    message: SnowflakeishOr[PartialMessage],
) -> Message

Fetch a specific message in the given text channel.

PARAMETER DESCRIPTION
channel

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

TYPE: SnowflakeishOr[TextableChannel]

message

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

TYPE: SnowflakeishOr[PartialMessage]

RETURNS DESCRIPTION
Message

The requested message.

RAISES DESCRIPTION
UnauthorizedError

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

ForbiddenError

If you are missing the hikari.permissions.Permissions.READ_MESSAGE_HISTORY in the channel.

NotFoundError

If the channel is not found or the message is not found in the given text channel.

RateLimitTooLongError

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

InternalServerError

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

fetch_messages #

fetch_messages(
    channel: SnowflakeishOr[TextableChannel],
    *,
    before: UndefinedOr[SearchableSnowflakeishOr[Unique]] = undefined.UNDEFINED,
    after: UndefinedOr[SearchableSnowflakeishOr[Unique]] = undefined.UNDEFINED,
    around: UndefinedOr[SearchableSnowflakeishOr[Unique]] = undefined.UNDEFINED
) -> LazyIterator[Message]

Browse the message history for a given text channel.

Note

This call is not a coroutine function, it returns a special type of lazy iterator that will perform API calls as you iterate across it, thus any errors documented below will happen then.

See hikari.iterators for the full API for this iterator type.

PARAMETER DESCRIPTION
channel

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

TYPE: SnowflakeishOr[TextableChannel]

PARAMETER DESCRIPTION
before

If provided, fetch messages before this snowflake. If you provide a datetime object, it will be transformed into a snowflake. This may be any other Discord entity that has an ID. In this case, the date the object was first created will be used.

TYPE: UndefinedOr[SearchableSnowflakeishOr[Unique]]

after

If provided, fetch messages after this snowflake. If you provide a datetime object, it will be transformed into a snowflake. This may be any other Discord entity that has an ID. In this case, the date the object was first created will be used.

TYPE: UndefinedOr[SearchableSnowflakeishOr[Unique]]

around

If provided, fetch messages around this snowflake. If you provide a datetime object, it will be transformed into a snowflake. This may be any other Discord entity that has an ID. In this case, the date the object was first created will be used.

TYPE: UndefinedOr[SearchableSnowflakeishOr[Unique]]

RETURNS DESCRIPTION
LazyIterator[Message]

An iterator to fetch the messages.

RAISES DESCRIPTION
TypeError

If you specify more than one of before, after, about.

UnauthorizedError

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

ForbiddenError

If you are missing the hikari.permissions.Permissions.READ_MESSAGE_HISTORY in the channel.

NotFoundError

If the channel is not found.

RateLimitTooLongError

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

InternalServerError

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

fetch_my_connections async #

fetch_my_connections() -> Sequence[OwnConnection]

Fetch the token's associated connections.

RETURNS DESCRIPTION
OwnConnection

The token's associated connections.

RAISES DESCRIPTION
UnauthorizedError

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

RateLimitTooLongError

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

InternalServerError

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

fetch_my_guilds #

fetch_my_guilds(
    *,
    newest_first: bool = False,
    start_at: UndefinedOr[
        SearchableSnowflakeishOr[PartialGuild]
    ] = undefined.UNDEFINED
) -> LazyIterator[OwnGuild]

Fetch the token's associated guilds.

Note

This call is not a coroutine function, it returns a special type of lazy iterator that will perform API calls as you iterate across it, thus any errors documented below will happen then.

See hikari.iterators for the full API for this iterator type.

PARAMETER DESCRIPTION
newest_first

Whether to fetch the newest first or the oldest first.

TYPE: bool

start_at

If provided, will start at this snowflake. If you provide a datetime object, it will be transformed into a snowflake. This may also be a guild object. In this case, the date the object was first created will be used.

TYPE: UndefinedOr[SearchableSnowflakeishOr[PartialGuild]]

RETURNS DESCRIPTION
LazyIterator[OwnGuild]

The token's associated guilds.

RAISES DESCRIPTION
BadRequestError

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

UnauthorizedError

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

RateLimitTooLongError

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

InternalServerError

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

fetch_my_member async #

fetch_my_member(guild: SnowflakeishOr[PartialGuild]) -> Member

Fetch the Oauth token's associated member in a guild.

Warning

This endpoint can only be used with a Bearer token. Using this with a Bot token will result in a hikari.errors.UnauthorizedError.

RETURNS DESCRIPTION
Member

The associated guild member.

RAISES DESCRIPTION
UnauthorizedError

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

NotFoundError

If the guild is not found.

RateLimitTooLongError

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

InternalServerError

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

fetch_my_user async #

fetch_my_user() -> OwnUser

Fetch the token's associated user.

RETURNS DESCRIPTION
OwnUser

The token's associated user.

RAISES DESCRIPTION
UnauthorizedError

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

RateLimitTooLongError

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

InternalServerError

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

fetch_my_user_application_role_connection async #

fetch_my_user_application_role_connection(
    application: SnowflakeishOr[PartialApplication],
) -> OwnApplicationRoleConnection

Fetch the token's associated role connections.

Note

This requires the token to have the hikari.applications.OAuth2Scope.ROLE_CONNECTIONS_WRITE scope enabled.

PARAMETER DESCRIPTION
application

The application to fetch the application role connections for.

TYPE: SnowflakeishOr[PartialApplication]

RETURNS DESCRIPTION
OwnApplicationRoleConnection

The requested role connection.

RAISES DESCRIPTION
UnauthorizedError

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

NotFoundError

If the application is not found.

RateLimitTooLongError

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

InternalServerError

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

fetch_pins async #

fetch_pins(channel: SnowflakeishOr[TextableChannel]) -> Sequence[Message]

Fetch the pinned messages in this text channel.

PARAMETER DESCRIPTION
channel

The channel to fetch pins from. This may be the object or the ID of an existing channel.

TYPE: SnowflakeishOr[TextableChannel]

RETURNS DESCRIPTION
Sequence[Message]

The pinned messages in this text channel.

RAISES DESCRIPTION
UnauthorizedError

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

ForbiddenError

If you are missing the hikari.permissions.Permissions.VIEW_CHANNEL in the channel.

NotFoundError

If the channel is not found.

RateLimitTooLongError

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

InternalServerError

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

fetch_private_archived_threads #

fetch_private_archived_threads(
    channel: SnowflakeishOr[PermissibleGuildChannel],
    /,
    *,
    before: UndefinedOr[datetime] = undefined.UNDEFINED,
) -> LazyIterator[GuildPrivateThread]

Fetch a channel's private archived threads.

Note

The exceptions on this endpoint will only be raised once the result is awaited or iterated over. Invoking this function itself will not raise anything.

PARAMETER DESCRIPTION
channel

Object or ID of the channel to fetch the private archived threads of.

TYPE: UndefinedOr[PermissibleGuildChannel]

PARAMETER DESCRIPTION
before

The date to fetch threads before.

This is based on the thread's archive_timestamp field.

TYPE: UndefinedOr[datetime]

RETURNS DESCRIPTION
LazyIterator[GuildPrivateThread]

An iterator to fetch the threads.

Note

This call is not a coroutine function, it returns a special type of lazy iterator that will perform API calls as you iterate across it. See hikari.iterators for the full API for this iterator type.

RAISES DESCRIPTION
UnauthorizedError

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

ForbiddenError

If you do not have hikari.permissions.Permissions.MANAGE_THREADS in the target channel.

NotFoundError

If the channel is not found.

RateLimitTooLongError

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

InternalServerError

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

fetch_public_archived_threads #

fetch_public_archived_threads(
    channel: SnowflakeishOr[PermissibleGuildChannel],
    /,
    *,
    before: UndefinedOr[datetime] = undefined.UNDEFINED,
) -> LazyIterator[Union[GuildNewsThread, GuildPublicThread]]

Fetch a channel's public archived threads.

Note

The exceptions on this endpoint will only be raised once the result is awaited or iterated over. Invoking this function itself will not raise anything.

PARAMETER DESCRIPTION
channel

Object or ID of the channel to fetch the archived threads of.

TYPE: UndefinedOr[PermissibleGuildChannel]

PARAMETER DESCRIPTION
before

The date to fetch threads before.

This is based on the thread's archive_timestamp field.

TYPE: UndefinedOr[datetime]

RETURNS DESCRIPTION
LazyIterator[Union[GuildNewsChannel, GuildPublicThread]]

An iterator to fetch the threads.

Note

This call is not a coroutine function, it returns a special type of lazy iterator that will perform API calls as you iterate across it. See hikari.iterators for the full API for this iterator type.

RAISES DESCRIPTION
UnauthorizedError

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

ForbiddenError

If you cannot access the channel.

NotFoundError

If the channel is not found.

RateLimitTooLongError

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

InternalServerError

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

fetch_reactions_for_emoji #

fetch_reactions_for_emoji(
    channel: SnowflakeishOr[TextableChannel],
    message: SnowflakeishOr[PartialMessage],
    emoji: Union[str, Emoji],
    emoji_id: UndefinedOr[SnowflakeishOr[CustomEmoji]] = undefined.UNDEFINED,
) -> LazyIterator[User]

Fetch reactions for an emoji from a message.

Note

This call is not a coroutine function, it returns a special type of lazy iterator that will perform API calls as you iterate across it, thus any errors documented below will happen then.

See hikari.iterators for the full API for this iterator type.

PARAMETER DESCRIPTION
channel

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

TYPE: SnowflakeishOr[TextableChannel]

message

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

TYPE: SnowflakeishOr[PartialMessage]

emoji

Object or name of the emoji to get the reactions for.

TYPE: Union[str, Emoji]

PARAMETER DESCRIPTION
emoji_id

ID of the custom emoji to get the reactions for. This should only be provided when a custom emoji's name is passed for emoji.

TYPE: UndefinedOr[SnowflakeishOr[CustomEmoji]]

RETURNS DESCRIPTION
LazyIterator[User]

An iterator to fetch the users.

RAISES DESCRIPTION
BadRequestError

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

UnauthorizedError

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

NotFoundError

If the channel or message is not found.

RateLimitTooLongError

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

InternalServerError

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

fetch_roles async #

fetch_roles(guild: SnowflakeishOr[PartialGuild]) -> Sequence[Role]

Fetch the roles of a guild.

PARAMETER DESCRIPTION
guild

The guild to fetch the roles from. This may be the object or the ID of an existing guild.

TYPE: SnowflakeishOr[PartialGuild]

RETURNS DESCRIPTION
Sequence[Role]

The requested roles.

RAISES DESCRIPTION
UnauthorizedError

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

NotFoundError

If the guild is not found.

RateLimitTooLongError

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

InternalServerError

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

fetch_scheduled_event async #

fetch_scheduled_event(
    guild: SnowflakeishOr[PartialGuild], event: SnowflakeishOr[ScheduledEvent]
) -> ScheduledEvent

Fetch a scheduled event.

PARAMETER DESCRIPTION
guild

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

TYPE: SnowflakeishOr[PartialGuild]

event

The event to fetch. This may be the object or the ID of an existing event.

TYPE: SnowflakeishOr[ScheduledEvent]

RETURNS DESCRIPTION
ScheduledEvent

The scheduled event.

RAISES DESCRIPTION
UnauthorizedError

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

ForbiddenError

If you are missing the permission needed to view this event.

For VOICE and STAGE_CHANNEL events, hikari.permissions.Permissions.VIEW_CHANNEL is required in their associated guild to see the event.

NotFoundError

If the guild or event is not found.

RateLimitTooLongError

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

InternalServerError

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

fetch_scheduled_event_users #

fetch_scheduled_event_users(
    guild: SnowflakeishOr[PartialGuild],
    event: SnowflakeishOr[ScheduledEvent],
    /,
    *,
    newest_first: bool = False,
    start_at: UndefinedOr[
        SearchableSnowflakeishOr[PartialUser]
    ] = undefined.UNDEFINED,
) -> LazyIterator[ScheduledEventUser]

Asynchronously iterate over the users who're subscribed to a scheduled event.

Note

This call is not a coroutine function, it returns a special type of lazy iterator that will perform API calls as you iterate across it, thus any errors documented below will happen then.

See hikari.iterators for the full API for this iterator type.

PARAMETER DESCRIPTION
guild

The guild to fetch the scheduled event users from.

TYPE: SnowflakeishOr[PartialGuild]

event

The scheduled event to fetch the subscribed users for.

TYPE: SnowflakeishOr[ScheduledEvent]

PARAMETER DESCRIPTION
newest_first

Whether to fetch the newest first or the oldest first.

TYPE: bool

start_at

If provided, will start at this snowflake. If you provide a datetime object, it will be transformed into a snowflake. This may also be a scheduled event object object. In this case, the date the object was first created will be used.

TYPE: UndefinedOr[SearchableSnowflakeishOr[PartialGuild]]

RETURNS DESCRIPTION
LazyIterator[ScheduledEventUser]

The token's associated guilds.

RAISES DESCRIPTION
BadRequestError

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

UnauthorizedError

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

NotFoundError

If the guild or event was not found.

RateLimitTooLongError

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

InternalServerError

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

fetch_scheduled_events async #

fetch_scheduled_events(
    guild: SnowflakeishOr[PartialGuild],
) -> Sequence[ScheduledEvent]

Fetch the scheduled events for a guild.

Note

VOICE and STAGE_CHANNEL events are only included if the bot has VOICE or STAGE_CHANNEL permissions in the associated channel.

PARAMETER DESCRIPTION
guild

Object or ID of the guild to fetch scheduled events for.

TYPE: SnowflakeishOr[PartialGuild]

RETURNS DESCRIPTION
Sequence[ScheduledEvent]

Sequence of the scheduled events.

RAISES DESCRIPTION
UnauthorizedError

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

NotFoundError

If the guild is not found.

RateLimitTooLongError

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

InternalServerError

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

fetch_sticker async #

Fetch a sticker.

PARAMETER DESCRIPTION
sticker

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

TYPE: SnowflakeishOr[PartialSticker]

RETURNS DESCRIPTION
Union[GuildSticker, StandardSticker]

The requested sticker.

RAISES DESCRIPTION
NotFoundError

If the sticker is not found.

UnauthorizedError

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

RateLimitTooLongError

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

InternalServerError

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

fetch_template async #

fetch_template(template: Union[Template, str]) -> Template

Fetch a guild template.

PARAMETER DESCRIPTION
template

The object or string code of the template to fetch.

TYPE: Union[str, Template]

RETURNS DESCRIPTION
Template

The object of the found template.

RAISES DESCRIPTION
NotFoundError

If the template was not found.

UnauthorizedError

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

RateLimitTooLongError

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

InternalServerError

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

fetch_thread_member async #

fetch_thread_member(
    channel: SnowflakeishOr[GuildThreadChannel],
    user: SnowflakeishOr[PartialUser],
) -> ThreadMember

Fetch a thread member.

PARAMETER DESCRIPTION
channel

Object or ID of the thread channel to fetch the member of.

TYPE: SnowflakeishOr[GuildTextChannel]

user

Object or ID of the user to fetch the thread member of.

TYPE: SnowflakeishOr[PartialUser]

RETURNS DESCRIPTION
ThreadMember

The thread member.

RAISES DESCRIPTION
BadRequestError

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

ForbiddenError

If you access the thread.

NotFoundError

If the thread channel or member doesn't exist.

UnauthorizedError

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

RateLimitTooLongError

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

InternalServerError

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

fetch_thread_members async #

fetch_thread_members(
    channel: SnowflakeishOr[GuildThreadChannel],
) -> Sequence[ThreadMember]

Fetch a thread's members.

PARAMETER DESCRIPTION
channel

Object or ID of the thread channel to fetch the members of.

TYPE: SnowflakeishOr[GuildTextChannel]

RETURNS DESCRIPTION
Sequence[ThreadMember]

A sequence of the thread's members.

RAISES DESCRIPTION
BadRequestError

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

ForbiddenError

If you access the thread.

NotFoundError

If the thread channel doesn't exist.

UnauthorizedError

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

RateLimitTooLongError

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

InternalServerError

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

fetch_user async #

fetch_user(user: SnowflakeishOr[PartialUser]) -> User

Fetch a user.

PARAMETER DESCRIPTION
user

The user to fetch. This can be the object or the ID of an existing user.

TYPE: SnowflakeishOr[PartialUser]

RETURNS DESCRIPTION
User

The requested user.

RAISES DESCRIPTION
UnauthorizedError

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

NotFoundError

If the user is not found.

RateLimitTooLongError

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

InternalServerError

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

fetch_vanity_url async #

fetch_vanity_url(guild: SnowflakeishOr[PartialGuild]) -> VanityURL

Fetch a guild's vanity url.

PARAMETER DESCRIPTION
guild

The guild to fetch the vanity url from. This can be the object or the ID of an existing guild.

TYPE: SnowflakeishOr[PartialGuild]

RETURNS DESCRIPTION
VanityURL

The requested invite.

RAISES DESCRIPTION
ForbiddenError

If you are not part of the guild.

NotFoundError

If the guild is not found.

UnauthorizedError

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

RateLimitTooLongError

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

InternalServerError

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

fetch_voice_regions async #

fetch_voice_regions() -> Sequence[VoiceRegion]

Fetch available voice regions.

RETURNS DESCRIPTION
Sequence[VoiceRegion]

The available voice regions.

RAISES DESCRIPTION
UnauthorizedError

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

RateLimitTooLongError

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

InternalServerError

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

fetch_webhook async #

fetch_webhook(
    webhook: SnowflakeishOr[PartialWebhook],
    *,
    token: UndefinedOr[str] = undefined.UNDEFINED
) -> PartialWebhook

Fetch an existing webhook.

PARAMETER DESCRIPTION
webhook

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

TYPE: SnowflakeishOr[PartialWebhook]

PARAMETER DESCRIPTION
token

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

TYPE: UndefinedOr[str]

RETURNS DESCRIPTION
PartialWebhook

The requested webhook.

RAISES DESCRIPTION
ForbiddenError

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

UnauthorizedError

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

NotFoundError

If the webhook is not found.

RateLimitTooLongError

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

InternalServerError

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

fetch_webhook_message async #

fetch_webhook_message(
    webhook: Union[ExecutableWebhook, Snowflakeish],
    token: str,
    message: SnowflakeishOr[PartialMessage],
    *,
    thread: Union[
        UndefinedType, SnowflakeishOr[GuildThreadChannel]
    ] = undefined.UNDEFINED
) -> Message

Fetch an old message sent by the webhook.

PARAMETER DESCRIPTION
webhook

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

TYPE: Union[Snowflakeish, ExecutableWebhook]

token

The webhook token.

TYPE: str

message

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

TYPE: SnowflakeishOr[PartialMessage]

PARAMETER DESCRIPTION
thread

If provided then the message will be fetched from the target thread within the webhook's channel, otherwise it will be fetched from the webhook's target channel.

This is required when trying to fetch a thread message.

TYPE: UndefinedOr[SnowflakeishOr[GuildThreadChannel]]

RETURNS DESCRIPTION
Message

The requested message.

RAISES DESCRIPTION
UnauthorizedError

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

NotFoundError

If the webhook is not found or the webhook's message wasn't found.

RateLimitTooLongError

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

InternalServerError

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

fetch_welcome_screen async #

fetch_welcome_screen(guild: SnowflakeishOr[PartialGuild]) -> WelcomeScreen

Fetch a guild's welcome screen.

PARAMETER DESCRIPTION
guild

Object or ID of the guild to fetch the welcome screen for.

TYPE: SnowflakeishOr[PartialGuild]

RETURNS DESCRIPTION
WelcomeScreen

The requested welcome screen.

RAISES DESCRIPTION
NotFoundError

If the guild is not found or the welcome screen has never been set for this guild (if the welcome screen has been set for a guild before and then disabled you should still be able to fetch it).

UnauthorizedError

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

RateLimitTooLongError

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

InternalServerError

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

fetch_widget async #

fetch_widget(guild: SnowflakeishOr[PartialGuild]) -> GuildWidget

Fetch a guilds's widget.

PARAMETER DESCRIPTION
guild

The guild to fetch the widget from. This can be the object or the ID of an existing guild.

TYPE: SnowflakeishOr[PartialGuild]

RETURNS DESCRIPTION
GuildWidget

The requested guild widget.

RAISES DESCRIPTION
ForbiddenError

If you are missing the hikari.permissions.Permissions.MANAGE_GUILD permission.

NotFoundError

If the guild is not found.

UnauthorizedError

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

RateLimitTooLongError

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

InternalServerError

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

follow_channel async #

follow_channel(
    news_channel: SnowflakeishOr[GuildNewsChannel],
    target_channel: SnowflakeishOr[GuildChannel],
    *,
    reason: UndefinedOr[str] = undefined.UNDEFINED
) -> ChannelFollow

Follow a news channel to send messages to a target channel.

PARAMETER DESCRIPTION
news_channel

The object or ID of the news channel to follow.

TYPE: SnowflakeishOr[GuildNewsChannel]

target_channel

The object or ID of the channel to target.

TYPE: SnowflakeishOr[GuildChannel]

RETURNS DESCRIPTION
ChannelFollow

Information about the new relationship that was made.

RAISES DESCRIPTION
BadRequestError

If you try to follow a channel that's not a news channel or if the target channel has reached it's webhook limit, which is 10 at the time of writing.

UnauthorizedError

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

ForbiddenError

If you are missing the hikari.permissions.Permissions.MANAGE_WEBHOOKS permission in the target channel or are missing the hikari.permissions.Permissions.VIEW_CHANNEL permission in the origin channel.

NotFoundError

If the origin or target channel is not found.

RateLimitTooLongError

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

InternalServerError

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

guild_builder #

guild_builder(name: str) -> GuildBuilder

Make a guild builder to create a guild with.

Note

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

Note

This call is not a coroutine function, it returns a special type of lazy iterator that will perform API calls as you iterate across it, thus any errors documented below will happen then.

See hikari.iterators for the full API for this iterator type.

PARAMETER DESCRIPTION
name

The new guilds name.

TYPE: str

RETURNS DESCRIPTION
GuildBuilder

The guild builder to use. This will allow to create a guild later with hikari.api.special_endpoints.GuildBuilder.create.

RAISES DESCRIPTION
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.

UnauthorizedError

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

RateLimitTooLongError

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

InternalServerError

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

See Also

GuildBuilder : hikari.api.special_endpoints.GuildBuilder.

interaction_autocomplete_builder #

interaction_autocomplete_builder(
    choices: Sequence[AutocompleteChoiceBuilder],
) -> InteractionAutocompleteBuilder

Create a builder for an autocomplete interaction response.

PARAMETER DESCRIPTION
choices

The autocomplete choices.

TYPE: Sequence[AutocompleteChoiceBuilder]

RETURNS DESCRIPTION
InteractionAutocompleteBuilder

The autocomplete interaction response builder object.

interaction_deferred_builder #

interaction_deferred_builder(
    type_: Union[ResponseType, int]
) -> InteractionDeferredBuilder

Create a builder for a deferred message interaction response.

PARAMETER DESCRIPTION
type

The type of deferred message response this builder is for.

TYPE: Union[ResponseType, int]

RETURNS DESCRIPTION
InteractionDeferredBuilder

The deferred message interaction response builder object.

interaction_message_builder #

interaction_message_builder(
    type_: Union[ResponseType, int]
) -> InteractionMessageBuilder

Create a builder for a message interaction response.

PARAMETER DESCRIPTION
type

The type of message response this builder is for.

TYPE: Union[ResponseType, int]

RETURNS DESCRIPTION
InteractionMessageBuilder

The interaction message response builder object.

interaction_modal_builder #

interaction_modal_builder(
    title: str, custom_id: str
) -> InteractionModalBuilder

Create a builder for a modal interaction response.

PARAMETER DESCRIPTION
title

The title that will show up in the modal.

TYPE: str

custom_id

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

TYPE: str

RETURNS DESCRIPTION
InteractionModalBuilder

The interaction modal response builder object.

join_thread async #

join_thread(channel: SnowflakeishOr[GuildTextChannel]) -> None

Join a thread channel.

PARAMETER DESCRIPTION
channel

Object or ID of the thread channel to join.

TYPE: SnowflakeishOr[GuildTextChannel]

RAISES DESCRIPTION
BadRequestError

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

ForbiddenError

If you cannot join this thread.

NotFoundError

If the thread channel does not exist.

UnauthorizedError

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

RateLimitTooLongError

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

InternalServerError

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

kick_member #

kick_member(
    guild: SnowflakeishOr[PartialGuild],
    user: SnowflakeishOr[PartialUser],
    *,
    reason: UndefinedOr[str] = undefined.UNDEFINED
) -> Coroutine[Any, Any, None]

kick_user async #

kick_user(
    guild: SnowflakeishOr[PartialGuild],
    user: SnowflakeishOr[PartialUser],
    *,
    reason: UndefinedOr[str] = undefined.UNDEFINED
) -> None

Kick a member from a guild.

PARAMETER DESCRIPTION
guild

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

TYPE: SnowflakeishOr[PartialGuild]

user

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

TYPE: SnowflakeishOr[PartialUser]

PARAMETER DESCRIPTION
reason

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

TYPE: UndefinedOr[str]

RAISES DESCRIPTION
ForbiddenError

If you are missing the hikari.permissions.Permissions.KICK_MEMBERS permission.

UnauthorizedError

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

NotFoundError

If the guild or user are not found.

RateLimitTooLongError

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

InternalServerError

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

leave_guild async #

leave_guild(guild: SnowflakeishOr[PartialGuild]) -> None

Leave a guild.

PARAMETER DESCRIPTION
guild

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

TYPE: SnowflakeishOr[PartialGuild]

RAISES DESCRIPTION
UnauthorizedError

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

NotFoundError

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

RateLimitTooLongError

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

InternalServerError

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

leave_thread async #

leave_thread(channel: SnowflakeishOr[GuildThreadChannel]) -> None

Leave a thread channel.

PARAMETER DESCRIPTION
channel

Object or ID of the thread channel to leave.

TYPE: SnowflakeishOr[GuildTextChannel]

RAISES DESCRIPTION
BadRequestError

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

NotFoundError

If you're not in the thread or it doesn't exist.

UnauthorizedError

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

RateLimitTooLongError

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

InternalServerError

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

pin_message async #

pin_message(
    channel: SnowflakeishOr[TextableChannel],
    message: SnowflakeishOr[PartialMessage],
) -> None

Pin an existing message in the given text channel.

PARAMETER DESCRIPTION
channel

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

TYPE: SnowflakeishOr[TextableChannel]

message

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

TYPE: SnowflakeishOr[PartialMessage]

RAISES DESCRIPTION
UnauthorizedError

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

ForbiddenError

If you are missing the hikari.permissions.Permissions.MANAGE_MESSAGES in the channel.

NotFoundError

If the channel is not found, or if the message does not exist in the given channel.

RateLimitTooLongError

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

InternalServerError

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

refresh_access_token async #

refresh_access_token(
    client: SnowflakeishOr[PartialApplication],
    client_secret: str,
    refresh_token: str,
    *,
    scopes: UndefinedOr[Sequence[Union[OAuth2Scope, str]]] = undefined.UNDEFINED
) -> OAuth2AuthorizationToken

Refresh an access token.

Warning

As of writing this Discord currently ignores any passed scopes, therefore you should use hikari.applications.OAuth2AuthorizationToken.scopes to validate that the expected scopes were actually authorized here.

PARAMETER DESCRIPTION
client

Object or ID of the application to authorize with.

TYPE: SnowflakeishOr[PartialApplication]

client_secret

Secret of the application to authorize with.

TYPE: str

refresh_token

The refresh token to use.

TYPE: str

PARAMETER DESCRIPTION
scopes

The scope of the access request.

TYPE: Sequence[Union[OAuth2Scope, str]]

RETURNS DESCRIPTION
OAuth2AuthorizationToken

Object of the authorized OAuth2 token.

RAISES DESCRIPTION
BadRequestError

If an invalid redirect uri or refresh_token is passed.

UnauthorizedError

When an client or client secret is passed.

RateLimitTooLongError

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

InternalServerError

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

remove_role_from_member async #

remove_role_from_member(
    guild: SnowflakeishOr[PartialGuild],
    user: SnowflakeishOr[PartialUser],
    role: SnowflakeishOr[PartialRole],
    *,
    reason: UndefinedOr[str] = undefined.UNDEFINED
) -> None

Remove a role from a member.

PARAMETER DESCRIPTION
guild

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

TYPE: SnowflakeishOr[PartialGuild]

user

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

TYPE: SnowflakeishOr[PartialUser]

role

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

TYPE: SnowflakeishOr[PartialRole]

PARAMETER DESCRIPTION
reason

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

TYPE: UndefinedOr[str]

RAISES DESCRIPTION
ForbiddenError

If you are missing the hikari.permissions.Permissions.MANAGE_ROLES permission.

UnauthorizedError

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

NotFoundError

If the guild, user or role are not found.

RateLimitTooLongError

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

InternalServerError

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

remove_thread_member async #

remove_thread_member(
    channel: SnowflakeishOr[GuildThreadChannel],
    user: SnowflakeishOr[PartialUser],
) -> None

Remove a user from a thread.

PARAMETER DESCRIPTION
channel

Object or ID of the thread channel to remove a user from.

TYPE: SnowflakeishOr[GuildTextChannel]

user

Object or ID of the user to remove from the thread.

TYPE: SnowflakeishOr[PartialUser]

RAISES DESCRIPTION
BadRequestError

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

ForbiddenError

If you cannot remove this user from the thread.

NotFoundError

If the thread channel or member doesn't exist.

UnauthorizedError

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

RateLimitTooLongError

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

InternalServerError

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

reposition_channels async #

reposition_channels(
    guild: SnowflakeishOr[PartialGuild],
    positions: Mapping[int, SnowflakeishOr[GuildChannel]],
) -> None

Reposition the channels in a guild.

PARAMETER DESCRIPTION
guild

The guild to reposition the channels in. This may be the object or the ID of an existing guild.

TYPE: SnowflakeishOr[PartialGuild]

positions

A mapping of of the object or the ID of an existing channel to the new position, relative to their parent category, if any.

TYPE: Mapping[int, SnowflakeishOr[GuildChannel]]

RAISES DESCRIPTION
ForbiddenError

If you are missing the hikari.permissions.Permissions.MANAGE_CHANNELS permission.

UnauthorizedError

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

NotFoundError

If the guild is not found.

RateLimitTooLongError

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

InternalServerError

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

reposition_roles async #

reposition_roles(
    guild: SnowflakeishOr[PartialGuild],
    positions: Mapping[int, SnowflakeishOr[PartialRole]],
) -> None

Reposition the roles in a guild.

PARAMETER DESCRIPTION
guild

The guild to reposition the roles in. This may be the object or the ID of an existing guild.

TYPE: SnowflakeishOr[PartialGuild]

positions

A mapping of the position to the role.

TYPE: Mapping[int, SnowflakeishOr[PartialRole]]

RAISES DESCRIPTION
ForbiddenError

If you are missing the hikari.permissions.Permissions.MANAGE_ROLES permission.

UnauthorizedError

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

NotFoundError

If the guild is not found.

RateLimitTooLongError

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

InternalServerError

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

revoke_access_token async #

revoke_access_token(
    client: SnowflakeishOr[PartialApplication],
    client_secret: str,
    token: Union[str, PartialOAuth2Token],
) -> None

Revoke an OAuth2 token.

PARAMETER DESCRIPTION
client

Object or ID of the application to authorize with.

TYPE: SnowflakeishOr[PartialApplication]

client_secret

Secret of the application to authorize with.

TYPE: str

token

Object or string of the access token to revoke.

TYPE: Union[str, PartialOAuth2Token]

RAISES DESCRIPTION
UnauthorizedError

When an client or client secret is passed.

RateLimitTooLongError

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

InternalServerError

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

search_members async #

search_members(
    guild: SnowflakeishOr[PartialGuild], name: str
) -> Sequence[Member]

Search the members in a guild by nickname and username.

Note

Unlike hikari.api.rest.RESTClient.fetch_members this endpoint isn't paginated and therefore will return all the members in one go rather than needing to be asynchronously iterated over.

PARAMETER DESCRIPTION
guild

The object or ID of the guild to search members in.

TYPE: SnowflakeishOr[PartialGuild]

name

The query to match username(s) and nickname(s) against.

TYPE: str

RETURNS DESCRIPTION
Sequence[Member]

A sequence of the members who matched the provided name.

RAISES DESCRIPTION
UnauthorizedError

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

NotFoundError

If the guild is not found.

RateLimitTooLongError

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

InternalServerError

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

set_application_command_permissions async #

set_application_command_permissions(
    application: SnowflakeishOr[PartialApplication],
    guild: SnowflakeishOr[PartialGuild],
    command: SnowflakeishOr[PartialCommand],
    permissions: Sequence[CommandPermission],
) -> GuildCommandPermissions

Set permissions for a specific command.

Note

This requires the access_token to have the hikari.applications.OAuth2Scope.APPLICATIONS_COMMANDS_PERMISSION_UPDATE scope enabled along with the authorization of a Bot which has hikari.permissions.Permissions.CREATE_INSTANT_INVITE permission within the target guild.

Note

This overwrites any previously set permissions.

PARAMETER DESCRIPTION
application

Object or ID of the application to set the command permissions for.

TYPE: SnowflakeishOr[PartialApplication]

guild

Object or ID of the guild to set the command permissions for.

TYPE: UndefinedOr[SnowflakeishOr[PartialGuild]]

command

Object or ID of the command to set the permissions for.

TYPE: SnowflakeishOr[PartialCommand]

permissions

Sequence of up to 10 of the permission objects to set.

TYPE: Sequence[CommandPermission]

RETURNS DESCRIPTION
GuildCommandPermissions

Object of the set permissions.

RAISES DESCRIPTION
ForbiddenError

If you cannot access the provided application's commands or guild.

NotFoundError

If the provided application or command isn't found.

UnauthorizedError

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

RateLimitTooLongError

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

InternalServerError

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

set_application_commands async #

set_application_commands(
    application: SnowflakeishOr[PartialApplication],
    commands: Sequence[CommandBuilder],
    guild: UndefinedOr[SnowflakeishOr[PartialGuild]] = undefined.UNDEFINED,
) -> Sequence[PartialCommand]

Set the commands for an application.

Warning

Any existing commands not included in the provided commands array will be deleted.

PARAMETER DESCRIPTION
application

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

TYPE: SnowflakeishOr[PartialApplication]

commands

A sequence of up to 100 initialised command builder objects of the commands to set for this the application.

TYPE: Sequence[CommandBuilder]

PARAMETER DESCRIPTION
guild

Object or ID of the specific guild to set the commands for. If left as hikari.undefined.UNDEFINED then this set the global commands rather than guild specific commands.

TYPE: hikari.undefined.UndefinedOr[hikari.snowflakes.SnowflakeishOr[hikari.guilds.PartialGuild]

RETURNS DESCRIPTION
Sequence[PartialCommand]

A sequence of the set command objects.

RAISES DESCRIPTION
ForbiddenError

If you cannot access the provided application's commands.

NotFoundError

If the provided application isn't found.

BadRequestError

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

UnauthorizedError

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

RateLimitTooLongError

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

InternalServerError

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

set_application_role_connection_metadata_records async #

set_application_role_connection_metadata_records(
    application: SnowflakeishOr[PartialApplication],
    records: Sequence[ApplicationRoleConnectionMetadataRecord],
) -> Sequence[ApplicationRoleConnectionMetadataRecord]

Set the application role connection metadata records.

Note

This requires the token to have the hikari.applications.OAuth2Scope.ROLE_CONNECTIONS_WRITE scope enabled.

PARAMETER DESCRIPTION
application

The application to set the application role connection metadata records for.

TYPE: SnowflakeishOr[PartialApplication]

records

The records to set for the application.

TYPE: Sequence[ApplicationRoleConnectionMetadataRecord]

RETURNS DESCRIPTION
Sequence[ApplicationRoleConnectionMetadataRecord]

The set application role connection metadata records.

RAISES DESCRIPTION
BadRequestError

If incorrect values are provided for the records.

UnauthorizedError

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

NotFoundError

If the application is not found.

RateLimitTooLongError

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

InternalServerError

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

set_my_user_application_role_connection async #

set_my_user_application_role_connection(
    application: SnowflakeishOr[PartialApplication],
    platform_name: UndefinedOr[str] = undefined.UNDEFINED,
    platform_username: UndefinedOr[str] = undefined.UNDEFINED,
    metadata: UndefinedOr[
        Mapping[str, Union[str, int, bool, datetime]]
    ] = undefined.UNDEFINED,
) -> OwnApplicationRoleConnection

Set the token's associated role connections.

Note

This requires the token to have the hikari.applications.OAuth2Scope.ROLE_CONNECTIONS_WRITE scope enabled.

PARAMETER DESCRIPTION
application

The application to set the application role connections for.

TYPE: SnowflakeishOr[PartialApplication]

PARAMETER DESCRIPTION
platform_name

If provided, the name of the platform that will be connected.

TYPE: UndefinedOr[str]

platform_username

If provided, the name of the user in the platform.

TYPE: UndefinedOr[str]

metadata

If provided, the role connection metadata.

Depending on the time of the previously created application role records through set_application_role_connection_metadata_records, this mapping should contain those keys to the valid type of the record:

- `INTEGER_X`: An [`int`][].
- `DATETIME_X`: A [`datetime.datetime`][] object.
- `BOOLEAN_X`: A [`bool`][].

TYPE: hikari.undefined.UndefinedOr[typing.Mapping[str, typing.Union[str, int, bool, datetime.datetime]]

RETURNS DESCRIPTION
OwnApplicationRoleConnection

The set role connection.

RAISES DESCRIPTION
BadRequestError

If incorrect values are provided or unknown keys are provided in the metadata.

UnauthorizedError

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

NotFoundError

If the application is not found.

RateLimitTooLongError

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

InternalServerError

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

slash_command_builder #

slash_command_builder(name: str, description: str) -> SlashCommandBuilder

Create a command builder to use in hikari.api.rest.RESTClient.set_application_commands.

PARAMETER DESCRIPTION
name

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

TYPE: str

description

The description to set for the command if this is a slash command. This should be inclusively between 1-100 characters in length.

TYPE: str

RETURNS DESCRIPTION
SlashCommandBuilder

The created command builder object.

start #

start() -> None

Start the HTTP client.

Note

This must be called within an active event loop.

RAISES DESCRIPTION
RuntimeError

If this is called in an environment without an active event loop.

sync_guild_template async #

sync_guild_template(
    guild: SnowflakeishOr[PartialGuild], template: Union[Template, str]
) -> Template

Create a guild template.

PARAMETER DESCRIPTION
guild

The guild to sync a template in.

TYPE: SnowflakeishOr[PartialGuild]

template

Object or code of the template to sync.

TYPE: Union[str, Template]

RETURNS DESCRIPTION
Template

The object of the synced template.

RAISES DESCRIPTION
ForbiddenError

If you are not part of the guild or are missing the hikari.permissions.Permissions.MANAGE_GUILD permission.

NotFoundError

If the guild or template is not found.

UnauthorizedError

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

RateLimitTooLongError

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

InternalServerError

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

trigger_typing #

trigger_typing(channel: SnowflakeishOr[TextableChannel]) -> TypingIndicator

Trigger typing in a text channel.

Note

The result of this call can be awaited to trigger typing once, or can be used as an async context manager to continually type until the context manager is left. Any errors documented below will happen then.

Examples:

    # Trigger typing just once.
    await rest.trigger_typing(channel)

    # Trigger typing repeatedly for 1 minute.
    async with rest.trigger_typing(channel):
        await asyncio.sleep(60)

Warning

Sending a message to the channel will cause the typing indicator to disappear until it is re-triggered.

PARAMETER DESCRIPTION
channel

The channel to trigger typing in. This may be the object or the ID of an existing channel.

TYPE: SnowflakeishOr[TextableChannel]

RETURNS DESCRIPTION
TypingIndicator

A typing indicator to use.

RAISES DESCRIPTION
UnauthorizedError

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

ForbiddenError

If you are missing the hikari.permissions.Permissions.SEND_MESSAGES in the channel.

NotFoundError

If the channel is not found.

RateLimitTooLongError

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

InternalServerError

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

unban_member #

unban_member(
    guild: SnowflakeishOr[PartialGuild],
    user: SnowflakeishOr[PartialUser],
    *,
    reason: UndefinedOr[str] = undefined.UNDEFINED
) -> Coroutine[Any, Any, None]

unban_user async #

unban_user(
    guild: SnowflakeishOr[PartialGuild],
    user: SnowflakeishOr[PartialUser],
    *,
    reason: UndefinedOr[str] = undefined.UNDEFINED
) -> None

Unban a member from a guild.

PARAMETER DESCRIPTION
guild

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

TYPE: SnowflakeishOr[PartialGuild]

user

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

TYPE: SnowflakeishOr[PartialUser]

PARAMETER DESCRIPTION
reason

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

TYPE: UndefinedOr[str]

RAISES DESCRIPTION
ForbiddenError

If you are missing the hikari.permissions.Permissions.BAN_MEMBERS permission.

UnauthorizedError

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

NotFoundError

If the guild or user are not found.

RateLimitTooLongError

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

InternalServerError

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

unpin_message async #

unpin_message(
    channel: SnowflakeishOr[TextableChannel],
    message: SnowflakeishOr[PartialMessage],
) -> None

Unpin a given message from a given text channel.

PARAMETER DESCRIPTION
channel

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

TYPE: SnowflakeishOr[TextableChannel]

message

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

TYPE: SnowflakeishOr[PartialMessage]

RAISES DESCRIPTION
UnauthorizedError

If you are unauthorized to make the request (invalid/missing token).

ForbiddenError

If you are missing the hikari.permissions.Permissions.MANAGE_MESSAGES permission.

NotFoundError

If the channel is not found or the message is not a pinned message in the given channel.

RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

InternalServerError

If an internal error occurs on Discord while handling the request.