Skip to content

hikari.templates#

Application and entities that are used to describe guild templates on Discord.

Template #

Represents a template used for creating guilds.

app class-attribute instance-attribute #

app: RESTAware = field(
    repr=False, eq=False, hash=False, metadata={SKIP_DEEP_COPY: True}
)

Client application that models may use for procedures.

code class-attribute instance-attribute #

code: str = field(hash=True, repr=True)

The template's unique ID.

created_at class-attribute instance-attribute #

created_at: datetime = field(eq=False, hash=False, repr=True)

When the template was created.

creator class-attribute instance-attribute #

creator: User = field(eq=False, hash=False, repr=False)

The user who created the template.

description class-attribute instance-attribute #

description: Optional[str] = field(eq=False, hash=False, repr=False)

The template's description.

is_unsynced class-attribute instance-attribute #

is_unsynced: bool = field(eq=False, hash=False, repr=False)

Whether this template is missing changes from it's source guild.

name class-attribute instance-attribute #

name: str = field(eq=False, hash=False, repr=True)

The template's name.

source_guild class-attribute instance-attribute #

source_guild: TemplateGuild = field(eq=False, hash=False, repr=True)

The partial object of the guild this template is based on.

updated_at class-attribute instance-attribute #

updated_at: datetime = field(eq=False, hash=False, repr=True)

When the template was last synced with the source guild.

usage_count class-attribute instance-attribute #

usage_count: int = field(eq=False, hash=False, repr=True)

The number of times the template has been used to create a guild.

create_guild async #

create_guild(name: str, *, icon: UndefinedOr[str]) -> RESTGuild

Make a guild from a template.

Note

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

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

delete async #

delete() -> None

Delete a guild 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 async #

edit(
    *,
    name: UndefinedOr[str] = undefined.UNDEFINED,
    description: UndefinedNoneOr[str] = undefined.UNDEFINED
) -> Template

Modify a guild template.

PARAMETER DESCRIPTION
name

The name to set for this template.

TYPE: UndefinedOr[str] DEFAULT: UNDEFINED

description

The description to set for the template.

TYPE: UndefinedNoneOr[str] DEFAULT: UNDEFINED

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.

fetch_self async #

fetch_self() -> Template

Fetch an up-to-date view of this template from the API.

RETURNS DESCRIPTION
Template

An up-to-date view of this template.

RAISES DESCRIPTION
UnauthorizedError

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

NotFoundError

If the template 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.

sync async #

sync() -> Template

Sync a guild 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.

TemplateGuild #

Bases: PartialGuild

The partial guild object attached to hikari.templates.Template.

afk_channel_id class-attribute instance-attribute #

afk_channel_id: Optional[Snowflake] = field(eq=False, hash=False, repr=False)

The ID for the channel that AFK voice users get sent to.

If None, then no AFK channel is set up for this guild.

afk_timeout class-attribute instance-attribute #

afk_timeout: timedelta = field(eq=False, hash=False, repr=False)

Timeout for activity before a member is classed as AFK.

How long a voice user has to be AFK for before they are classed as being AFK and are moved to the AFK channel (hikari.guilds.Guild.afk_channel_id).

app class-attribute instance-attribute #

app: RESTAware = field(
    repr=False, eq=False, hash=False, metadata={SKIP_DEEP_COPY: True}
)

Client application that models may use for procedures.

channels class-attribute instance-attribute #

channels: Mapping[Snowflake, GuildChannel] = field(
    eq=False, hash=False, repr=False
)

The channels for the guild.

Note

hikari.channels.GuildChannel.id will be a unique placeholder on all the channel objects found attached this template guild.

created_at property #

created_at: datetime

When the object was created.

default_message_notifications class-attribute instance-attribute #

default_message_notifications: Union[GuildMessageNotificationsLevel, int] = (
    field(eq=False, hash=False, repr=False)
)

The default setting for message notifications in this guild.

description class-attribute instance-attribute #

description: Optional[str] = field(eq=False, hash=False, repr=False)

The guild's description, if set.

explicit_content_filter class-attribute instance-attribute #

explicit_content_filter: Union[GuildExplicitContentFilterLevel, int] = field(
    eq=False, hash=False, repr=False
)

The setting for the explicit content filter in this guild.

icon_hash class-attribute instance-attribute #

icon_hash: Optional[str] = field(eq=False, hash=False, repr=False)

The hash for the guild icon, if there is one.

icon_url property #

icon_url: Optional[URL]

Icon URL for the guild, if set; otherwise None.

id class-attribute instance-attribute #

id: Snowflake = field(hash=True, repr=True)

The ID of this entity.

name class-attribute instance-attribute #

name: str = field(eq=False, hash=False, repr=True)

The name of the guild.

preferred_locale class-attribute instance-attribute #

preferred_locale: str = field(eq=False, hash=False, repr=False)

The preferred locale to use for this guild.

This can only be change if hikari.guilds.GuildFeature.COMMUNITY is in hikari.guilds.Guild.features for this guild and will otherwise default to en-US.

roles class-attribute instance-attribute #

roles: Mapping[Snowflake, TemplateRole] = field(
    eq=False, hash=False, repr=False
)

The roles in the guild.

Note

hikari.guilds.Role.id will be a unique placeholder on all the role objects found attached this template guild.

shard_id property #

shard_id: Optional[int]

Return the ID of the shard this guild is served by.

This may return None if the application does not have a gateway connection.

system_channel_flags class-attribute instance-attribute #

system_channel_flags: GuildSystemChannelFlag = field(
    eq=False, hash=False, repr=False
)

Return flags for the guild system channel.

These are used to describe which notifications are suppressed.

system_channel_id class-attribute instance-attribute #

system_channel_id: Optional[Snowflake] = field(eq=False, hash=False, repr=False)

The ID of the system channel or None if it is not enabled.

Welcome messages and Nitro boost messages may be sent to this channel.

verification_level class-attribute instance-attribute #

verification_level: Union[GuildVerificationLevel, int] = field(
    eq=False, hash=False, repr=False
)

The verification level needed for a user to participate in this guild.

ban async #

ban(
    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
user

The user to ban from the guild.

TYPE: Snowflakeish[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.

create_category async #

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

Create a category in the guild.

PARAMETER DESCRIPTION
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_forum_channel async #

create_forum_channel(
    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 the guild.

PARAMETER DESCRIPTION
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_news_channel async #

create_news_channel(
    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,
    reason: UndefinedOr[str] = undefined.UNDEFINED
) -> GuildNewsChannel

Create a news channel in the guild.

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

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_stage_channel async #

create_stage_channel(
    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 the guild.

PARAMETER DESCRIPTION
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_sticker async #

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

Create a sticker in a guild.

Note

Lottie support is only available for verified and partnered servers.

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

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_text_channel async #

create_text_channel(
    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,
    reason: UndefinedOr[str] = undefined.UNDEFINED
) -> GuildTextChannel

Create a text channel in the guild.

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

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_voice_channel async #

create_voice_channel(
    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
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 gui ld 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_channel async #

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

Delete a channel in the guild.

Note

This method can also be used for deleting guild categories as well.

Note

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

PARAMETER DESCRIPTION
channel

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

TYPE: SnowflakeishOr[GuildChannel]

RETURNS DESCRIPTION
GuildChannel

Object of the channel or category that was deleted.

RAISES DESCRIPTION
hikari.errors.UnauthorizedError, or close a DM.

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_sticker async #

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

Delete a sticker in a guild.

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

edit async #

edit(
    *,
    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[GuildFeature]] = undefined.UNDEFINED,
    reason: UndefinedOr[str] = undefined.UNDEFINED
) -> RESTGuild

Edit the guild.

PARAMETER DESCRIPTION
name

If provided, the new name for the guild.

TYPE: UndefinedOr[str] DEFAULT: UNDEFINED

verification_level

If provided, the new verification level.

TYPE: UndefinedOr[GuildVerificationLevel] DEFAULT: UNDEFINED

default_message_notifications

If provided, the new default message notifications level.

TYPE: UndefinedOr[GuildMessageNotificationsLevel] DEFAULT: UNDEFINED

explicit_content_filter_level

If provided, the new explicit content filter level.

TYPE: UndefinedOr[GuildExplicitContentFilterLevel] DEFAULT: UNDEFINED

afk_channel

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

TYPE: UndefinedOr[SnowflakeishOr[GuildVoiceChannel]] DEFAULT: UNDEFINED

afk_timeout

If provided, the new afk timeout.

TYPE: UndefinedOr[Intervalish] DEFAULT: UNDEFINED

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] DEFAULT: UNDEFINED

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]]] DEFAULT: UNDEFINED

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] DEFAULT: UNDEFINED

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] DEFAULT: UNDEFINED

system_channel

If provided, the new system channel.

TYPE: UndefinedNoneOr[SnowflakeishOr[GuildTextChannel]] DEFAULT: UNDEFINED

rules_channel

If provided, the new rules channel.

TYPE: UndefinedNoneOr[SnowflakeishOr[GuildTextChannel]] DEFAULT: UNDEFINED

public_updates_channel

If provided, the new public updates channel.

TYPE: UndefinedNoneOr[SnowflakeishOr[GuildTextChannel]] DEFAULT: UNDEFINED

preferred_locale

If provided, the new preferred locale.

TYPE: UndefinedNoneOr[str] DEFAULT: UNDEFINED

features

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

TYPE: UndefinedOr[Sequence[GuildFeatures]] DEFAULT: UNDEFINED

reason

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

TYPE: UndefinedOr[str] DEFAULT: UNDEFINED

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_sticker async #

edit_sticker(
    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
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.

fetch_emoji async #

Fetch an emoji from the guild.

PARAMETER DESCRIPTION
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_emojis async #

fetch_emojis() -> Sequence[KnownCustomEmoji]

Fetch the emojis of the guild.

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_roles async #

fetch_roles() -> Sequence[Role]

Fetch the roles of the guild.

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_self async #

fetch_self() -> RESTGuild

Fetch the guild.

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_sticker async #

fetch_sticker(sticker: SnowflakeishOr[PartialSticker]) -> GuildSticker

Fetch a sticker from the guild.

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
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_stickers async #

fetch_stickers() -> Sequence[GuildSticker]

Fetch the stickers of the guild.

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.

kick async #

kick(
    user: SnowflakeishOr[PartialUser],
    *,
    reason: UndefinedOr[str] = undefined.UNDEFINED
) -> None

Kick the given user from this guild.

PARAMETER DESCRIPTION
user

The user to kick from the guild.

TYPE: Snowflakeish[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
BadRequestError

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

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.

make_icon_url #

make_icon_url(*, ext: Optional[str] = None, size: int = 4096) -> Optional[URL]

Generate the guild's icon URL, if set.

PARAMETER DESCRIPTION
ext

The extension to use for this URL. Supports png, jpeg, jpg, webp and gif (when animated).

If None, then the correct default extension is determined based on whether the icon is animated or not.

TYPE: Optional[str] DEFAULT: None

size

The size to set for the URL. Can be any power of two between 16 and 4096.

TYPE: int DEFAULT: 4096

RETURNS DESCRIPTION
Optional[URL]

The URL to the resource, or None if no icon is set.

RAISES DESCRIPTION
ValueError

If size is not a power of two or not between 16 and 4096.

unban async #

unban(
    user: SnowflakeishOr[PartialUser],
    *,
    reason: UndefinedOr[str] = undefined.UNDEFINED
) -> None

Unban the given user from this guild.

PARAMETER DESCRIPTION
user

The user to unban from the guild.

TYPE: Snowflakeish[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
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.

TemplateRole #

Bases: PartialRole

The partial role object attached to hikari.templates.Template.

app class-attribute instance-attribute #

app: RESTAware = field(
    repr=False, eq=False, hash=False, metadata={SKIP_DEEP_COPY: True}
)

Client application that models may use for procedures.

color class-attribute instance-attribute #

color: Color = field(eq=False, hash=False, repr=True)

The colour of this role.

This will be applied to a member's name in chat if it's their top coloured role.

created_at property #

created_at: datetime

When the object was created.

id class-attribute instance-attribute #

id: Snowflake = field(hash=True, repr=True)

The ID of this entity.

is_hoisted class-attribute instance-attribute #

is_hoisted: bool = field(eq=False, hash=False, repr=True)

Whether this role is hoisting the members it's attached to in the member list.

members will be hoisted under their highest role where this is set to True.

is_mentionable class-attribute instance-attribute #

is_mentionable: bool = field(eq=False, hash=False, repr=False)

Whether this role can be mentioned by all regardless of permissions.

mention property #

mention: str

Return a raw mention string for the role.

name class-attribute instance-attribute #

name: str = field(eq=False, hash=False, repr=True)

The role's name.

permissions class-attribute instance-attribute #

permissions: Permissions = field(eq=False, hash=False, repr=False)

The guild wide permissions this role gives to the members it's attached to.

This may be overridden by channel overwrites.