hikari.templates
Application and entities that are used to describe guild templates on Discord.
View Source
# -*- coding: utf-8 -*- # cython: language_level=3 # Copyright (c) 2020 Nekokatt # Copyright (c) 2021-present davfsa # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell # copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in all # copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. """Application and entities that are used to describe guild templates on Discord.""" from __future__ import annotations __all__: typing.Sequence[str] = ("Template", "TemplateGuild", "TemplateRole") import typing import attr from hikari import guilds from hikari.internal import attr_extensions if typing.TYPE_CHECKING: import datetime from hikari import channels as channels_ from hikari import colors from hikari import permissions as permissions_ from hikari import snowflakes from hikari import users @attr_extensions.with_copy @attr.define(hash=True, kw_only=True, weakref_slot=False) class TemplateRole(guilds.PartialRole): """The partial role object attached to `Template`.""" permissions: permissions_.Permissions = attr.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. """ color: colors.Color = attr.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: bool = attr.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: bool = attr.field(eq=False, hash=False, repr=False) """Whether this role can be mentioned by all regardless of permissions.""" @attr_extensions.with_copy @attr.define(hash=True, kw_only=True, weakref_slot=False) class TemplateGuild(guilds.PartialGuild): """The partial guild object attached to `Template`.""" description: typing.Optional[str] = attr.field(eq=False, hash=False, repr=False) """The guild's description, if set.""" verification_level: typing.Union[guilds.GuildVerificationLevel, int] = attr.field(eq=False, hash=False, repr=False) """The verification level needed for a user to participate in this guild.""" default_message_notifications: typing.Union[guilds.GuildMessageNotificationsLevel, int] = attr.field( eq=False, hash=False, repr=False ) """The default setting for message notifications in this guild.""" explicit_content_filter: typing.Union[guilds.GuildExplicitContentFilterLevel, int] = attr.field( eq=False, hash=False, repr=False ) """The setting for the explicit content filter in this guild.""" preferred_locale: str = attr.field(eq=False, hash=False, repr=False) """The preferred locale to use for this guild. This can only be change if `GuildFeature.COMMUNITY` is in `Guild.features` for this guild and will otherwise default to `en-US`. """ afk_timeout: datetime.timedelta = attr.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 (`Guild.afk_channel_id`). """ roles: typing.Mapping[snowflakes.Snowflake, TemplateRole] = attr.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. """ channels: typing.Mapping[snowflakes.Snowflake, channels_.GuildChannel] = attr.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. """ afk_channel_id: typing.Optional[snowflakes.Snowflake] = attr.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. """ system_channel_id: typing.Optional[snowflakes.Snowflake] = attr.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. """ system_channel_flags: guilds.GuildSystemChannelFlag = attr.field(eq=False, hash=False, repr=False) """Return flags for the guild system channel. These are used to describe which notifications are suppressed. """ @attr_extensions.with_copy @attr.define(hash=True, kw_only=True, weakref_slot=False) class Template: """Represents a template used for creating guilds.""" code: str = attr.field(hash=True, repr=True) """The template's unique ID.""" name: str = attr.field(eq=False, hash=False, repr=True) """The template's name.""" description: typing.Optional[str] = attr.field(eq=False, hash=False, repr=False) """The template's description.""" usage_count: int = attr.field(eq=False, hash=False, repr=True) """The number of times the template has been used to create a guild.""" creator: users.User = attr.field(eq=False, hash=False, repr=False) """The user who created the template.""" created_at: datetime.datetime = attr.field(eq=False, hash=False, repr=True) """When the template was created.""" updated_at: datetime.datetime = attr.field(eq=False, hash=False, repr=True) """When the template was last synced with the source guild.""" source_guild: TemplateGuild = attr.field(eq=False, hash=False, repr=True) """The partial object of the guild this template is based on.""" is_unsynced: bool = attr.field(eq=False, hash=False, repr=False) """Whether this template is missing changes from it's source guild.""" def __str__(self) -> str: return f"https://discord.new/{self.code}"
View Source
@attr_extensions.with_copy @attr.define(hash=True, kw_only=True, weakref_slot=False) class Template: """Represents a template used for creating guilds.""" code: str = attr.field(hash=True, repr=True) """The template's unique ID.""" name: str = attr.field(eq=False, hash=False, repr=True) """The template's name.""" description: typing.Optional[str] = attr.field(eq=False, hash=False, repr=False) """The template's description.""" usage_count: int = attr.field(eq=False, hash=False, repr=True) """The number of times the template has been used to create a guild.""" creator: users.User = attr.field(eq=False, hash=False, repr=False) """The user who created the template.""" created_at: datetime.datetime = attr.field(eq=False, hash=False, repr=True) """When the template was created.""" updated_at: datetime.datetime = attr.field(eq=False, hash=False, repr=True) """When the template was last synced with the source guild.""" source_guild: TemplateGuild = attr.field(eq=False, hash=False, repr=True) """The partial object of the guild this template is based on.""" is_unsynced: bool = attr.field(eq=False, hash=False, repr=False) """Whether this template is missing changes from it's source guild.""" def __str__(self) -> str: return f"https://discord.new/{self.code}"
Represents a template used for creating guilds.
Variables and properties
The template's unique ID.
When the template was created.
The user who created the template.
The template's description.
Whether this template is missing changes from it's source guild.
The template's name.
The partial object of the guild this template is based on.
When the template was last synced with the source guild.
The number of times the template has been used to create a guild.
Methods
self,
*,
code: str,
name: str,
description: Optional[str],
usage_count: int,
creator: hikari.users.User,
created_at: datetime.datetime,
updated_at: datetime.datetime,
source_guild: hikari.templates.TemplateGuild,
is_unsynced: bool
):
View Source
def __init__(self, *, code, name, description, usage_count, creator, created_at, updated_at, source_guild, is_unsynced): self.code = code self.name = name self.description = description self.usage_count = usage_count self.creator = creator self.created_at = created_at self.updated_at = updated_at self.source_guild = source_guild self.is_unsynced = is_unsynced
Method generated by attrs for class Template.
View Source
@attr_extensions.with_copy @attr.define(hash=True, kw_only=True, weakref_slot=False) class TemplateGuild(guilds.PartialGuild): """The partial guild object attached to `Template`.""" description: typing.Optional[str] = attr.field(eq=False, hash=False, repr=False) """The guild's description, if set.""" verification_level: typing.Union[guilds.GuildVerificationLevel, int] = attr.field(eq=False, hash=False, repr=False) """The verification level needed for a user to participate in this guild.""" default_message_notifications: typing.Union[guilds.GuildMessageNotificationsLevel, int] = attr.field( eq=False, hash=False, repr=False ) """The default setting for message notifications in this guild.""" explicit_content_filter: typing.Union[guilds.GuildExplicitContentFilterLevel, int] = attr.field( eq=False, hash=False, repr=False ) """The setting for the explicit content filter in this guild.""" preferred_locale: str = attr.field(eq=False, hash=False, repr=False) """The preferred locale to use for this guild. This can only be change if `GuildFeature.COMMUNITY` is in `Guild.features` for this guild and will otherwise default to `en-US`. """ afk_timeout: datetime.timedelta = attr.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 (`Guild.afk_channel_id`). """ roles: typing.Mapping[snowflakes.Snowflake, TemplateRole] = attr.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. """ channels: typing.Mapping[snowflakes.Snowflake, channels_.GuildChannel] = attr.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. """ afk_channel_id: typing.Optional[snowflakes.Snowflake] = attr.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. """ system_channel_id: typing.Optional[snowflakes.Snowflake] = attr.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. """ system_channel_flags: guilds.GuildSystemChannelFlag = attr.field(eq=False, hash=False, repr=False) """Return flags for the guild system channel. These are used to describe which notifications are suppressed. """
The partial guild object attached to Template
.
Variables and properties
The ID for the channel that AFK voice users get sent to.
If None
, then no AFK channel is set up for this guild.
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
).
The client application that models may use for procedures.
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.
When the object was created.
The default setting for message notifications in this guild.
The guild's description, if set.
The setting for the explicit content filter in this guild.
The hash for the guild icon, if there is one.
Icon URL for the guild, if set; otherwise None
.
The ID of this entity.
The name of the guild.
The preferred locale to use for this guild.
This can only be change if GuildFeature.COMMUNITY
is in Guild.features
for this guild and will otherwise default to en-US
.
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.
Return the ID of the shard this guild is served by.
This may return None
if the application does not have a gateway connection.
Return flags for the guild system channel.
These are used to describe which notifications are suppressed.
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.
The verification level needed for a user to participate in this guild.
Methods
self,
*,
app: 'traits.RESTAware',
id: hikari.snowflakes.Snowflake,
icon_hash: Optional[str],
name: str,
description: Optional[str],
verification_level: Union[hikari.guilds.GuildVerificationLevel, int],
default_message_notifications: Union[hikari.guilds.GuildMessageNotificationsLevel, int],
explicit_content_filter: Union[hikari.guilds.GuildExplicitContentFilterLevel, int],
preferred_locale: str,
afk_timeout: datetime.timedelta,
roles: Mapping[hikari.snowflakes.Snowflake, hikari.templates.TemplateRole],
channels: Mapping[hikari.snowflakes.Snowflake, hikari.channels.GuildChannel],
afk_channel_id: Optional[hikari.snowflakes.Snowflake],
system_channel_id: Optional[hikari.snowflakes.Snowflake],
system_channel_flags: hikari.guilds.GuildSystemChannelFlag
):
View Source
def __init__(self, *, app, id, icon_hash, name, description, verification_level, default_message_notifications, explicit_content_filter, preferred_locale, afk_timeout, roles, channels, afk_channel_id, system_channel_id, system_channel_flags): self.app = app self.id = id self.icon_hash = icon_hash self.name = name self.description = description self.verification_level = verification_level self.default_message_notifications = default_message_notifications self.explicit_content_filter = explicit_content_filter self.preferred_locale = preferred_locale self.afk_timeout = afk_timeout self.roles = roles self.channels = channels self.afk_channel_id = afk_channel_id self.system_channel_id = system_channel_id self.system_channel_flags = system_channel_flags
Method generated by attrs for class TemplateGuild.
self,
user: Union[hikari.users.PartialUser, hikari.snowflakes.Snowflake, int],
*,
delete_message_days: Union[int, hikari.undefined.UndefinedType] = UNDEFINED,
reason: Union[str, hikari.undefined.UndefinedType] = UNDEFINED
) -> None:
View Source
async def ban( self, user: snowflakes.SnowflakeishOr[users.PartialUser], *, delete_message_days: undefined.UndefinedOr[int] = undefined.UNDEFINED, reason: undefined.UndefinedOr[str] = undefined.UNDEFINED, ) -> None: """Ban the given user from this guild. Parameters ---------- user: hikari.snowflakes.Snowflakeish[hikari.users.PartialUser] The user to ban from the guild Other Parameters ---------------- delete_message_days : hikari.undefined.UndefinedNoneOr[int] If provided, the number of days to delete messages for. This must be between 0 and 7. reason : hikari.undefined.UndefinedOr[str] If provided, the reason that will be recorded in the audit logs. Maximum of 512 characters. Raises ------ hikari.errors.BadRequestError If any of the fields that are passed have an invalid value. hikari.errors.ForbiddenError If you are missing the `BAN_MEMBERS` permission. hikari.errors.UnauthorizedError If you are unauthorized to make the request (invalid/missing token). hikari.errors.NotFoundError If the guild or user are not found. hikari.errors.RateLimitTooLongError Raised in the event that a rate limit occurs that is longer than `max_rate_limit` when making a request. hikari.errors.RateLimitedError Usually, Hikari will handle and retry on hitting rate-limits automatically. This includes most bucket-specific rate-limits and global rate-limits. In some rare edge cases, however, Discord implements other undocumented rules for rate-limiting, such as limits per attribute. These cannot be detected or handled normally by Hikari due to their undocumented nature, and will trigger this exception if they occur. hikari.errors.InternalServerError If an internal error occurs on Discord while handling the request. """ await self.app.rest.ban_user(self.id, user, delete_message_days=delete_message_days, reason=reason)
Ban the given user from this guild.
Parameters
- user (hikari.snowflakes.Snowflakeish[hikari.users.PartialUser]): The user to ban from the guild
Other Parameters
- delete_message_days (hikari.undefined.UndefinedNoneOr[int]): If provided, the number of days to delete messages for. This must be between 0 and 7.
- reason (hikari.undefined.UndefinedOr[str]): If provided, the reason that will be recorded in the audit logs. Maximum of 512 characters.
Raises
- hikari.errors.BadRequestError: If any of the fields that are passed have an invalid value.
- hikari.errors.ForbiddenError: If you are missing the
BAN_MEMBERS
permission. - hikari.errors.UnauthorizedError: If you are unauthorized to make the request (invalid/missing token).
- hikari.errors.NotFoundError: If the guild or user are not found.
- hikari.errors.RateLimitTooLongError: Raised in the event that a rate limit occurs that is longer than
max_rate_limit
when making a request. - hikari.errors.RateLimitedError: Usually, Hikari will handle and retry on hitting rate-limits automatically. This includes most bucket-specific rate-limits and global rate-limits. In some rare edge cases, however, Discord implements other undocumented rules for rate-limiting, such as limits per attribute. These cannot be detected or handled normally by Hikari due to their undocumented nature, and will trigger this exception if they occur.
- hikari.errors.InternalServerError: If an internal error occurs on Discord while handling the request.
self,
name: str,
*,
position: Union[int, hikari.undefined.UndefinedType] = UNDEFINED,
permission_overwrites: Union[Sequence[hikari.channels.PermissionOverwrite], hikari.undefined.UndefinedType] = UNDEFINED,
reason: Union[str, hikari.undefined.UndefinedType] = UNDEFINED
) -> hikari.channels.GuildCategory:
View Source
async def create_category( self, name: str, *, position: undefined.UndefinedOr[int] = undefined.UNDEFINED, permission_overwrites: undefined.UndefinedOr[ typing.Sequence[channels_.PermissionOverwrite] ] = undefined.UNDEFINED, reason: undefined.UndefinedOr[str] = undefined.UNDEFINED, ) -> channels_.GuildCategory: """Create a category in the guild. Parameters ---------- name : str The channels name. Must be between 2 and 1000 characters. Other Parameters ---------------- position : hikari.undefined.UndefinedOr[int] If provided, the position of the category. permission_overwrites : hikari.undefined.UndefinedOr[typing.Sequence[hikari.channels.PermissionOverwrite]] If provided, the permission overwrites for the category. reason : hikari.undefined.UndefinedOr[str] If provided, the reason that will be recorded in the audit logs. Maximum of 512 characters. Returns ------- hikari.channels.GuildCategory The created category. Raises ------ hikari.errors.BadRequestError If any of the fields that are passed have an invalid value. hikari.errors.ForbiddenError If you are missing the `MANAGE_CHANNEL` permission. hikari.errors.UnauthorizedError If you are unauthorized to make the request (invalid/missing token). hikari.errors.NotFoundError If the guild is not found. hikari.errors.RateLimitTooLongError Raised in the event that a rate limit occurs that is longer than `max_rate_limit` when making a request. hikari.errors.RateLimitedError Usually, Hikari will handle and retry on hitting rate-limits automatically. This includes most bucket-specific rate-limits and global rate-limits. In some rare edge cases, however, Discord implements other undocumented rules for rate-limiting, such as limits per attribute. These cannot be detected or handled normally by Hikari due to their undocumented nature, and will trigger this exception if they occur. hikari.errors.InternalServerError If an internal error occurs on Discord while handling the request. """ return await self.app.rest.create_guild_category( self.id, name, position=position, permission_overwrites=permission_overwrites, reason=reason )
Create a category in the guild.
Parameters
- name (str): The channels name. Must be between 2 and 1000 characters.
Other Parameters
- position (hikari.undefined.UndefinedOr[int]): If provided, the position of the category.
- permission_overwrites (hikari.undefined.UndefinedOr[typing.Sequence[hikari.channels.PermissionOverwrite]]): If provided, the permission overwrites for the category.
- reason (hikari.undefined.UndefinedOr[str]): If provided, the reason that will be recorded in the audit logs. Maximum of 512 characters.
Returns
- hikari.channels.GuildCategory: The created category.
Raises
- hikari.errors.BadRequestError: If any of the fields that are passed have an invalid value.
- hikari.errors.ForbiddenError: If you are missing the
MANAGE_CHANNEL
permission. - hikari.errors.UnauthorizedError: If you are unauthorized to make the request (invalid/missing token).
- hikari.errors.NotFoundError: If the guild is not found.
- hikari.errors.RateLimitTooLongError: Raised in the event that a rate limit occurs that is longer than
max_rate_limit
when making a request. - hikari.errors.RateLimitedError: Usually, Hikari will handle and retry on hitting rate-limits automatically. This includes most bucket-specific rate-limits and global rate-limits. In some rare edge cases, however, Discord implements other undocumented rules for rate-limiting, such as limits per attribute. These cannot be detected or handled normally by Hikari due to their undocumented nature, and will trigger this exception if they occur.
- hikari.errors.InternalServerError: If an internal error occurs on Discord while handling the request.
self,
name: str,
*,
position: Union[int, hikari.undefined.UndefinedType] = UNDEFINED,
topic: Union[str, hikari.undefined.UndefinedType] = UNDEFINED,
nsfw: Union[bool, hikari.undefined.UndefinedType] = UNDEFINED,
rate_limit_per_user: Union[int, float, datetime.timedelta, hikari.undefined.UndefinedType] = UNDEFINED,
permission_overwrites: Union[Sequence[hikari.channels.PermissionOverwrite], hikari.undefined.UndefinedType] = UNDEFINED,
category: Union[hikari.channels.GuildCategory, hikari.snowflakes.Snowflake, int, hikari.undefined.UndefinedType] = UNDEFINED,
reason: Union[str, hikari.undefined.UndefinedType] = UNDEFINED
) -> hikari.channels.GuildNewsChannel:
View Source
async def create_news_channel( self, name: str, *, position: undefined.UndefinedOr[int] = undefined.UNDEFINED, topic: undefined.UndefinedOr[str] = undefined.UNDEFINED, nsfw: undefined.UndefinedOr[bool] = undefined.UNDEFINED, rate_limit_per_user: undefined.UndefinedOr[time.Intervalish] = undefined.UNDEFINED, permission_overwrites: undefined.UndefinedOr[ typing.Sequence[channels_.PermissionOverwrite] ] = undefined.UNDEFINED, category: undefined.UndefinedOr[snowflakes.SnowflakeishOr[channels_.GuildCategory]] = undefined.UNDEFINED, reason: undefined.UndefinedOr[str] = undefined.UNDEFINED, ) -> channels_.GuildNewsChannel: """Create a news channel in the guild. Parameters ---------- name : str The channels name. Must be between 2 and 1000 characters. Other Parameters ---------------- position : hikari.undefined.UndefinedOr[int] If provided, the position of the channel (relative to the category, if any). topic : hikari.undefined.UndefinedOr[str] If provided, the channels topic. Maximum 1024 characters. nsfw : hikari.undefined.UndefinedOr[bool] If provided, whether to mark the channel as NSFW. rate_limit_per_user : hikari.undefined.UndefinedOr[hikari.internal.time.Intervalish] If provided, the amount of seconds a user has to wait before being able to send another message in the channel. Maximum 21600 seconds. permission_overwrites : hikari.undefined.UndefinedOr[typing.Sequence[hikari.channels.PermissionOverwrite]] If provided, the permission overwrites for the channel. category : hikari.undefined.UndefinedOr[hikari.snowflakes.SnowflakeishOr[hikari.channels.GuildCategory]] The category to create the channel under. This may be the object or the ID of an existing category. reason : hikari.undefined.UndefinedOr[str] If provided, the reason that will be recorded in the audit logs. Maximum of 512 characters. Returns ------- hikari.channels.GuildNewsChannel The created channel. Raises ------ hikari.errors.BadRequestError If any of the fields that are passed have an invalid value. hikari.errors.ForbiddenError If you are missing the `MANAGE_CHANNEL` permission. hikari.errors.UnauthorizedError If you are unauthorized to make the request (invalid/missing token). hikari.errors.NotFoundError If the guild is not found. hikari.errors.RateLimitTooLongError Raised in the event that a rate limit occurs that is longer than `max_rate_limit` when making a request. hikari.errors.RateLimitedError Usually, Hikari will handle and retry on hitting rate-limits automatically. This includes most bucket-specific rate-limits and global rate-limits. In some rare edge cases, however, Discord implements other undocumented rules for rate-limiting, such as limits per attribute. These cannot be detected or handled normally by Hikari due to their undocumented nature, and will trigger this exception if they occur. hikari.errors.InternalServerError If an internal error occurs on Discord while handling the request. """ return await self.app.rest.create_guild_news_channel( self.id, name, position=position, topic=topic, nsfw=nsfw, rate_limit_per_user=rate_limit_per_user, permission_overwrites=permission_overwrites, category=category, reason=reason, )
Create a news channel in the guild.
Parameters
- name (str): The channels name. Must be between 2 and 1000 characters.
Other Parameters
- position (hikari.undefined.UndefinedOr[int]): If provided, the position of the channel (relative to the category, if any).
- topic (hikari.undefined.UndefinedOr[str]): If provided, the channels topic. Maximum 1024 characters.
- nsfw (hikari.undefined.UndefinedOr[bool]): If provided, whether to mark the channel as NSFW.
- rate_limit_per_user (hikari.undefined.UndefinedOr[hikari.internal.time.Intervalish]): If provided, the amount of seconds a user has to wait before being able to send another message in the channel. Maximum 21600 seconds.
- permission_overwrites (hikari.undefined.UndefinedOr[typing.Sequence[hikari.channels.PermissionOverwrite]]): If provided, the permission overwrites for the channel.
- category (hikari.undefined.UndefinedOr[hikari.snowflakes.SnowflakeishOr[hikari.channels.GuildCategory]]): The category to create the channel under. This may be the object or the ID of an existing category.
- reason (hikari.undefined.UndefinedOr[str]): If provided, the reason that will be recorded in the audit logs. Maximum of 512 characters.
Returns
- hikari.channels.GuildNewsChannel: The created channel.
Raises
- hikari.errors.BadRequestError: If any of the fields that are passed have an invalid value.
- hikari.errors.ForbiddenError: If you are missing the
MANAGE_CHANNEL
permission. - hikari.errors.UnauthorizedError: If you are unauthorized to make the request (invalid/missing token).
- hikari.errors.NotFoundError: If the guild is not found.
- hikari.errors.RateLimitTooLongError: Raised in the event that a rate limit occurs that is longer than
max_rate_limit
when making a request. - hikari.errors.RateLimitedError: Usually, Hikari will handle and retry on hitting rate-limits automatically. This includes most bucket-specific rate-limits and global rate-limits. In some rare edge cases, however, Discord implements other undocumented rules for rate-limiting, such as limits per attribute. These cannot be detected or handled normally by Hikari due to their undocumented nature, and will trigger this exception if they occur.
- hikari.errors.InternalServerError: If an internal error occurs on Discord while handling the request.
self,
name: str,
*,
position: Union[int, hikari.undefined.UndefinedType] = UNDEFINED,
user_limit: Union[int, hikari.undefined.UndefinedType] = UNDEFINED,
bitrate: Union[int, hikari.undefined.UndefinedType] = UNDEFINED,
permission_overwrites: Union[Sequence[hikari.channels.PermissionOverwrite], hikari.undefined.UndefinedType] = UNDEFINED,
region: Union[hikari.voices.VoiceRegion, str, hikari.undefined.UndefinedType] = UNDEFINED,
category: Union[hikari.channels.GuildCategory, hikari.snowflakes.Snowflake, int, hikari.undefined.UndefinedType] = UNDEFINED,
reason: Union[str, hikari.undefined.UndefinedType] = UNDEFINED
) -> hikari.channels.GuildStageChannel:
View Source
async def create_stage_channel( self, name: str, *, position: undefined.UndefinedOr[int] = undefined.UNDEFINED, user_limit: undefined.UndefinedOr[int] = undefined.UNDEFINED, bitrate: undefined.UndefinedOr[int] = undefined.UNDEFINED, permission_overwrites: undefined.UndefinedOr[ typing.Sequence[channels_.PermissionOverwrite] ] = undefined.UNDEFINED, region: undefined.UndefinedOr[typing.Union[voices_.VoiceRegion, str]] = undefined.UNDEFINED, category: undefined.UndefinedOr[snowflakes.SnowflakeishOr[channels_.GuildCategory]] = undefined.UNDEFINED, reason: undefined.UndefinedOr[str] = undefined.UNDEFINED, ) -> channels_.GuildStageChannel: """Create a stage channel in the guild. Parameters ---------- name : str The channel's name. Must be between 2 and 1000 characters. Other Parameters ---------------- position : hikari.undefined.UndefinedOr[int] If provided, the position of the channel (relative to the category, if any). user_limit : hikari.undefined.UndefinedOr[int] If provided, the maximum users in the channel at once. Must be between 0 and 99 with 0 meaning no limit. bitrate : hikari.undefined.UndefinedOr[int] If provided, the bitrate for the channel. Must be between 8000 and 96000 or 8000 and 128000 for VIP servers. permission_overwrites : hikari.undefined.UndefinedOr[typing.Sequence[hikari.channels.PermissionOverwrite]] If provided, the permission overwrites for the channel. region : hikari.undefined.UndefinedOr[typing.Union[hikari.voices.VoiceRegion, str]] If provided, the voice region to for this channel. Passing `None` here will set it to "auto" mode where the used region will be decided based on the first person who connects to it when it's empty. category : hikari.undefined.UndefinedOr[hikari.snowflakes.SnowflakeishOr[hikari.channels.GuildCategory]] The category to create the channel under. This may be the object or the ID of an existing category. reason : hikari.undefined.UndefinedOr[str] If provided, the reason that will be recorded in the audit logs. Maximum of 512 characters. Returns ------- hikari.channels.GuildStageChannel The created channel. Raises ------ hikari.errors.BadRequestError If any of the fields that are passed have an invalid value. hikari.errors.ForbiddenError If you are missing the `MANAGE_CHANNEL` permission. hikari.errors.UnauthorizedError If you are unauthorized to make the request (invalid/missing token). hikari.errors.NotFoundError If the guild is not found. hikari.errors.RateLimitTooLongError Raised in the event that a rate limit occurs that is longer than `max_rate_limit` when making a request. hikari.errors.RateLimitedError Usually, Hikari will handle and retry on hitting rate-limits automatically. This includes most bucket-specific rate-limits and global rate-limits. In some rare edge cases, however, Discord implements other undocumented rules for rate-limiting, such as limits per attribute. These cannot be detected or handled normally by Hikari due to their undocumented nature, and will trigger this exception if they occur. hikari.errors.InternalServerError If an internal error occurs on Discord while handling the request. """ return await self.app.rest.create_guild_stage_channel( self.id, name, position=position, user_limit=user_limit, bitrate=bitrate, permission_overwrites=permission_overwrites, region=region, category=category, reason=reason, )
Create a stage channel in the guild.
Parameters
- name (str): The channel's name. Must be between 2 and 1000 characters.
Other Parameters
- position (hikari.undefined.UndefinedOr[int]): If provided, the position of the channel (relative to the category, if any).
- user_limit (hikari.undefined.UndefinedOr[int]): If provided, the maximum users in the channel at once. Must be between 0 and 99 with 0 meaning no limit.
- bitrate (hikari.undefined.UndefinedOr[int]): If provided, the bitrate for the channel. Must be between 8000 and 96000 or 8000 and 128000 for VIP servers.
- permission_overwrites (hikari.undefined.UndefinedOr[typing.Sequence[hikari.channels.PermissionOverwrite]]): If provided, the permission overwrites for the channel.
- region (hikari.undefined.UndefinedOr[typing.Union[hikari.voices.VoiceRegion, str]]): If provided, the voice region to for this channel. Passing
None
here will set it to "auto" mode where the used region will be decided based on the first person who connects to it when it's empty. - category (hikari.undefined.UndefinedOr[hikari.snowflakes.SnowflakeishOr[hikari.channels.GuildCategory]]): The category to create the channel under. This may be the object or the ID of an existing category.
- reason (hikari.undefined.UndefinedOr[str]): If provided, the reason that will be recorded in the audit logs. Maximum of 512 characters.
Returns
- hikari.channels.GuildStageChannel: The created channel.
Raises
- hikari.errors.BadRequestError: If any of the fields that are passed have an invalid value.
- hikari.errors.ForbiddenError: If you are missing the
MANAGE_CHANNEL
permission. - hikari.errors.UnauthorizedError: If you are unauthorized to make the request (invalid/missing token).
- hikari.errors.NotFoundError: If the guild is not found.
- hikari.errors.RateLimitTooLongError: Raised in the event that a rate limit occurs that is longer than
max_rate_limit
when making a request. - hikari.errors.RateLimitedError: Usually, Hikari will handle and retry on hitting rate-limits automatically. This includes most bucket-specific rate-limits and global rate-limits. In some rare edge cases, however, Discord implements other undocumented rules for rate-limiting, such as limits per attribute. These cannot be detected or handled normally by Hikari due to their undocumented nature, and will trigger this exception if they occur.
- hikari.errors.InternalServerError: If an internal error occurs on Discord while handling the request.
self,
name: str,
tag: str,
image: Union[hikari.files.Resource[Any], os.PathLike[str], str, bytes, bytearray, memoryview, _io.BytesIO, _io.StringIO],
*,
description: Union[str, hikari.undefined.UndefinedType] = UNDEFINED,
reason: Union[str, hikari.undefined.UndefinedType] = UNDEFINED
) -> hikari.stickers.GuildSticker:
View Source
async def create_sticker( self, name: str, tag: str, image: files.Resourceish, *, description: undefined.UndefinedOr[str] = undefined.UNDEFINED, reason: undefined.UndefinedOr[str] = undefined.UNDEFINED, ) -> stickers.GuildSticker: """Create a sticker in a guild. .. note:: Lottie support is only available for verified and partnered servers. Parameters ---------- name : str The name for the sticker. tag : str The tag for the sticker. image : hikari.files.Resourceish The 320x320 image for the sticker. Maximum upload size is 500kb. This can be a still or an animated PNG or a Lottie. Other Parameters ---------------- description: hikari.undefined.UndefinedOr[str] If provided, the description of the sticker. reason : hikari.undefined.UndefinedOr[str] If provided, the reason that will be recorded in the audit logs. Maximum of 512 characters. Returns ------- hikari.stickers.GuildSticker The created sticker. Raises ------ hikari.errors.BadRequestError If any of the fields that are passed have an invalid value or if there are no more spaces for the sticker in the guild. hikari.errors.ForbiddenError If you are missing `MANAGE_EMOJIS_AND_STICKERS` in the server. hikari.errors.NotFoundError If the guild is not found. hikari.errors.UnauthorizedError If you are unauthorized to make the request (invalid/missing token). hikari.errors.RateLimitTooLongError Raised in the event that a rate limit occurs that is longer than `max_rate_limit` when making a request. hikari.errors.RateLimitedError Usually, Hikari will handle and retry on hitting rate-limits automatically. This includes most bucket-specific rate-limits and global rate-limits. In some rare edge cases, however, Discord implements other undocumented rules for rate-limiting, such as limits per attribute. These cannot be detected or handled normally by Hikari due to their undocumented nature, and will trigger this exception if they occur. hikari.errors.InternalServerError If an internal error occurs on Discord while handling the request. """ return await self.app.rest.create_sticker(self.id, name, tag, image, description=description, reason=reason)
Create a sticker in a guild.
Note: Lottie support is only available for verified and partnered servers.
Parameters
- name (str): The name for the sticker.
- tag (str): The tag for the sticker.
- image (hikari.files.Resourceish): The 320x320 image for the sticker. Maximum upload size is 500kb. This can be a still or an animated PNG or a Lottie.
Other Parameters
- description (hikari.undefined.UndefinedOr[str]): If provided, the description of the sticker.
- reason (hikari.undefined.UndefinedOr[str]): If provided, the reason that will be recorded in the audit logs. Maximum of 512 characters.
Returns
- hikari.stickers.GuildSticker: The created sticker.
Raises
- hikari.errors.BadRequestError: If any of the fields that are passed have an invalid value or if there are no more spaces for the sticker in the guild.
- hikari.errors.ForbiddenError: If you are missing
MANAGE_EMOJIS_AND_STICKERS
in the server. - hikari.errors.NotFoundError: If the guild is not found.
- hikari.errors.UnauthorizedError: If you are unauthorized to make the request (invalid/missing token).
- hikari.errors.RateLimitTooLongError: Raised in the event that a rate limit occurs that is longer than
max_rate_limit
when making a request. - hikari.errors.RateLimitedError: Usually, Hikari will handle and retry on hitting rate-limits automatically. This includes most bucket-specific rate-limits and global rate-limits. In some rare edge cases, however, Discord implements other undocumented rules for rate-limiting, such as limits per attribute. These cannot be detected or handled normally by Hikari due to their undocumented nature, and will trigger this exception if they occur.
- hikari.errors.InternalServerError: If an internal error occurs on Discord while handling the request.
self,
name: str,
*,
position: Union[int, hikari.undefined.UndefinedType] = UNDEFINED,
topic: Union[str, hikari.undefined.UndefinedType] = UNDEFINED,
nsfw: Union[bool, hikari.undefined.UndefinedType] = UNDEFINED,
rate_limit_per_user: Union[int, float, datetime.timedelta, hikari.undefined.UndefinedType] = UNDEFINED,
permission_overwrites: Union[Sequence[hikari.channels.PermissionOverwrite], hikari.undefined.UndefinedType] = UNDEFINED,
category: Union[hikari.channels.GuildCategory, hikari.snowflakes.Snowflake, int, hikari.undefined.UndefinedType] = UNDEFINED,
reason: Union[str, hikari.undefined.UndefinedType] = UNDEFINED
) -> hikari.channels.GuildTextChannel:
View Source
async def create_text_channel( self, name: str, *, position: undefined.UndefinedOr[int] = undefined.UNDEFINED, topic: undefined.UndefinedOr[str] = undefined.UNDEFINED, nsfw: undefined.UndefinedOr[bool] = undefined.UNDEFINED, rate_limit_per_user: undefined.UndefinedOr[time.Intervalish] = undefined.UNDEFINED, permission_overwrites: undefined.UndefinedOr[ typing.Sequence[channels_.PermissionOverwrite] ] = undefined.UNDEFINED, category: undefined.UndefinedOr[snowflakes.SnowflakeishOr[channels_.GuildCategory]] = undefined.UNDEFINED, reason: undefined.UndefinedOr[str] = undefined.UNDEFINED, ) -> channels_.GuildTextChannel: """Create a text channel in the guild. Parameters ---------- name : str The channels name. Must be between 2 and 1000 characters. Other Parameters ---------------- position : hikari.undefined.UndefinedOr[int] If provided, the position of the channel (relative to the category, if any). topic : hikari.undefined.UndefinedOr[str] If provided, the channels topic. Maximum 1024 characters. nsfw : hikari.undefined.UndefinedOr[bool] If provided, whether to mark the channel as NSFW. rate_limit_per_user : hikari.undefined.UndefinedOr[hikari.internal.time.Intervalish] If provided, the amount of seconds a user has to wait before being able to send another message in the channel. Maximum 21600 seconds. permission_overwrites : hikari.undefined.UndefinedOr[typing.Sequence[hikari.channels.PermissionOverwrite]] If provided, the permission overwrites for the channel. category : hikari.undefined.UndefinedOr[hikari.snowflakes.SnowflakeishOr[hikari.channels.GuildCategory]] The category to create the channel under. This may be the object or the ID of an existing category. reason : hikari.undefined.UndefinedOr[str] If provided, the reason that will be recorded in the audit logs. Maximum of 512 characters. Returns ------- hikari.channels.GuildTextChannel The created channel. Raises ------ hikari.errors.BadRequestError If any of the fields that are passed have an invalid value. hikari.errors.ForbiddenError If you are missing the `MANAGE_CHANNEL` permission. hikari.errors.UnauthorizedError If you are unauthorized to make the request (invalid/missing token). hikari.errors.NotFoundError If the guild is not found. hikari.errors.RateLimitTooLongError Raised in the event that a rate limit occurs that is longer than `max_rate_limit` when making a request. hikari.errors.RateLimitedError Usually, Hikari will handle and retry on hitting rate-limits automatically. This includes most bucket-specific rate-limits and global rate-limits. In some rare edge cases, however, Discord implements other undocumented rules for rate-limiting, such as limits per attribute. These cannot be detected or handled normally by Hikari due to their undocumented nature, and will trigger this exception if they occur. hikari.errors.InternalServerError If an internal error occurs on Discord while handling the request. """ return await self.app.rest.create_guild_text_channel( self.id, name, position=position, topic=topic, nsfw=nsfw, rate_limit_per_user=rate_limit_per_user, permission_overwrites=permission_overwrites, category=category, reason=reason, )
Create a text channel in the guild.
Parameters
- name (str): The channels name. Must be between 2 and 1000 characters.
Other Parameters
- position (hikari.undefined.UndefinedOr[int]): If provided, the position of the channel (relative to the category, if any).
- topic (hikari.undefined.UndefinedOr[str]): If provided, the channels topic. Maximum 1024 characters.
- nsfw (hikari.undefined.UndefinedOr[bool]): If provided, whether to mark the channel as NSFW.
- rate_limit_per_user (hikari.undefined.UndefinedOr[hikari.internal.time.Intervalish]): If provided, the amount of seconds a user has to wait before being able to send another message in the channel. Maximum 21600 seconds.
- permission_overwrites (hikari.undefined.UndefinedOr[typing.Sequence[hikari.channels.PermissionOverwrite]]): If provided, the permission overwrites for the channel.
- category (hikari.undefined.UndefinedOr[hikari.snowflakes.SnowflakeishOr[hikari.channels.GuildCategory]]): The category to create the channel under. This may be the object or the ID of an existing category.
- reason (hikari.undefined.UndefinedOr[str]): If provided, the reason that will be recorded in the audit logs. Maximum of 512 characters.
Returns
- hikari.channels.GuildTextChannel: The created channel.
Raises
- hikari.errors.BadRequestError: If any of the fields that are passed have an invalid value.
- hikari.errors.ForbiddenError: If you are missing the
MANAGE_CHANNEL
permission. - hikari.errors.UnauthorizedError: If you are unauthorized to make the request (invalid/missing token).
- hikari.errors.NotFoundError: If the guild is not found.
- hikari.errors.RateLimitTooLongError: Raised in the event that a rate limit occurs that is longer than
max_rate_limit
when making a request. - hikari.errors.RateLimitedError: Usually, Hikari will handle and retry on hitting rate-limits automatically. This includes most bucket-specific rate-limits and global rate-limits. In some rare edge cases, however, Discord implements other undocumented rules for rate-limiting, such as limits per attribute. These cannot be detected or handled normally by Hikari due to their undocumented nature, and will trigger this exception if they occur.
- hikari.errors.InternalServerError: If an internal error occurs on Discord while handling the request.
self,
name: str,
*,
position: Union[int, hikari.undefined.UndefinedType] = UNDEFINED,
user_limit: Union[int, hikari.undefined.UndefinedType] = UNDEFINED,
bitrate: Union[int, hikari.undefined.UndefinedType] = UNDEFINED,
video_quality_mode: Union[hikari.channels.VideoQualityMode, int, hikari.undefined.UndefinedType] = UNDEFINED,
permission_overwrites: Union[Sequence[hikari.channels.PermissionOverwrite], hikari.undefined.UndefinedType] = UNDEFINED,
region: Union[hikari.voices.VoiceRegion, str, hikari.undefined.UndefinedType] = UNDEFINED,
category: Union[hikari.channels.GuildCategory, hikari.snowflakes.Snowflake, int, hikari.undefined.UndefinedType] = UNDEFINED,
reason: Union[str, hikari.undefined.UndefinedType] = UNDEFINED
) -> hikari.channels.GuildVoiceChannel:
View Source
async def create_voice_channel( self, name: str, *, position: undefined.UndefinedOr[int] = undefined.UNDEFINED, user_limit: undefined.UndefinedOr[int] = undefined.UNDEFINED, bitrate: undefined.UndefinedOr[int] = undefined.UNDEFINED, video_quality_mode: undefined.UndefinedOr[typing.Union[channels_.VideoQualityMode, int]] = undefined.UNDEFINED, permission_overwrites: undefined.UndefinedOr[ typing.Sequence[channels_.PermissionOverwrite] ] = undefined.UNDEFINED, region: undefined.UndefinedOr[typing.Union[voices_.VoiceRegion, str]] = undefined.UNDEFINED, category: undefined.UndefinedOr[snowflakes.SnowflakeishOr[channels_.GuildCategory]] = undefined.UNDEFINED, reason: undefined.UndefinedOr[str] = undefined.UNDEFINED, ) -> channels_.GuildVoiceChannel: """Create a voice channel in a guild. Parameters ---------- name : str The channels name. Must be between 2 and 1000 characters. Other Parameters ---------------- position : hikari.undefined.UndefinedOr[int] If provided, the position of the channel (relative to the category, if any). user_limit : hikari.undefined.UndefinedOr[int] If provided, the maximum users in the channel at once. Must be between 0 and 99 with 0 meaning no limit. bitrate : hikari.undefined.UndefinedOr[int] If provided, the bitrate for the channel. Must be between 8000 and 96000 or 8000 and 128000 for VIP servers. video_quality_mode: hikari.undefined.UndefinedOr[typing.Union[hikari.channels.VideoQualityMode, int]] If provided, the new video quality mode for the channel. permission_overwrites : hikari.undefined.UndefinedOr[typing.Sequence[hikari.channels.PermissionOverwrite]] If provided, the permission overwrites for the channel. region : hikari.undefined.UndefinedOr[typing.Union[hikari.voices.VoiceRegion, str]] If provided, the voice region to for this channel. Passing `None` here will set it to "auto" mode where the used region will be decided based on the first person who connects to it when it's empty. category : hikari.undefined.UndefinedOr[hikari.snowflakes.SnowflakeishOr[hikari.channels.GuildCategory]] The category to create the channel under. This may be the object or the ID of an existing category. reason : hikari.undefined.UndefinedOr[str] If provided, the reason that will be recorded in the audit logs. Maximum of 512 characters. Returns ------- hikari.channels.GuildVoiceChannel The created channel. Raises ------ hikari.errors.BadRequestError If any of the fields that are passed have an invalid value. hikari.errors.ForbiddenError If you are missing the `MANAGE_CHANNEL` permission. hikari.errors.UnauthorizedError If you are unauthorized to make the request (invalid/missing token). hikari.errors.NotFoundError If the gui ld is not found. hikari.errors.RateLimitTooLongError Raised in the event that a rate limit occurs that is longer than `max_rate_limit` when making a request. hikari.errors.RateLimitedError Usually, Hikari will handle and retry on hitting rate-limits automatically. This includes most bucket-specific rate-limits and global rate-limits. In some rare edge cases, however, Discord implements other undocumented rules for rate-limiting, such as limits per attribute. These cannot be detected or handled normally by Hikari due to their undocumented nature, and will trigger this exception if they occur. hikari.errors.InternalServerError If an internal error occurs on Discord while handling the request. """ return await self.app.rest.create_guild_voice_channel( self.id, name, position=position, user_limit=user_limit, bitrate=bitrate, video_quality_mode=video_quality_mode, permission_overwrites=permission_overwrites, region=region, category=category, reason=reason, )
Create a voice channel in a guild.
Parameters
- name (str): The channels name. Must be between 2 and 1000 characters.
Other Parameters
- position (hikari.undefined.UndefinedOr[int]): If provided, the position of the channel (relative to the category, if any).
- user_limit (hikari.undefined.UndefinedOr[int]): If provided, the maximum users in the channel at once. Must be between 0 and 99 with 0 meaning no limit.
- bitrate (hikari.undefined.UndefinedOr[int]): If provided, the bitrate for the channel. Must be between 8000 and 96000 or 8000 and 128000 for VIP servers.
- video_quality_mode (hikari.undefined.UndefinedOr[typing.Union[hikari.channels.VideoQualityMode, int]]): If provided, the new video quality mode for the channel.
- permission_overwrites (hikari.undefined.UndefinedOr[typing.Sequence[hikari.channels.PermissionOverwrite]]): If provided, the permission overwrites for the channel.
- region (hikari.undefined.UndefinedOr[typing.Union[hikari.voices.VoiceRegion, str]]): If provided, the voice region to for this channel. Passing
None
here will set it to "auto" mode where the used region will be decided based on the first person who connects to it when it's empty. - category (hikari.undefined.UndefinedOr[hikari.snowflakes.SnowflakeishOr[hikari.channels.GuildCategory]]): The category to create the channel under. This may be the object or the ID of an existing category.
- reason (hikari.undefined.UndefinedOr[str]): If provided, the reason that will be recorded in the audit logs. Maximum of 512 characters.
Returns
- hikari.channels.GuildVoiceChannel: The created channel.
Raises
- hikari.errors.BadRequestError: If any of the fields that are passed have an invalid value.
- hikari.errors.ForbiddenError: If you are missing the
MANAGE_CHANNEL
permission. - hikari.errors.UnauthorizedError: If you are unauthorized to make the request (invalid/missing token).
- hikari.errors.NotFoundError: If the gui ld is not found.
- hikari.errors.RateLimitTooLongError: Raised in the event that a rate limit occurs that is longer than
max_rate_limit
when making a request. - hikari.errors.RateLimitedError: Usually, Hikari will handle and retry on hitting rate-limits automatically. This includes most bucket-specific rate-limits and global rate-limits. In some rare edge cases, however, Discord implements other undocumented rules for rate-limiting, such as limits per attribute. These cannot be detected or handled normally by Hikari due to their undocumented nature, and will trigger this exception if they occur.
- hikari.errors.InternalServerError: If an internal error occurs on Discord while handling the request.
self,
channel: Union[hikari.channels.GuildChannel, hikari.snowflakes.Snowflake, int]
) -> hikari.channels.GuildChannel:
View Source
async def delete_channel( self, channel: snowflakes.SnowflakeishOr[channels_.GuildChannel] ) -> channels_.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. Parameters ---------- channel : hikari.snowflakes.SnowflakeishOr[hikari.channels.GuildChannel] The channel or category to delete. This may be the object or the ID of an existing channel. Returns ------- hikari.channels.GuildChannel Object of the channel or category that was deleted. Raises ------ hikari.errors.UnauthorizedError, or close a DM. If you are unauthorized to make the request (invalid/missing token). hikari.errors.ForbiddenError If you are missing the `MANAGE_CHANNEL` permission in the channel. hikari.errors.NotFoundError If the channel is not found. hikari.errors.RateLimitTooLongError Raised in the event that a rate limit occurs that is longer than `max_rate_limit` when making a request. hikari.errors.RateLimitedError Usually, Hikari will handle and retry on hitting rate-limits automatically. This includes most bucket-specific rate-limits and global rate-limits. In some rare edge cases, however, Discord implements other undocumented rules for rate-limiting, such as limits per attribute. These cannot be detected or handled normally by Hikari due to their undocumented nature, and will trigger this exception if they occur. hikari.errors.InternalServerError If an internal error occurs on Discord while handling the request. """ deleted_channel = await self.app.rest.delete_channel(channel) assert isinstance(deleted_channel, channels_.GuildChannel) return deleted_channel
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.
Parameters
- channel (hikari.snowflakes.SnowflakeishOr[hikari.channels.GuildChannel]): The channel or category to delete. This may be the object or the ID of an existing channel.
Returns
- hikari.channels.GuildChannel: Object of the channel or category that was deleted.
Raises
- hikari.errors.UnauthorizedError, or close a DM.: If you are unauthorized to make the request (invalid/missing token).
- hikari.errors.ForbiddenError: If you are missing the
MANAGE_CHANNEL
permission in the channel. - hikari.errors.NotFoundError: If the channel is not found.
- hikari.errors.RateLimitTooLongError: Raised in the event that a rate limit occurs that is longer than
max_rate_limit
when making a request. - hikari.errors.RateLimitedError: Usually, Hikari will handle and retry on hitting rate-limits automatically. This includes most bucket-specific rate-limits and global rate-limits. In some rare edge cases, however, Discord implements other undocumented rules for rate-limiting, such as limits per attribute. These cannot be detected or handled normally by Hikari due to their undocumented nature, and will trigger this exception if they occur.
- hikari.errors.InternalServerError: If an internal error occurs on Discord while handling the request.
self,
sticker: Union[hikari.stickers.PartialSticker, hikari.snowflakes.Snowflake, int],
*,
reason: Union[str, hikari.undefined.UndefinedType] = UNDEFINED
) -> None:
View Source
async def delete_sticker( self, sticker: snowflakes.SnowflakeishOr[stickers.PartialSticker], *, reason: undefined.UndefinedOr[str] = undefined.UNDEFINED, ) -> None: """Delete a sticker in a guild. Parameters ---------- sticker : hikari.snowflakes.SnowflakeishOr[hikari.stickers.PartialSticker] The sticker to delete. This can be a sticker object or the ID of an existing sticker. Other Parameters ---------------- reason : hikari.undefined.UndefinedOr[str] If provided, the reason that will be recorded in the audit logs. Maximum of 512 characters. Raises ------ hikari.errors.ForbiddenError If you are missing `MANAGE_EMOJIS_AND_STICKERS` in the server. hikari.errors.NotFoundError If the guild or the sticker are not found. hikari.errors.UnauthorizedError If you are unauthorized to make the request (invalid/missing token). hikari.errors.RateLimitTooLongError Raised in the event that a rate limit occurs that is longer than `max_rate_limit` when making a request. hikari.errors.RateLimitedError Usually, Hikari will handle and retry on hitting rate-limits automatically. This includes most bucket-specific rate-limits and global rate-limits. In some rare edge cases, however, Discord implements other undocumented rules for rate-limiting, such as limits per attribute. These cannot be detected or handled normally by Hikari due to their undocumented nature, and will trigger this exception if they occur. hikari.errors.InternalServerError If an internal error occurs on Discord while handling the request. """ return await self.app.rest.delete_sticker(self.id, sticker, reason=reason)
Delete a sticker in a guild.
Parameters
- sticker (hikari.snowflakes.SnowflakeishOr[hikari.stickers.PartialSticker]): The sticker to delete. This can be a sticker object or the ID of an existing sticker.
Other Parameters
- reason (hikari.undefined.UndefinedOr[str]): If provided, the reason that will be recorded in the audit logs. Maximum of 512 characters.
Raises
- hikari.errors.ForbiddenError: If you are missing
MANAGE_EMOJIS_AND_STICKERS
in the server. - hikari.errors.NotFoundError: If the guild or the sticker are not found.
- hikari.errors.UnauthorizedError: If you are unauthorized to make the request (invalid/missing token).
- hikari.errors.RateLimitTooLongError: Raised in the event that a rate limit occurs that is longer than
max_rate_limit
when making a request. - hikari.errors.RateLimitedError: Usually, Hikari will handle and retry on hitting rate-limits automatically. This includes most bucket-specific rate-limits and global rate-limits. In some rare edge cases, however, Discord implements other undocumented rules for rate-limiting, such as limits per attribute. These cannot be detected or handled normally by Hikari due to their undocumented nature, and will trigger this exception if they occur.
- hikari.errors.InternalServerError: If an internal error occurs on Discord while handling the request.
self,
*,
name: Union[str, hikari.undefined.UndefinedType] = UNDEFINED,
verification_level: Union[hikari.guilds.GuildVerificationLevel, hikari.undefined.UndefinedType] = UNDEFINED,
default_message_notifications: Union[hikari.guilds.GuildMessageNotificationsLevel, hikari.undefined.UndefinedType] = UNDEFINED,
explicit_content_filter_level: Union[hikari.guilds.GuildExplicitContentFilterLevel, hikari.undefined.UndefinedType] = UNDEFINED,
afk_channel: Union[hikari.channels.GuildVoiceChannel, hikari.snowflakes.Snowflake, int, hikari.undefined.UndefinedType] = UNDEFINED,
afk_timeout: Union[int, float, datetime.timedelta, hikari.undefined.UndefinedType] = UNDEFINED,
icon: Union[hikari.files.Resource[Any], os.PathLike[str], str, bytes, bytearray, memoryview, _io.BytesIO, _io.StringIO, hikari.undefined.UndefinedType, NoneType] = UNDEFINED,
owner: Union[hikari.users.PartialUser, hikari.snowflakes.Snowflake, int, hikari.undefined.UndefinedType] = UNDEFINED,
splash: Union[hikari.files.Resource[Any], os.PathLike[str], str, bytes, bytearray, memoryview, _io.BytesIO, _io.StringIO, hikari.undefined.UndefinedType, NoneType] = UNDEFINED,
banner: Union[hikari.files.Resource[Any], os.PathLike[str], str, bytes, bytearray, memoryview, _io.BytesIO, _io.StringIO, hikari.undefined.UndefinedType, NoneType] = UNDEFINED,
system_channel: Union[hikari.channels.GuildTextChannel, hikari.snowflakes.Snowflake, int, hikari.undefined.UndefinedType, NoneType] = UNDEFINED,
rules_channel: Union[hikari.channels.GuildTextChannel, hikari.snowflakes.Snowflake, int, hikari.undefined.UndefinedType, NoneType] = UNDEFINED,
public_updates_channel: Union[hikari.channels.GuildTextChannel, hikari.snowflakes.Snowflake, int, hikari.undefined.UndefinedType, NoneType] = UNDEFINED,
preferred_locale: Union[str, hikari.locales.Locale, hikari.undefined.UndefinedType] = UNDEFINED,
reason: Union[str, hikari.undefined.UndefinedType] = UNDEFINED
) -> hikari.guilds.RESTGuild:
View Source
async def edit( self, *, name: undefined.UndefinedOr[str] = undefined.UNDEFINED, verification_level: undefined.UndefinedOr[GuildVerificationLevel] = undefined.UNDEFINED, default_message_notifications: undefined.UndefinedOr[GuildMessageNotificationsLevel] = undefined.UNDEFINED, explicit_content_filter_level: undefined.UndefinedOr[GuildExplicitContentFilterLevel] = undefined.UNDEFINED, afk_channel: undefined.UndefinedOr[ snowflakes.SnowflakeishOr[channels_.GuildVoiceChannel] ] = undefined.UNDEFINED, afk_timeout: undefined.UndefinedOr[time.Intervalish] = undefined.UNDEFINED, icon: undefined.UndefinedNoneOr[files.Resourceish] = undefined.UNDEFINED, owner: undefined.UndefinedOr[snowflakes.SnowflakeishOr[users.PartialUser]] = undefined.UNDEFINED, splash: undefined.UndefinedNoneOr[files.Resourceish] = undefined.UNDEFINED, banner: undefined.UndefinedNoneOr[files.Resourceish] = undefined.UNDEFINED, system_channel: undefined.UndefinedNoneOr[ snowflakes.SnowflakeishOr[channels_.GuildTextChannel] ] = undefined.UNDEFINED, rules_channel: undefined.UndefinedNoneOr[ snowflakes.SnowflakeishOr[channels_.GuildTextChannel] ] = undefined.UNDEFINED, public_updates_channel: undefined.UndefinedNoneOr[ snowflakes.SnowflakeishOr[channels_.GuildTextChannel] ] = undefined.UNDEFINED, preferred_locale: undefined.UndefinedOr[typing.Union[str, locales.Locale]] = undefined.UNDEFINED, reason: undefined.UndefinedOr[str] = undefined.UNDEFINED, ) -> RESTGuild: """Edits the guild. Parameters ---------- name : hikari.undefined.UndefinedOr[str] If provided, the new name for the guild. verification_level : hikari.undefined.UndefinedOr[hikari.guilds.GuildVerificationLevel] If provided, the new verification level. default_message_notifications : hikari.undefined.UndefinedOr[hikari.guilds.GuildMessageNotificationsLevel] If provided, the new default message notifications level. explicit_content_filter_level : hikari.undefined.UndefinedOr[hikari.guilds.GuildExplicitContentFilterLevel] If provided, the new explicit content filter level. afk_channel : hikari.undefined.UndefinedOr[hikari.snowflakes.SnowflakeishOr[hikari.channels.GuildVoiceChannel]] If provided, the new afk channel. Requires `afk_timeout` to be set to work. afk_timeout : hikari.undefined.UndefinedOr[hikari.internal.time.Intervalish] If provided, the new afk timeout. icon : hikari.undefined.UndefinedOr[hikari.files.Resourceish] If provided, the new guild icon. Must be a 1024x1024 image or can be an animated gif when the guild has the `ANIMATED_ICON` feature. owner : hikari.undefined.UndefinedOr[hikari.snowflakes.SnowflakeishOr[hikari.users.PartialUser]]] If provided, the new guild owner. .. warning:: You need to be the owner of the server to use this. splash : hikari.undefined.UndefinedNoneOr[hikari.files.Resourceish] If provided, the new guild splash. Must be a 16:9 image and the guild must have the `INVITE_SPLASH` feature. banner : hikari.undefined.UndefinedNoneOr[hikari.files.Resourceish] If provided, the new guild banner. Must be a 16:9 image and the guild must have the `BANNER` feature. system_channel : hikari.undefined.UndefinedNoneOr[hikari.snowflakes.SnowflakeishOr[hikari.channels.GuildTextChannel]] If provided, the new system channel. rules_channel : hikari.undefined.UndefinedNoneOr[hikari.snowflakes.SnowflakeishOr[hikari.channels.GuildTextChannel]] If provided, the new rules channel. public_updates_channel : hikari.undefined.UndefinedNoneOr[hikari.snowflakes.SnowflakeishOr[hikari.channels.GuildTextChannel]] If provided, the new public updates channel. preferred_locale : hikari.undefined.UndefinedNoneOr[str] If provided, the new preferred locale. reason : hikari.undefined.UndefinedOr[str] If provided, the reason that will be recorded in the audit logs. Maximum of 512 characters. Returns ------- hikari.guilds.RESTGuild The edited guild. Raises ------ hikari.errors.BadRequestError If any of the fields that are passed have an invalid value. Or you are missing the hikari.errors.ForbiddenError If you are missing the `MANAGE_GUILD` permission or if you tried to pass ownership without being the server owner. hikari.errors.UnauthorizedError If you are unauthorized to make the request (invalid/missing token). hikari.errors.NotFoundError If the guild is not found. hikari.errors.RateLimitTooLongError Raised in the event that a rate limit occurs that is longer than `max_rate_limit` when making a request. hikari.errors.RateLimitedError Usually, Hikari will handle and retry on hitting rate-limits automatically. This includes most bucket-specific rate-limits and global rate-limits. In some rare edge cases, however, Discord implements other undocumented rules for rate-limiting, such as limits per attribute. These cannot be detected or handled normally by Hikari due to their undocumented nature, and will trigger this exception if they occur. hikari.errors.InternalServerError If an internal error occurs on Discord while handling the request. """ # noqa: E501 - Line too long return await self.app.rest.edit_guild( self.id, name=name, verification_level=verification_level, default_message_notifications=default_message_notifications, explicit_content_filter_level=explicit_content_filter_level, afk_channel=afk_channel, afk_timeout=afk_timeout, icon=icon, owner=owner, splash=splash, banner=banner, system_channel=system_channel, rules_channel=rules_channel, public_updates_channel=public_updates_channel, preferred_locale=preferred_locale, reason=reason, )
Edits the guild.
Parameters
- name (hikari.undefined.UndefinedOr[str]): If provided, the new name for the guild.
- verification_level (hikari.undefined.UndefinedOr[hikari.guilds.GuildVerificationLevel]): If provided, the new verification level.
- default_message_notifications (hikari.undefined.UndefinedOr[hikari.guilds.GuildMessageNotificationsLevel]): If provided, the new default message notifications level.
- explicit_content_filter_level (hikari.undefined.UndefinedOr[hikari.guilds.GuildExplicitContentFilterLevel]): If provided, the new explicit content filter level.
- afk_channel (hikari.undefined.UndefinedOr[hikari.snowflakes.SnowflakeishOr[hikari.channels.GuildVoiceChannel]]): If provided, the new afk channel. Requires
afk_timeout
to be set to work. - afk_timeout (hikari.undefined.UndefinedOr[hikari.internal.time.Intervalish]): If provided, the new afk timeout.
- icon (hikari.undefined.UndefinedOr[hikari.files.Resourceish]): If provided, the new guild icon. Must be a 1024x1024 image or can be an animated gif when the guild has the
ANIMATED_ICON
feature. owner (hikari.undefined.UndefinedOr[hikari.snowflakes.SnowflakeishOr[hikari.users.PartialUser]]]): If provided, the new guild owner.
Warning: You need to be the owner of the server to use this.
- splash (hikari.undefined.UndefinedNoneOr[hikari.files.Resourceish]): If provided, the new guild splash. Must be a 16:9 image and the guild must have the
INVITE_SPLASH
feature. - banner (hikari.undefined.UndefinedNoneOr[hikari.files.Resourceish]): If provided, the new guild banner. Must be a 16:9 image and the guild must have the
BANNER
feature. - system_channel (hikari.undefined.UndefinedNoneOr[hikari.snowflakes.SnowflakeishOr[hikari.channels.GuildTextChannel]]): If provided, the new system channel.
- rules_channel (hikari.undefined.UndefinedNoneOr[hikari.snowflakes.SnowflakeishOr[hikari.channels.GuildTextChannel]]): If provided, the new rules channel.
- public_updates_channel (hikari.undefined.UndefinedNoneOr[hikari.snowflakes.SnowflakeishOr[hikari.channels.GuildTextChannel]]): If provided, the new public updates channel.
- preferred_locale (hikari.undefined.UndefinedNoneOr[str]): If provided, the new preferred locale.
- reason (hikari.undefined.UndefinedOr[str]): If provided, the reason that will be recorded in the audit logs. Maximum of 512 characters.
Returns
- hikari.guilds.RESTGuild: The edited guild.
Raises
- hikari.errors.BadRequestError: If any of the fields that are passed have an invalid value. Or you are missing the
- hikari.errors.ForbiddenError: If you are missing the
MANAGE_GUILD
permission or if you tried to pass ownership without being the server owner. - hikari.errors.UnauthorizedError: If you are unauthorized to make the request (invalid/missing token).
- hikari.errors.NotFoundError: If the guild is not found.
- hikari.errors.RateLimitTooLongError: Raised in the event that a rate limit occurs that is longer than
max_rate_limit
when making a request. - hikari.errors.RateLimitedError: Usually, Hikari will handle and retry on hitting rate-limits automatically. This includes most bucket-specific rate-limits and global rate-limits. In some rare edge cases, however, Discord implements other undocumented rules for rate-limiting, such as limits per attribute. These cannot be detected or handled normally by Hikari due to their undocumented nature, and will trigger this exception if they occur.
- hikari.errors.InternalServerError: If an internal error occurs on Discord while handling the request.
self,
sticker: Union[hikari.stickers.PartialSticker, hikari.snowflakes.Snowflake, int],
*,
name: Union[str, hikari.undefined.UndefinedType] = UNDEFINED,
description: Union[str, hikari.undefined.UndefinedType] = UNDEFINED,
tag: Union[str, hikari.undefined.UndefinedType] = UNDEFINED,
reason: Union[str, hikari.undefined.UndefinedType] = UNDEFINED
) -> hikari.stickers.GuildSticker:
View Source
async def edit_sticker( self, sticker: snowflakes.SnowflakeishOr[stickers.PartialSticker], *, name: undefined.UndefinedOr[str] = undefined.UNDEFINED, description: undefined.UndefinedOr[str] = undefined.UNDEFINED, tag: undefined.UndefinedOr[str] = undefined.UNDEFINED, reason: undefined.UndefinedOr[str] = undefined.UNDEFINED, ) -> stickers.GuildSticker: """Edit a sticker in a guild. Parameters ---------- sticker : hikari.snowflakes.SnowflakeishOr[hikari.stickers.PartialSticker] The sticker to edit. This can be a sticker object or the ID of an existing sticker. Other Parameters ---------------- name : hikari.undefined.UndefinedOr[str] If provided, the new name for the sticker. description : hikari.undefined.UndefinedOr[str] If provided, the new description for the sticker. tag : hikari.undefined.UndefinedOr[str] If provided, the new sticker tag. reason : hikari.undefined.UndefinedOr[str] If provided, the reason that will be recorded in the audit logs. Maximum of 512 characters. Returns ------- hikari.stickers.GuildSticker The edited sticker. Raises ------ hikari.errors.BadRequestError If any of the fields that are passed have an invalid value. hikari.errors.ForbiddenError If you are missing `MANAGE_EMOJIS_AND_STICKERS` in the server. hikari.errors.NotFoundError If the guild or the sticker are not found. hikari.errors.UnauthorizedError If you are unauthorized to make the request (invalid/missing token). hikari.errors.RateLimitTooLongError Raised in the event that a rate limit occurs that is longer than `max_rate_limit` when making a request. hikari.errors.RateLimitedError Usually, Hikari will handle and retry on hitting rate-limits automatically. This includes most bucket-specific rate-limits and global rate-limits. In some rare edge cases, however, Discord implements other undocumented rules for rate-limiting, such as limits per attribute. These cannot be detected or handled normally by Hikari due to their undocumented nature, and will trigger this exception if they occur. hikari.errors.InternalServerError If an internal error occurs on Discord while handling the request. """ return await self.app.rest.edit_sticker( self.id, sticker, name=name, description=description, tag=tag, reason=reason )
Edit a sticker in a guild.
Parameters
- sticker (hikari.snowflakes.SnowflakeishOr[hikari.stickers.PartialSticker]): The sticker to edit. This can be a sticker object or the ID of an existing sticker.
Other Parameters
- name (hikari.undefined.UndefinedOr[str]): If provided, the new name for the sticker.
- description (hikari.undefined.UndefinedOr[str]): If provided, the new description for the sticker.
- tag (hikari.undefined.UndefinedOr[str]): If provided, the new sticker tag.
- reason (hikari.undefined.UndefinedOr[str]): If provided, the reason that will be recorded in the audit logs. Maximum of 512 characters.
Returns
- hikari.stickers.GuildSticker: The edited sticker.
Raises
- hikari.errors.BadRequestError: If any of the fields that are passed have an invalid value.
- hikari.errors.ForbiddenError: If you are missing
MANAGE_EMOJIS_AND_STICKERS
in the server. - hikari.errors.NotFoundError: If the guild or the sticker are not found.
- hikari.errors.UnauthorizedError: If you are unauthorized to make the request (invalid/missing token).
- hikari.errors.RateLimitTooLongError: Raised in the event that a rate limit occurs that is longer than
max_rate_limit
when making a request. - hikari.errors.RateLimitedError: Usually, Hikari will handle and retry on hitting rate-limits automatically. This includes most bucket-specific rate-limits and global rate-limits. In some rare edge cases, however, Discord implements other undocumented rules for rate-limiting, such as limits per attribute. These cannot be detected or handled normally by Hikari due to their undocumented nature, and will trigger this exception if they occur.
- hikari.errors.InternalServerError: If an internal error occurs on Discord while handling the request.
self,
emoji: Union[hikari.emojis.CustomEmoji, hikari.snowflakes.Snowflake, int]
) -> hikari.emojis.KnownCustomEmoji:
View Source
async def fetch_emoji(self, emoji: snowflakes.SnowflakeishOr[emojis_.CustomEmoji]) -> emojis_.KnownCustomEmoji: """Fetch an emoji from the guild. Parameters ---------- emoji : hikari.snowflakes.SnowflakeishOr[hikari.emojis.CustomEmoji] The emoji to fetch. This can be a `hikari.emojis.CustomEmoji` or the ID of an existing emoji. Returns ------- hikari.emojis.KnownCustomEmoji The requested emoji. Raises ------ hikari.errors.NotFoundError If the guild or the emoji are not found. hikari.errors.UnauthorizedError If you are unauthorized to make the request (invalid/missing token). hikari.errors.RateLimitTooLongError Raised in the event that a rate limit occurs that is longer than `max_rate_limit` when making a request. hikari.errors.RateLimitedError Usually, Hikari will handle and retry on hitting rate-limits automatically. This includes most bucket-specific rate-limits and global rate-limits. In some rare edge cases, however, Discord implements other undocumented rules for rate-limiting, such as limits per attribute. These cannot be detected or handled normally by Hikari due to their undocumented nature, and will trigger this exception if they occur. hikari.errors.InternalServerError If an internal error occurs on Discord while handling the request. """ return await self.app.rest.fetch_emoji(self.id, emoji)
Fetch an emoji from the guild.
Parameters
- emoji (hikari.snowflakes.SnowflakeishOr[hikari.emojis.CustomEmoji]): The emoji to fetch. This can be a
hikari.emojis.CustomEmoji
or the ID of an existing emoji.
Returns
- hikari.emojis.KnownCustomEmoji: The requested emoji.
Raises
- hikari.errors.NotFoundError: If the guild or the emoji are not found.
- hikari.errors.UnauthorizedError: If you are unauthorized to make the request (invalid/missing token).
- hikari.errors.RateLimitTooLongError: Raised in the event that a rate limit occurs that is longer than
max_rate_limit
when making a request. - hikari.errors.RateLimitedError: Usually, Hikari will handle and retry on hitting rate-limits automatically. This includes most bucket-specific rate-limits and global rate-limits. In some rare edge cases, however, Discord implements other undocumented rules for rate-limiting, such as limits per attribute. These cannot be detected or handled normally by Hikari due to their undocumented nature, and will trigger this exception if they occur.
- hikari.errors.InternalServerError: If an internal error occurs on Discord while handling the request.
View Source
async def fetch_emojis(self) -> typing.Sequence[emojis_.KnownCustomEmoji]: """Fetch the emojis of the guild. Returns ------- typing.Sequence[hikari.emojis.KnownCustomEmoji] The requested emojis. Raises ------ hikari.errors.NotFoundError If the guild is not found. hikari.errors.UnauthorizedError If you are unauthorized to make the request (invalid/missing token). hikari.errors.RateLimitTooLongError Raised in the event that a rate limit occurs that is longer than `max_rate_limit` when making a request. hikari.errors.RateLimitedError Usually, Hikari will handle and retry on hitting rate-limits automatically. This includes most bucket-specific rate-limits and global rate-limits. In some rare edge cases, however, Discord implements other undocumented rules for rate-limiting, such as limits per attribute. These cannot be detected or handled normally by Hikari due to their undocumented nature, and will trigger this exception if they occur. hikari.errors.InternalServerError If an internal error occurs on Discord while handling the request. """ return await self.app.rest.fetch_guild_emojis(self.id)
Fetch the emojis of the guild.
Returns
- typing.Sequence[hikari.emojis.KnownCustomEmoji]: The requested emojis.
Raises
- hikari.errors.NotFoundError: If the guild is not found.
- hikari.errors.UnauthorizedError: If you are unauthorized to make the request (invalid/missing token).
- hikari.errors.RateLimitTooLongError: Raised in the event that a rate limit occurs that is longer than
max_rate_limit
when making a request. - hikari.errors.RateLimitedError: Usually, Hikari will handle and retry on hitting rate-limits automatically. This includes most bucket-specific rate-limits and global rate-limits. In some rare edge cases, however, Discord implements other undocumented rules for rate-limiting, such as limits per attribute. These cannot be detected or handled normally by Hikari due to their undocumented nature, and will trigger this exception if they occur.
- hikari.errors.InternalServerError: If an internal error occurs on Discord while handling the request.
View Source
async def fetch_roles(self) -> typing.Sequence[Role]: """Fetch the roles of the guild. Returns ------- typing.Sequence[hikari.guilds.Role] The requested roles. Raises ------ hikari.errors.UnauthorizedError If you are unauthorized to make the request (invalid/missing token). hikari.errors.NotFoundError If the guild is not found. hikari.errors.RateLimitTooLongError Raised in the event that a rate limit occurs that is longer than `max_rate_limit` when making a request. hikari.errors.RateLimitedError Usually, Hikari will handle and retry on hitting rate-limits automatically. This includes most bucket-specific rate-limits and global rate-limits. In some rare edge cases, however, Discord implements other undocumented rules for rate-limiting, such as limits per attribute. These cannot be detected or handled normally by Hikari due to their undocumented nature, and will trigger this exception if they occur. hikari.errors.InternalServerError If an internal error occurs on Discord while handling the request. """ return await self.app.rest.fetch_roles(self.id)
Fetch the roles of the guild.
Returns
- typing.Sequence[hikari.guilds.Role]: The requested roles.
Raises
- hikari.errors.UnauthorizedError: If you are unauthorized to make the request (invalid/missing token). hikari.errors.NotFoundError If the guild is not found.
- hikari.errors.RateLimitTooLongError: Raised in the event that a rate limit occurs that is longer than
max_rate_limit
when making a request. - hikari.errors.RateLimitedError: Usually, Hikari will handle and retry on hitting rate-limits automatically. This includes most bucket-specific rate-limits and global rate-limits. In some rare edge cases, however, Discord implements other undocumented rules for rate-limiting, such as limits per attribute. These cannot be detected or handled normally by Hikari due to their undocumented nature, and will trigger this exception if they occur.
- hikari.errors.InternalServerError: If an internal error occurs on Discord while handling the request.
View Source
async def fetch_self(self) -> RESTGuild: """Fetch the guild. Returns ------- hikari.guilds.RESTGuild The requested guild. Raises ------ hikari.errors.ForbiddenError If you are not part of the guild. hikari.errors.NotFoundError If the guild is not found. hikari.errors.UnauthorizedError If you are unauthorized to make the request (invalid/missing token). hikari.errors.RateLimitTooLongError Raised in the event that a rate limit occurs that is longer than `max_rate_limit` when making a request. hikari.errors.RateLimitedError Usually, Hikari will handle and retry on hitting rate-limits automatically. This includes most bucket-specific rate-limits and global rate-limits. In some rare edge cases, however, Discord implements other undocumented rules for rate-limiting, such as limits per attribute. These cannot be detected or handled normally by Hikari due to their undocumented nature, and will trigger this exception if they occur. hikari.errors.InternalServerError If an internal error occurs on Discord while handling the request. """ return await self.app.rest.fetch_guild(self.id)
Fetch the guild.
Returns
- hikari.guilds.RESTGuild: The requested guild.
Raises
- hikari.errors.ForbiddenError: If you are not part of the guild.
- hikari.errors.NotFoundError: If the guild is not found.
- hikari.errors.UnauthorizedError: If you are unauthorized to make the request (invalid/missing token).
- hikari.errors.RateLimitTooLongError: Raised in the event that a rate limit occurs that is longer than
max_rate_limit
when making a request. - hikari.errors.RateLimitedError: Usually, Hikari will handle and retry on hitting rate-limits automatically. This includes most bucket-specific rate-limits and global rate-limits. In some rare edge cases, however, Discord implements other undocumented rules for rate-limiting, such as limits per attribute. These cannot be detected or handled normally by Hikari due to their undocumented nature, and will trigger this exception if they occur.
- hikari.errors.InternalServerError: If an internal error occurs on Discord while handling the request.
self,
sticker: Union[hikari.stickers.PartialSticker, hikari.snowflakes.Snowflake, int]
) -> hikari.stickers.GuildSticker:
View Source
async def fetch_sticker(self, sticker: snowflakes.SnowflakeishOr[stickers.PartialSticker]) -> stickers.GuildSticker: """Fetch a sticker from the guild. Parameters ---------- sticker : snowflakes.SnowflakeishOr[hikari.stickers.PartialSticker] The sticker to fetch. This can be a sticker object or the ID of an existing sticker. Returns ------- hikari.stickers.GuildSticker The requested sticker. Raises ------ hikari.errors.ForbiddenError If you are not part of the server. hikari.errors.NotFoundError If the guild or the sticker are not found. hikari.errors.UnauthorizedError If you are unauthorized to make the request (invalid/missing token). hikari.errors.RateLimitTooLongError Raised in the event that a rate limit occurs that is longer than `max_rate_limit` when making a request. hikari.errors.RateLimitedError Usually, Hikari will handle and retry on hitting rate-limits automatically. This includes most bucket-specific rate-limits and global rate-limits. In some rare edge cases, however, Discord implements other undocumented rules for rate-limiting, such as limits per attribute. These cannot be detected or handled normally by Hikari due to their undocumented nature, and will trigger this exception if they occur. hikari.errors.InternalServerError If an internal error occurs on Discord while handling the request. """ return await self.app.rest.fetch_guild_sticker(self.id, sticker)
Fetch a sticker from the guild.
Parameters
- sticker (snowflakes.SnowflakeishOr[hikari.stickers.PartialSticker]): The sticker to fetch. This can be a sticker object or the ID of an existing sticker.
Returns
- hikari.stickers.GuildSticker: The requested sticker.
Raises
- hikari.errors.ForbiddenError: If you are not part of the server.
- hikari.errors.NotFoundError: If the guild or the sticker are not found.
- hikari.errors.UnauthorizedError: If you are unauthorized to make the request (invalid/missing token).
- hikari.errors.RateLimitTooLongError: Raised in the event that a rate limit occurs that is longer than
max_rate_limit
when making a request. - hikari.errors.RateLimitedError: Usually, Hikari will handle and retry on hitting rate-limits automatically. This includes most bucket-specific rate-limits and global rate-limits. In some rare edge cases, however, Discord implements other undocumented rules for rate-limiting, such as limits per attribute. These cannot be detected or handled normally by Hikari due to their undocumented nature, and will trigger this exception if they occur.
- hikari.errors.InternalServerError: If an internal error occurs on Discord while handling the request.
View Source
async def fetch_stickers(self) -> typing.Sequence[stickers.GuildSticker]: """Fetch the stickers of the guild. Returns ------- typing.Sequence[hikari.stickers.GuildSticker] The requested stickers. Raises ------ hikari.errors.ForbiddenError If you are not part of the server. hikari.errors.NotFoundError If the guild is not found. hikari.errors.UnauthorizedError If you are unauthorized to make the request (invalid/missing token). hikari.errors.RateLimitTooLongError Raised in the event that a rate limit occurs that is longer than `max_rate_limit` when making a request. hikari.errors.RateLimitedError Usually, Hikari will handle and retry on hitting rate-limits automatically. This includes most bucket-specific rate-limits and global rate-limits. In some rare edge cases, however, Discord implements other undocumented rules for rate-limiting, such as limits per attribute. These cannot be detected or handled normally by Hikari due to their undocumented nature, and will trigger this exception if they occur. hikari.errors.InternalServerError If an internal error occurs on Discord while handling the request. """ return await self.app.rest.fetch_guild_stickers(self.id)
Fetch the stickers of the guild.
Returns
- typing.Sequence[hikari.stickers.GuildSticker]: The requested stickers.
Raises
- hikari.errors.ForbiddenError: If you are not part of the server.
- hikari.errors.NotFoundError: If the guild is not found.
- hikari.errors.UnauthorizedError: If you are unauthorized to make the request (invalid/missing token).
- hikari.errors.RateLimitTooLongError: Raised in the event that a rate limit occurs that is longer than
max_rate_limit
when making a request. - hikari.errors.RateLimitedError: Usually, Hikari will handle and retry on hitting rate-limits automatically. This includes most bucket-specific rate-limits and global rate-limits. In some rare edge cases, however, Discord implements other undocumented rules for rate-limiting, such as limits per attribute. These cannot be detected or handled normally by Hikari due to their undocumented nature, and will trigger this exception if they occur.
- hikari.errors.InternalServerError: If an internal error occurs on Discord while handling the request.
self,
user: Union[hikari.users.PartialUser, hikari.snowflakes.Snowflake, int],
*,
reason: Union[str, hikari.undefined.UndefinedType] = UNDEFINED
) -> None:
View Source
async def kick( self, user: snowflakes.SnowflakeishOr[users.PartialUser], *, reason: undefined.UndefinedOr[str] = undefined.UNDEFINED, ) -> None: """Kicks the given user from this guild. Parameters ---------- user: hikari.snowflakes.Snowflakeish[hikari.users.PartialUser] The user to kick from the guild Other Parameters ---------------- reason : hikari.undefined.UndefinedOr[str] If provided, the reason that will be recorded in the audit logs. Maximum of 512 characters. Raises ------ hikari.errors.BadRequestError If any of the fields that are passed have an invalid value. hikari.errors.ForbiddenError If you are missing the `KICK_MEMBERS` permission. hikari.errors.UnauthorizedError If you are unauthorized to make the request (invalid/missing token). hikari.errors.NotFoundError If the guild or user are not found. hikari.errors.RateLimitTooLongError Raised in the event that a rate limit occurs that is longer than `max_rate_limit` when making a request. hikari.errors.RateLimitedError Usually, Hikari will handle and retry on hitting rate-limits automatically. This includes most bucket-specific rate-limits and global rate-limits. In some rare edge cases, however, Discord implements other undocumented rules for rate-limiting, such as limits per attribute. These cannot be detected or handled normally by Hikari due to their undocumented nature, and will trigger this exception if they occur. hikari.errors.InternalServerError If an internal error occurs on Discord while handling the request. """ await self.app.rest.kick_user(self.id, user, reason=reason)
Kicks the given user from this guild.
Parameters
- user (hikari.snowflakes.Snowflakeish[hikari.users.PartialUser]): The user to kick from the guild
Other Parameters
- reason (hikari.undefined.UndefinedOr[str]): If provided, the reason that will be recorded in the audit logs. Maximum of 512 characters.
Raises
- hikari.errors.BadRequestError: If any of the fields that are passed have an invalid value.
- hikari.errors.ForbiddenError: If you are missing the
KICK_MEMBERS
permission. - hikari.errors.UnauthorizedError: If you are unauthorized to make the request (invalid/missing token).
- hikari.errors.NotFoundError: If the guild or user are not found.
- hikari.errors.RateLimitTooLongError: Raised in the event that a rate limit occurs that is longer than
max_rate_limit
when making a request. - hikari.errors.RateLimitedError: Usually, Hikari will handle and retry on hitting rate-limits automatically. This includes most bucket-specific rate-limits and global rate-limits. In some rare edge cases, however, Discord implements other undocumented rules for rate-limiting, such as limits per attribute. These cannot be detected or handled normally by Hikari due to their undocumented nature, and will trigger this exception if they occur.
- hikari.errors.InternalServerError: If an internal error occurs on Discord while handling the request.
self,
*,
ext: Optional[str] = None,
size: int = 4096
) -> Optional[hikari.files.URL]:
View Source
def make_icon_url(self, *, ext: typing.Optional[str] = None, size: int = 4096) -> typing.Optional[files.URL]: """Generate the guild's icon URL, if set. Parameters ---------- ext : typing.Optional[str] The extension to use for this URL, defaults to `png` or `gif`. 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. size : int The size to set for the URL, defaults to `4096`. Can be any power of two between 16 and 4096. Returns ------- typing.Optional[hikari.files.URL] The URL to the resource, or `None` if no icon is set. Raises ------ ValueError If `size` is not a power of two or not between 16 and 4096. """ if self.icon_hash is None: return None if ext is None: if self.icon_hash.startswith("a_"): ext = "gif" else: ext = "png" return routes.CDN_GUILD_ICON.compile_to_file( urls.CDN_URL, guild_id=self.id, hash=self.icon_hash, size=size, file_format=ext, )
Generate the guild's icon URL, if set.
Parameters
ext (typing.Optional[str]): The extension to use for this URL, defaults to
png
orgif
. Supportspng
,jpeg
,jpg
,webp
andgif
(when animated).If
None
, then the correct default extension is determined based on whether the icon is animated or not.- size (int): The size to set for the URL, defaults to
4096
. Can be any power of two between 16 and 4096.
Returns
- typing.Optional[hikari.files.URL]: The URL to the resource, or
None
if no icon is set.
Raises
- ValueError: If
size
is not a power of two or not between 16 and 4096.
self,
user: Union[hikari.users.PartialUser, hikari.snowflakes.Snowflake, int],
*,
reason: Union[str, hikari.undefined.UndefinedType] = UNDEFINED
) -> None:
View Source
async def unban( self, user: snowflakes.SnowflakeishOr[users.PartialUser], *, reason: undefined.UndefinedOr[str] = undefined.UNDEFINED, ) -> None: """Unban the given user from this guild. Parameters ---------- user: hikari.snowflakes.Snowflakeish[hikari.users.PartialUser] The user to unban from the guild Other Parameters ---------------- reason : hikari.undefined.UndefinedOr[str] If provided, the reason that will be recorded in the audit logs. Maximum of 512 characters. Raises ------ hikari.errors.BadRequestError If any of the fields that are passed have an invalid value. hikari.errors.ForbiddenError If you are missing the `BAN_MEMBERS` permission. hikari.errors.UnauthorizedError If you are unauthorized to make the request (invalid/missing token). hikari.errors.NotFoundError If the guild or user are not found. hikari.errors.RateLimitTooLongError Raised in the event that a rate limit occurs that is longer than `max_rate_limit` when making a request. hikari.errors.RateLimitedError Usually, Hikari will handle and retry on hitting rate-limits automatically. This includes most bucket-specific rate-limits and global rate-limits. In some rare edge cases, however, Discord implements other undocumented rules for rate-limiting, such as limits per attribute. These cannot be detected or handled normally by Hikari due to their undocumented nature, and will trigger this exception if they occur. hikari.errors.InternalServerError If an internal error occurs on Discord while handling the request. """ await self.app.rest.unban_user(self.id, user, reason=reason)
Unban the given user from this guild.
Parameters
- user (hikari.snowflakes.Snowflakeish[hikari.users.PartialUser]): The user to unban from the guild
Other Parameters
- reason (hikari.undefined.UndefinedOr[str]): If provided, the reason that will be recorded in the audit logs. Maximum of 512 characters.
Raises
- hikari.errors.BadRequestError: If any of the fields that are passed have an invalid value.
- hikari.errors.ForbiddenError: If you are missing the
BAN_MEMBERS
permission. - hikari.errors.UnauthorizedError: If you are unauthorized to make the request (invalid/missing token).
- hikari.errors.NotFoundError: If the guild or user are not found.
- hikari.errors.RateLimitTooLongError: Raised in the event that a rate limit occurs that is longer than
max_rate_limit
when making a request. - hikari.errors.RateLimitedError: Usually, Hikari will handle and retry on hitting rate-limits automatically. This includes most bucket-specific rate-limits and global rate-limits. In some rare edge cases, however, Discord implements other undocumented rules for rate-limiting, such as limits per attribute. These cannot be detected or handled normally by Hikari due to their undocumented nature, and will trigger this exception if they occur.
- hikari.errors.InternalServerError: If an internal error occurs on Discord while handling the request.
View Source
@attr_extensions.with_copy @attr.define(hash=True, kw_only=True, weakref_slot=False) class TemplateRole(guilds.PartialRole): """The partial role object attached to `Template`.""" permissions: permissions_.Permissions = attr.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. """ color: colors.Color = attr.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: bool = attr.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: bool = attr.field(eq=False, hash=False, repr=False) """Whether this role can be mentioned by all regardless of permissions."""
The partial role object attached to Template
.
Variables and properties
The client application that models may use for procedures.
The colour of this role.
This will be applied to a member's name in chat if it's their top coloured role.
When the object was created.
The ID of this entity.
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
.
Whether this role can be mentioned by all regardless of permissions.
Return a raw mention string for the role.
The role's name.
The guild wide permissions this role gives to the members it's attached to,
This may be overridden by channel overwrites.
Methods
self,
*,
app: 'traits.RESTAware',
id: hikari.snowflakes.Snowflake,
name: str,
permissions: hikari.permissions.Permissions,
color: hikari.colors.Color,
is_hoisted: bool,
is_mentionable: bool
):
View Source
def __init__(self, *, app, id, name, permissions, color, is_hoisted, is_mentionable): self.app = app self.id = id self.name = name self.permissions = permissions self.color = color self.is_hoisted = is_hoisted self.is_mentionable = is_mentionable
Method generated by attrs for class TemplateRole.