hikari.templates#
Application and entities that are used to describe guild templates on Discord.
Module Contents#
- class hikari.templates.Template[source]#
Represents a template used for creating guilds.
- app: hikari.traits.RESTAware[source]#
Client application that models may use for procedures.
- created_at: datetime.datetime[source]#
When the template was created.
- creator: hikari.users.User[source]#
The user who created the template.
- source_guild: TemplateGuild[source]#
The partial object of the guild this template is based on.
- updated_at: datetime.datetime[source]#
When the template was last synced with the source guild.
- async create_guild(name, *, icon)[source]#
Make a guild from a template.
Note
This endpoint can only be used by bots in less than 10 guilds.
- Parameters:
- name
str
The new guilds name.
- name
- Other Parameters:
- icon
hikari.undefined.UndefinedOr
[hikari.files.Resourceish
] If provided, the guild icon to set. Must be a 1024x1024 image or can be an animated gif when the guild has the ANIMATED_ICON feature.
- icon
- Returns:
hikari.guilds.RESTGuild
Object of the created guild.
- Raises:
hikari.errors.BadRequestError
If any of the fields that are passed have an invalid value or if you call this as a bot that’s in more than 10 guilds.
hikari.errors.UnauthorizedError
If you are unauthorized to make the request (invalid/missing token).
hikari.errors.RateLimitTooLongError
Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.
hikari.errors.InternalServerError
If an internal error occurs on Discord while handling the request.
- async delete()[source]#
Delete a guild template.
- Raises:
hikari.errors.ForbiddenError
If you are not part of the guild.
hikari.errors.NotFoundError
If the guild is not found or you are missing the
MANAGE_GUILD
permission.hikari.errors.UnauthorizedError
If you are unauthorized to make the request (invalid/missing token).
hikari.errors.RateLimitTooLongError
Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.
hikari.errors.InternalServerError
If an internal error occurs on Discord while handling the request.
- async edit(*, name=undefined.UNDEFINED, description=undefined.UNDEFINED)[source]#
Modify a guild template.
- Parameters:
- name
hikari.undefined.UndefinedOr
[str
] The name to set for this template.
- description
hikari.undefined.UndefinedNoneOr
[str
] The description to set for the template.
- name
- Returns:
hikari.templates.Template
The object of the edited template.
- Raises:
hikari.errors.ForbiddenError
If you are not part of the guild.
hikari.errors.NotFoundError
If the guild is not found or you are missing the
MANAGE_GUILD
permission.hikari.errors.UnauthorizedError
If you are unauthorized to make the request (invalid/missing token).
hikari.errors.RateLimitTooLongError
Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.
hikari.errors.InternalServerError
If an internal error occurs on Discord while handling the request.
- async fetch_self()[source]#
Fetch an up-to-date view of this template from the API.
- Returns:
hikari.templates.Template
An up-to-date view of this template.
- Raises:
hikari.errors.UnauthorizedError
If you are unauthorized to make the request (invalid/missing token).
hikari.errors.NotFoundError
If the template is not found.
hikari.errors.RateLimitTooLongError
Raised in the event that a rate limit occurs that is longer than
max_rate_limit
when making a request.hikari.errors.InternalServerError
If an internal error occurs on Discord while handling the request.
- async sync()[source]#
Sync a guild template.
- Returns:
hikari.templates.Template
The object of the synced template.
- Raises:
hikari.errors.ForbiddenError
If you are not part of the guild or are missing the
MANAGE_GUILD
permission.hikari.errors.NotFoundError
If the guild or template is not found.
hikari.errors.UnauthorizedError
If you are unauthorized to make the request (invalid/missing token).
hikari.errors.RateLimitTooLongError
Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.
hikari.errors.InternalServerError
If an internal error occurs on Discord while handling the request.
- class hikari.templates.TemplateGuild[source]#
Bases:
hikari.guilds.PartialGuild
The partial guild object attached to
Template
.- afk_channel_id: hikari.snowflakes.Snowflake | None[source]#
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: datetime.timedelta[source]#
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 (
Guild.afk_channel_id
).
- channels: Mapping[hikari.snowflakes.Snowflake, hikari.channels.GuildChannel][source]#
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: hikari.guilds.GuildMessageNotificationsLevel | int[source]#
The default setting for message notifications in this guild.
- explicit_content_filter: hikari.guilds.GuildExplicitContentFilterLevel | int[source]#
The setting for the explicit content filter in this guild.
- preferred_locale: str[source]#
The preferred locale to use for this guild.
This can only be change if
GuildFeature.COMMUNITY
is inGuild.features
for this guild and will otherwise default toen-US
.
- roles: Mapping[hikari.snowflakes.Snowflake, TemplateRole][source]#
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: hikari.guilds.GuildSystemChannelFlag[source]#
Return flags for the guild system channel.
These are used to describe which notifications are suppressed.
- system_channel_id: hikari.snowflakes.Snowflake | None[source]#
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: hikari.guilds.GuildVerificationLevel | int[source]#
The verification level needed for a user to participate in this guild.
- class hikari.templates.TemplateRole[source]#
Bases:
hikari.guilds.PartialRole
The partial role object attached to
Template
.- color: hikari.colors.Color[source]#
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: bool[source]#
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
.
- permissions: hikari.permissions.Permissions[source]#
The guild wide permissions this role gives to the members it’s attached to.
This may be overridden by channel overwrites.