Application and entities that are used to describe guild templates on Discord.
# -*- 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.List[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 locales
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 `builtins.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: typing.Union[str, locales.Locale] = 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 `builtins.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 `builtins.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}"
class Template (
*,
code: str,
name: str,
description: Optional[str],
usage_count: int,
creator: users.User,
created_at: datetime.datetime,
updated_at: datetime.datetime,
source_guild: TemplateGuild,
is_unsynced: bool,
): ...
Represents a template used for creating guilds.
Method generated by attrs for class Template.
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}"
property created_at : datetime.datetime
When the template was created.
property creator : users.User
The user who created the template.
property description : Optional[str]
The template's description.
property is_unsynced : bool
Whether this template is missing changes from it's source guild.
property source_guild : TemplateGuild
The partial object of the guild this template is based on.
property updated_at : datetime.datetime
When the template was last synced with the source guild.
property usage_count : int
The number of times the template has been used to create a guild.
class TemplateGuild (
*,
app: traits.RESTAware,
id: snowflakes.Snowflake,
icon_hash: Optional[str],
name: str,
description: Optional[str],
verification_level: Union[guilds.GuildVerificationLevel, int],
default_message_notifications: Union[guilds.GuildMessageNotificationsLevel, int],
explicit_content_filter: Union[guilds.GuildExplicitContentFilterLevel, int],
preferred_locale: Union[str, locales.Locale],
afk_timeout: datetime.timedelta,
roles: Mapping[snowflakes.Snowflake, TemplateRole],
channels: Mapping[snowflakes.Snowflake, channels_.GuildChannel],
afk_channel_id: Optional[snowflakes.Snowflake],
system_channel_id: Optional[snowflakes.Snowflake],
system_channel_flags: guilds.GuildSystemChannelFlag,
): ...
The partial guild object attached to Template
.
Method generated by attrs for class TemplateGuild.
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: typing.Union[str, locales.Locale] = 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 `builtins.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 `builtins.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.
"""
Base object for any partial guild objects …
Mixin for a class that enforces uniqueness by a snowflake ID.
Helper class that provides a standard way to create an ABC using inheritance.
property afk_channel_id : Optional[snowflakes.Snowflake]
The ID for the channel that AFK voice users get sent to.
If None
, then no AFK channel is set up for this guild.
property afk_timeout : datetime.timedelta
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
).
property app : traits.RESTAware
The client application that models may use for procedures.
property channels : Mapping[snowflakes.Snowflake, channels_.GuildChannel]
The channels for the guild.
Note
id
will be a unique placeholder on all
the channel objects found attached this template guild.
property created_at : datetime.datetime
When the object was created.
property default_message_notifications : Union[guilds.GuildMessageNotificationsLevel, int]
The default setting for message notifications in this guild.
property description : Optional[str]
The guild's description, if set.
property explicit_content_filter : Union[guilds.GuildExplicitContentFilterLevel, int]
The setting for the explicit content filter in this guild.
property id : snowflakes.Snowflake
The ID of this entity.
property preferred_locale : Union[str, locales.Locale]
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
.
property roles : Mapping[snowflakes.Snowflake, TemplateRole]
The roles in the guild.
Note
id
will be a unique placeholder on all the role
objects found attached this template guild.
property shard_id : Optional[int]
Return the ID of the shard this guild is served by.
This may return None
if the application does not have a gateway
connection.
property system_channel_flags : guilds.GuildSystemChannelFlag
Return flags for the guild system channel.
These are used to describe which notifications are suppressed.
property system_channel_id : Optional[snowflakes.Snowflake]
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.
property verification_level : Union[guilds.GuildVerificationLevel, int]
The verification level needed for a user to participate in this guild.
async def ban(
user: snowflakes.SnowflakeishOr[users.PartialUser],
*,
delete_message_days: undefined.UndefinedOr[int] = UNDEFINED,
reason: undefined.UndefinedOr[str] = UNDEFINED,
) -> None: ...
Inherited from:
PartialGuild
.ban
Ban the given user from this guild.
user
: Snowflakeish[PartialUser]
delete_message_days
: UndefinedNoneOr[int]
reason
: UndefinedOr[str]
BadRequestError
ForbiddenError
BAN_MEMBERS
permission.UnauthorizedError
NotFoundError
RateLimitTooLongError
max_rate_limit
when making a request.RateLimitedError
InternalServerError
async def create_category(
name: str,
*,
position: undefined.UndefinedOr[int] = UNDEFINED,
permission_overwrites: undefined.UndefinedOr[Sequence[channels_.PermissionOverwrite]] = UNDEFINED,
reason: undefined.UndefinedOr[str] = UNDEFINED,
) -> GuildCategory: ...
Inherited from:
PartialGuild
.create_category
Create a category in the guild.
name
: str
position
: UndefinedOr[int]
permission_overwrites
: UndefinedOr[Sequence[PermissionOverwrite]]
reason
: UndefinedOr[str]
GuildCategory
BadRequestError
ForbiddenError
MANAGE_CHANNEL
permission.UnauthorizedError
NotFoundError
RateLimitTooLongError
max_rate_limit
when making a request.RateLimitedError
InternalServerError
async def create_news_channel(
name: str,
*,
position: undefined.UndefinedOr[int] = UNDEFINED,
topic: undefined.UndefinedOr[str] = UNDEFINED,
nsfw: undefined.UndefinedOr[bool] = UNDEFINED,
rate_limit_per_user: undefined.UndefinedOr[time.Intervalish] = UNDEFINED,
permission_overwrites: undefined.UndefinedOr[Sequence[channels_.PermissionOverwrite]] = UNDEFINED,
category: undefined.UndefinedOr[snowflakes.SnowflakeishOr[channels_.GuildCategory]] = UNDEFINED,
reason: undefined.UndefinedOr[str] = UNDEFINED,
) -> GuildNewsChannel: ...
Inherited from:
PartialGuild
.create_news_channel
Create a news channel in the guild.
name
: str
position
: UndefinedOr[int]
topic
: UndefinedOr[str]
nsfw
: UndefinedOr[bool]
rate_limit_per_user
: UndefinedOr[Intervalish]
permission_overwrites
: UndefinedOr[Sequence[PermissionOverwrite]]
category
: UndefinedOr[SnowflakeishOr[GuildCategory]]
reason
: UndefinedOr[str]
GuildNewsChannel
BadRequestError
ForbiddenError
MANAGE_CHANNEL
permission.UnauthorizedError
NotFoundError
RateLimitTooLongError
max_rate_limit
when making a request.RateLimitedError
InternalServerError
async def create_stage_channel(
name: str,
*,
position: undefined.UndefinedOr[int] = UNDEFINED,
user_limit: undefined.UndefinedOr[int] = UNDEFINED,
bitrate: undefined.UndefinedOr[int] = UNDEFINED,
permission_overwrites: undefined.UndefinedOr[Sequence[channels_.PermissionOverwrite]] = UNDEFINED,
region: undefined.UndefinedOr[Union[voices_.VoiceRegion, str]] = UNDEFINED,
category: undefined.UndefinedOr[snowflakes.SnowflakeishOr[channels_.GuildCategory]] = UNDEFINED,
reason: undefined.UndefinedOr[str] = UNDEFINED,
) -> channels_.GuildStageChannel: ...
Inherited from:
PartialGuild
.create_stage_channel
Create a stage channel in the guild.
name
: str
position
: UndefinedOr[int]
user_limit
: UndefinedOr[int]
bitrate
: UndefinedOr[int]
permission_overwrites
: UndefinedOr[Sequence[PermissionOverwrite]]
region
: UndefinedOr[Union[VoiceRegion, str]]
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
: UndefinedOr[SnowflakeishOr[GuildCategory]]
reason
: UndefinedOr[str]
GuildStageChannel
BadRequestError
ForbiddenError
MANAGE_CHANNEL
permission.UnauthorizedError
NotFoundError
RateLimitTooLongError
max_rate_limit
when making a request.RateLimitedError
InternalServerError
async def create_sticker(
name: str,
tag: str,
image: files.Resourceish,
*,
description: undefined.UndefinedOr[str] = UNDEFINED,
reason: undefined.UndefinedOr[str] = UNDEFINED,
) -> stickers.GuildSticker: ...
Inherited from:
PartialGuild
.create_sticker
Create a sticker in a guild.
name
: str
tag
: str
image
: Resourceish
The 320x320 image for the sticker. Maximum upload size is 500kb. This can be a still or an animated PNG or a Lottie.
Note
Lottie support is only available for verified and partnered servers.
description
: UndefinedOr[str]
reason
: UndefinedOr[str]
GuildSticker
BadRequestError
ForbiddenError
MANAGE_EMOJIS_AND_STICKERS
in the server.NotFoundError
UnauthorizedError
RateLimitTooLongError
max_rate_limit
when making a request.RateLimitedError
InternalServerError
async def create_text_channel(
name: str,
*,
position: undefined.UndefinedOr[int] = UNDEFINED,
topic: undefined.UndefinedOr[str] = UNDEFINED,
nsfw: undefined.UndefinedOr[bool] = UNDEFINED,
rate_limit_per_user: undefined.UndefinedOr[time.Intervalish] = UNDEFINED,
permission_overwrites: undefined.UndefinedOr[Sequence[channels_.PermissionOverwrite]] = UNDEFINED,
category: undefined.UndefinedOr[snowflakes.SnowflakeishOr[channels_.GuildCategory]] = UNDEFINED,
reason: undefined.UndefinedOr[str] = UNDEFINED,
) -> GuildTextChannel: ...
Inherited from:
PartialGuild
.create_text_channel
Create a text channel in the guild.
name
: str
position
: UndefinedOr[int]
topic
: UndefinedOr[str]
nsfw
: UndefinedOr[bool]
rate_limit_per_user
: UndefinedOr[Intervalish]
permission_overwrites
: UndefinedOr[Sequence[PermissionOverwrite]]
category
: UndefinedOr[SnowflakeishOr[GuildCategory]]
reason
: UndefinedOr[str]
GuildTextChannel
BadRequestError
ForbiddenError
MANAGE_CHANNEL
permission.UnauthorizedError
NotFoundError
RateLimitTooLongError
max_rate_limit
when making a request.RateLimitedError
InternalServerError
async def create_voice_channel(
name: str,
*,
position: undefined.UndefinedOr[int] = UNDEFINED,
user_limit: undefined.UndefinedOr[int] = UNDEFINED,
bitrate: undefined.UndefinedOr[int] = UNDEFINED,
video_quality_mode: undefined.UndefinedOr[Union[channels_.VideoQualityMode, int]] = UNDEFINED,
permission_overwrites: undefined.UndefinedOr[Sequence[channels_.PermissionOverwrite]] = UNDEFINED,
region: undefined.UndefinedOr[Union[voices_.VoiceRegion, str]] = UNDEFINED,
category: undefined.UndefinedOr[snowflakes.SnowflakeishOr[channels_.GuildCategory]] = UNDEFINED,
reason: undefined.UndefinedOr[str] = UNDEFINED,
) -> channels_.GuildVoiceChannel: ...
Inherited from:
PartialGuild
.create_voice_channel
Create a voice channel in a guild.
guild
: SnowflakeishOr[PartialGuild]
name
: str
position
: UndefinedOr[int]
user_limit
: UndefinedOr[int]
bitrate
: UndefinedOr[int]
video_quality_mode
: UndefinedOr[Union[VideoQualityMode, int]]
permission_overwrites
: UndefinedOr[Sequence[PermissionOverwrite]]
region
: UndefinedOr[Union[VoiceRegion, str]]
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
: UndefinedOr[SnowflakeishOr[GuildCategory]]
reason
: UndefinedOr[str]
GuildVoiceChannel
BadRequestError
ForbiddenError
MANAGE_CHANNEL
permission.UnauthorizedError
NotFoundError
RateLimitTooLongError
max_rate_limit
when making a request.RateLimitedError
InternalServerError
async def delete_channel(
channel: snowflakes.SnowflakeishOr[channels_.GuildChannel],
) -> GuildChannel: ...
Inherited from:
PartialGuild
.delete_channel
Delete a channel in the guild.
Note
This method can also be used for deleting guild categories as well.
channel
: SnowflakeishOr[GuildChannel]
GuildChannel
ForbiddenError
MANAGE_CHANNEL
permission in the channel.NotFoundError
RateLimitTooLongError
max_rate_limit
when making a request.RateLimitedError
InternalServerError
Note
For Public servers, the set 'Rules' or 'Guidelines' channels and the 'Public Server Updates' channel cannot be deleted.
async def delete_sticker(
sticker: snowflakes.SnowflakeishOr[stickers.PartialSticker],
*,
reason: undefined.UndefinedOr[str] = UNDEFINED,
) -> None: ...
Inherited from:
PartialGuild
.delete_sticker
Delete a sticker in a guild.
sticker
: SnowflakeishOr[PartialSticker]
reason
: UndefinedOr[str]
ForbiddenError
MANAGE_EMOJIS_AND_STICKERS
in the server.NotFoundError
UnauthorizedError
RateLimitTooLongError
max_rate_limit
when making a request.RateLimitedError
InternalServerError
async def edit(
*,
name: undefined.UndefinedOr[str] = UNDEFINED,
verification_level: undefined.UndefinedOr[GuildVerificationLevel] = UNDEFINED,
default_message_notifications: undefined.UndefinedOr[GuildMessageNotificationsLevel] = UNDEFINED,
explicit_content_filter_level: undefined.UndefinedOr[GuildExplicitContentFilterLevel] = UNDEFINED,
afk_channel: undefined.UndefinedOr[snowflakes.SnowflakeishOr[channels_.GuildVoiceChannel]] = UNDEFINED,
afk_timeout: undefined.UndefinedOr[time.Intervalish] = UNDEFINED,
icon: undefined.UndefinedNoneOr[files.Resourceish] = UNDEFINED,
owner: undefined.UndefinedOr[snowflakes.SnowflakeishOr[users.PartialUser]] = UNDEFINED,
splash: undefined.UndefinedNoneOr[files.Resourceish] = UNDEFINED,
banner: undefined.UndefinedNoneOr[files.Resourceish] = UNDEFINED,
system_channel: undefined.UndefinedNoneOr[snowflakes.SnowflakeishOr[channels_.GuildTextChannel]] = UNDEFINED,
rules_channel: undefined.UndefinedNoneOr[snowflakes.SnowflakeishOr[channels_.GuildTextChannel]] = UNDEFINED,
public_updates_channel: undefined.UndefinedNoneOr[snowflakes.SnowflakeishOr[channels_.GuildTextChannel]] = UNDEFINED,
preferred_locale: undefined.UndefinedOr[Union[str, locales.Locale]] = UNDEFINED,
reason: undefined.UndefinedOr[str] = UNDEFINED,
) -> RESTGuild: ...
Inherited from:
PartialGuild
.edit
Edits the guild.
name
: UndefinedOr[str]
verification_level
: UndefinedOr[GuildVerificationLevel]
default_message_notifications
: UndefinedOr[GuildMessageNotificationsLevel]
explicit_content_filter_level
: UndefinedOr[GuildExplicitContentFilterLevel]
afk_channel
: UndefinedOr[SnowflakeishOr[GuildVoiceChannel]]
afk_timeout
to
be set to work.afk_timeout
: UndefinedOr[Intervalish]
icon
: UndefinedOr[Resourceish]
ANIMATED_ICON
feature.owner
: UndefinedOr[SnowflakeishOr[PartialUser]]]
If provided, the new guild owner.
Warning
You need to be the owner of the server to use this.
splash
: UndefinedNoneOr[Resourceish]
INVITE_SPLASH
feature.banner
: UndefinedNoneOr[Resourceish]
BANNER
feature.system_channel
: UndefinedNoneOr[SnowflakeishOr[GuildTextChannel]]
rules_channel
: UndefinedNoneOr[SnowflakeishOr[GuildTextChannel]]
public_updates_channel
: UndefinedNoneOr[SnowflakeishOr[GuildTextChannel]]
preferred_locale
: UndefinedNoneOr[str]
reason
: UndefinedOr[str]
RESTGuild
BadRequestError
ForbiddenError
MANAGE_GUILD
permission or if you tried to
pass ownership without being the server owner.UnauthorizedError
NotFoundError
RateLimitTooLongError
max_rate_limit
when making a request.RateLimitedError
InternalServerError
async def edit_sticker(
sticker: snowflakes.SnowflakeishOr[stickers.PartialSticker],
*,
name: undefined.UndefinedOr[str] = UNDEFINED,
description: undefined.UndefinedOr[str] = UNDEFINED,
tag: undefined.UndefinedOr[str] = UNDEFINED,
reason: undefined.UndefinedOr[str] = UNDEFINED,
) -> GuildSticker: ...
Inherited from:
PartialGuild
.edit_sticker
Edit a sticker in a guild.
sticker
: SnowflakeishOr[PartialSticker]
name
: UndefinedOr[str]
description
: UndefinedOr[str]
tag
: UndefinedOr[str]
reason
: UndefinedOr[str]
GuildSticker
BadRequestError
ForbiddenError
MANAGE_EMOJIS_AND_STICKERS
in the server.NotFoundError
UnauthorizedError
RateLimitTooLongError
max_rate_limit
when making a request.RateLimitedError
InternalServerError
async def fetch_emoji(
emoji: snowflakes.SnowflakeishOr[emojis_.CustomEmoji],
) -> emojis_.KnownCustomEmoji: ...
Inherited from:
PartialGuild
.fetch_emoji
Fetch an emoji from the guild.
emoji
: SnowflakeishOr[CustomEmoji]
CustomEmoji
or the ID of an existing emoji.KnownCustomEmoji
NotFoundError
UnauthorizedError
RateLimitTooLongError
max_rate_limit
when making a request.RateLimitedError
InternalServerError
async def fetch_emojis() -> Sequence[emojis_.KnownCustomEmoji]: ...
Inherited from:
PartialGuild
.fetch_emojis
Fetch the emojis of the guild.
Sequence[KnownCustomEmoji]
NotFoundError
UnauthorizedError
RateLimitTooLongError
max_rate_limit
when making a request.RateLimitedError
InternalServerError
async def fetch_roles() -> Sequence[Role]: ...
Inherited from:
PartialGuild
.fetch_roles
Fetch the roles of the guild.
UnauthorizedError
RateLimitTooLongError
max_rate_limit
when making a request.RateLimitedError
InternalServerError
async def fetch_self() -> RESTGuild: ...
Inherited from:
PartialGuild
.fetch_self
Fetch the guild.
RESTGuild
ForbiddenError
NotFoundError
UnauthorizedError
RateLimitTooLongError
max_rate_limit
when making a request.RateLimitedError
InternalServerError
async def fetch_sticker(
sticker: snowflakes.SnowflakeishOr[stickers.PartialSticker],
) -> GuildSticker: ...
Inherited from:
PartialGuild
.fetch_sticker
Fetch a sticker from the guild.
sticker
: snowflakes.SnowflakeishOr[PartialSticker]
GuildSticker
ForbiddenError
NotFoundError
UnauthorizedError
RateLimitTooLongError
max_rate_limit
when making a request.RateLimitedError
InternalServerError
async def fetch_stickers() -> Sequence[GuildSticker]: ...
Inherited from:
PartialGuild
.fetch_stickers
Fetch the stickers of the guild.
Sequence[GuildSticker]
ForbiddenError
NotFoundError
UnauthorizedError
RateLimitTooLongError
max_rate_limit
when making a request.RateLimitedError
InternalServerError
async def kick(
user: snowflakes.SnowflakeishOr[users.PartialUser],
*,
reason: undefined.UndefinedOr[str] = UNDEFINED,
) -> None: ...
Inherited from:
PartialGuild
.kick
Kicks the given user from this guild.
user
: Snowflakeish[PartialUser]
reason
: UndefinedOr[str]
BadRequestError
ForbiddenError
KICK_MEMBERS
permission.UnauthorizedError
NotFoundError
RateLimitTooLongError
max_rate_limit
when making a request.RateLimitedError
InternalServerError
def make_icon_url(
*,
ext: Optional[str] = None,
size: int = 4096,
) -> Optional[files.URL]: ...
Inherited from:
PartialGuild
.make_icon_url
Generate the guild's icon URL, if set.
ext
: 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
4096
.
Can be any power of two between 16 and 4096.ValueError
size
is not a power of two or not between 16 and 4096.async def unban(
user: snowflakes.SnowflakeishOr[users.PartialUser],
*,
reason: undefined.UndefinedOr[str] = UNDEFINED,
) -> None: ...
Inherited from:
PartialGuild
.unban
Unban the given user from this guild.
user
: Snowflakeish[PartialUser]
reason
: UndefinedOr[str]
BadRequestError
ForbiddenError
BAN_MEMBERS
permission.UnauthorizedError
NotFoundError
RateLimitTooLongError
max_rate_limit
when making a request.RateLimitedError
InternalServerError
class TemplateRole (
*,
app: traits.RESTAware,
id: snowflakes.Snowflake,
name: str,
permissions: permissions_.Permissions,
color: colors.Color,
is_hoisted: bool,
is_mentionable: bool,
): ...
The partial role object attached to Template
.
Method generated by attrs for class TemplateRole.
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 `builtins.True`.
"""
is_mentionable: bool = attr.field(eq=False, hash=False, repr=False)
"""Whether this role can be mentioned by all regardless of permissions."""
Represents a partial guild bound Role object …
Mixin for a class that enforces uniqueness by a snowflake ID.
Helper class that provides a standard way to create an ABC using inheritance.
property app : traits.RESTAware
The client application that models may use for procedures.
property color : colors.Color
The colour of this role.
This will be applied to a member's name in chat if it's their top coloured role.
property created_at : datetime.datetime
When the object was created.
property id : snowflakes.Snowflake
The ID of this entity.
property is_hoisted : bool
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
.
property is_mentionable : bool
Whether this role can be mentioned by all regardless of permissions.
property mention : str
Return a raw mention string for the role.
str
property permissions : permissions_.Permissions
The guild wide permissions this role gives to the members it's attached to,
This may be overridden by channel overwrites.