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

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[str]

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

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.

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.

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.

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.

TemplateRole #

Bases: PartialRole

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

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.

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.

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.