Skip to content

hikari.guilds#

Application and entities that are used to describe guilds on Discord.

BulkBanResponse #

The result of a bulk ban.

banned_users class-attribute instance-attribute #

banned_users: Sequence[Snowflake] = attrs.field(repr=True)

IDs of the users which were successfully banned.

failed_users class-attribute instance-attribute #

failed_users: Sequence[Snowflake] = attrs.field(repr=True)

IDs of the users which could not be banned.

A user ends up here when they could not be banned or were already banned.

GatewayGuild #

Bases: Guild

Guild specialization that is sent via the gateway only.

is_large class-attribute instance-attribute #

is_large: bool | None = attrs.field(
    eq=False, hash=False, repr=False
)

Whether the guild is considered to be large or not.

This information is only available if the guild was sent via a GUILD_CREATE event. If the guild is received from any other place, this will always be None.

The implications of a large guild are that presence information will not be sent about members who are offline or invisible.

joined_at class-attribute instance-attribute #

joined_at: datetime | None = attrs.field(
    eq=False, hash=False, repr=False
)

The date and time that the bot user joined this guild.

This information is only available if the guild was sent via a GUILD_CREATE event. If the guild is received from any other place, this will always be None.

member_count class-attribute instance-attribute #

member_count: int | None = attrs.field(
    eq=False, hash=False, repr=False
)

The number of members in this guild.

This information is only available if the guild was sent via a GUILD_CREATE event. If the guild is received from any other place, this will always be None.

Guild #

Bases: PartialGuild

A representation of a guild on Discord.

afk_channel_id class-attribute instance-attribute #

afk_channel_id: Snowflake | None = attrs.field(
    eq=False, hash=False, repr=False
)

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

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

afk_timeout class-attribute instance-attribute #

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

Timeout for activity before a member is classed as AFK.

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

application_id class-attribute instance-attribute #

application_id: Snowflake | None = attrs.field(
    eq=False, hash=False, repr=False
)

The ID of the application that created this guild.

This will always be None for guilds that weren't created by a bot.

banner_hash class-attribute instance-attribute #

banner_hash: str | None = attrs.field(
    eq=False, hash=False, repr=False
)

The hash for the guild's banner.

This is only present if the guild has hikari.guilds.GuildFeature.BANNER in hikari.guilds.Guild.features for this guild. For all other purposes, it is None.

default_message_notifications class-attribute instance-attribute #

default_message_notifications: (
    GuildMessageNotificationsLevel | int
) = attrs.field(eq=False, hash=False, repr=False)

The default setting for message notifications in this guild.

description class-attribute instance-attribute #

description: str | None = attrs.field(
    eq=False, hash=False, repr=False
)

The guild's description.

This is only present if certain hikari.guilds.GuildFeature's are set in hikari.guilds.Guild.features for this guild. Otherwise, this will always be None.

discovery_splash_hash class-attribute instance-attribute #

discovery_splash_hash: str | None = attrs.field(
    eq=False, hash=False, repr=False
)

The hash of the discovery splash for the guild, if there is one.

explicit_content_filter class-attribute instance-attribute #

explicit_content_filter: (
    GuildExplicitContentFilterLevel | int
) = attrs.field(eq=False, hash=False, repr=False)

The setting for the explicit content filter in this guild.

features class-attribute instance-attribute #

features: Sequence[str | GuildFeature] = attrs.field(
    eq=False, hash=False, repr=False
)

A list of the features in this guild.

incidents class-attribute instance-attribute #

incidents: GuildIncidents = attrs.field(
    eq=False, hash=False, repr=False
)

The state of the active incidents in this guild.

invites_disabled property #

invites_disabled: bool

Return whether the guild has invites disabled.

RETURNS DESCRIPTION
bool

True if self.incidents.invites_disabled_until is set, or if hikari.guilds.GuildFeature.INVITES_DISABLED is in self.features. False otherwise.

is_widget_enabled class-attribute instance-attribute #

is_widget_enabled: bool | None = attrs.field(
    eq=False, hash=False, repr=False
)

Describes whether the guild widget is enabled or not.

If this information is not present, this will be None.

max_video_channel_users class-attribute instance-attribute #

max_video_channel_users: int | None = attrs.field(
    eq=False, hash=False, repr=False
)

The maximum number of users allowed in a video channel together.

This information may not be present, in which case, it will be None.

mfa_level class-attribute instance-attribute #

mfa_level: GuildMFALevel | int = attrs.field(
    eq=False, hash=False, repr=False
)

The required MFA level for users wishing to participate in this guild.

nsfw_level class-attribute instance-attribute #

nsfw_level: GuildNSFWLevel = attrs.field(
    eq=False, hash=False, repr=False
)

The NSFW level of the guild.

owner_id class-attribute instance-attribute #

owner_id: Snowflake = attrs.field(
    eq=False, hash=False, repr=True
)

The ID of the owner of this guild.

preferred_locale class-attribute instance-attribute #

preferred_locale: str | Locale = attrs.field(
    eq=False, hash=False, repr=False
)

The preferred locale to use for this guild.

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

premium_subscription_count class-attribute instance-attribute #

premium_subscription_count: int | None = attrs.field(
    eq=False, hash=False, repr=False
)

The number of nitro boosts that the server currently has.

This information may not be present, in which case, it will be None.

premium_tier class-attribute instance-attribute #

premium_tier: GuildPremiumTier | int = attrs.field(
    eq=False, hash=False, repr=False
)

The premium tier for this guild.

public_updates_channel_id class-attribute instance-attribute #

public_updates_channel_id: Snowflake | None = attrs.field(
    eq=False, hash=False, repr=False
)

The channel ID of the channel where admins and moderators receive notices from Discord.

This is only present if hikari.guilds.GuildFeature.COMMUNITY is in hikari.guilds.Guild.features for this guild. For all other purposes, it should be considered to be None.

rules_channel_id class-attribute instance-attribute #

rules_channel_id: Snowflake | None = attrs.field(
    eq=False, hash=False, repr=False
)

The ID of the channel where rules and guidelines will be displayed.

If the hikari.guilds.GuildFeature.COMMUNITY feature is not defined, then this is None.

splash_hash class-attribute instance-attribute #

splash_hash: str | None = attrs.field(
    eq=False, hash=False, repr=False
)

The hash of the splash for the guild, if there is one.

system_channel_flags class-attribute instance-attribute #

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

Return flags for the guild system channel.

These are used to describe which notifications are suppressed.

system_channel_id class-attribute instance-attribute #

system_channel_id: Snowflake | None = attrs.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.

vanity_url_code class-attribute instance-attribute #

vanity_url_code: str | None = attrs.field(
    eq=False, hash=False, repr=False
)

The vanity URL code for the guild's vanity URL.

This is only present if hikari.guilds.GuildFeature.VANITY_URL is in hikari.guilds.Guild.features for this guild. If not, this will always be None.

verification_level class-attribute instance-attribute #

verification_level: GuildVerificationLevel | int = (
    attrs.field(eq=False, hash=False, repr=False)
)

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

widget_channel_id class-attribute instance-attribute #

widget_channel_id: Snowflake | None = attrs.field(
    eq=False, hash=False, repr=False
)

The channel ID that the widget's generated invite will send the user to.

If this information is unavailable or this is not enabled for the guild then this will be None.

fetch_afk_channel async #

fetch_afk_channel() -> GuildVoiceChannel | None

Fetch the channel that AFK voice users get sent to.

RETURNS DESCRIPTION
Optional[GuildVoiceChannel]

The AFK channel or None if not enabled.

RAISES DESCRIPTION
UnauthorizedError

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

ForbiddenError

If you are missing the hikari.permissions.Permissions.VIEW_CHANNEL permission in the channel.

NotFoundError

If the channel is not found.

RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

InternalServerError

If an internal error occurs on Discord while handling the request.

fetch_owner async #

fetch_owner() -> Member

Fetch the owner of the guild.

RETURNS DESCRIPTION
Member

The guild owner.

RAISES DESCRIPTION
UnauthorizedError

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

NotFoundError

If the guild or the user are not found.

RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

InternalServerError

If an internal error occurs on Discord while handling the request.

fetch_public_updates_channel async #

fetch_public_updates_channel() -> GuildTextChannel | None

Fetch channel ID of the channel where admins and moderators receive notices from Discord.

This is only present if hikari.guilds.GuildFeature.COMMUNITY is in hikari.guilds.Guild.features for this guild. For all other purposes, it should be considered to be None.

RETURNS DESCRIPTION
Optional[GuildTextChannel]

The channel where discord sends relevant updates to moderators and admins.

RAISES DESCRIPTION
UnauthorizedError

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

ForbiddenError

If you are missing the hikari.permissions.Permissions.VIEW_CHANNEL permission in the channel.

NotFoundError

If the channel is not found.

RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

InternalServerError

If an internal error occurs on Discord while handling the request.

fetch_rules_channel async #

fetch_rules_channel() -> GuildTextChannel | None

Fetch the channel where guilds display rules and guidelines.

If the hikari.guilds.GuildFeature.COMMUNITY feature is not defined, then this is None.

RETURNS DESCRIPTION
Optional[GuildTextChannel]

The channel where the rules of the guild are specified or else None.

RAISES DESCRIPTION
UnauthorizedError

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

ForbiddenError

If you are missing the hikari.permissions.Permissions.VIEW_CHANNEL permission in the channel.

NotFoundError

If the channel is not found.

RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

InternalServerError

If an internal error occurs on Discord while handling the request.

fetch_system_channel async #

fetch_system_channel() -> GuildTextChannel | None

Fetch the system channel.

RETURNS DESCRIPTION
Optional[GuildTextChannel]

The system channel for this guild or None if not enabled.

RAISES DESCRIPTION
UnauthorizedError

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

ForbiddenError

If you are missing the hikari.permissions.Permissions.VIEW_CHANNEL permission in the channel.

NotFoundError

If the channel is not found.

RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

InternalServerError

If an internal error occurs on Discord while handling the request.

fetch_widget_channel async #

fetch_widget_channel() -> GuildChannel | None

Fetch the widget channel.

This will be None if not set.

RETURNS DESCRIPTION
Optional[GuildChannel]

The channel the widget is linked to or else None.

RAISES DESCRIPTION
UnauthorizedError

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

ForbiddenError

If you are missing the hikari.permissions.Permissions.VIEW_CHANNEL permission in the channel.

NotFoundError

If the channel is not found.

RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

InternalServerError

If an internal error occurs on Discord while handling the request.

get_channel #

get_channel(
    channel: SnowflakeishOr[PartialChannel],
) -> PermissibleGuildChannel | None

Get a cached channel that belongs to the guild by it's ID or object.

PARAMETER DESCRIPTION
channel

The object or ID of the guild channel to get from the cache.

TYPE: SnowflakeishOr[PartialChannel]

RETURNS DESCRIPTION
Optional[GuildChannel]

The object of the guild channel found in cache or None.

get_channels #

Get the channels cached for the guild.

RETURNS DESCRIPTION
Mapping[Snowflake, GuildChannel]

A mapping of channel IDs to objects of the channels cached for the guild.

get_emoji #

get_emoji(
    emoji: SnowflakeishOr[CustomEmoji],
) -> KnownCustomEmoji | None

Get a cached emoji that belongs to the guild by it's ID or object.

PARAMETER DESCRIPTION
emoji

The object or ID of the emoji to get from the cache.

TYPE: SnowflakeishOr[CustomEmoji]

RETURNS DESCRIPTION
Optional[KnownCustomEmoji]

The object of the custom emoji if found in cache, else None.

get_emojis #

Return the emojis in this guild.

RETURNS DESCRIPTION
Mapping[Snowflake, KnownCustomEmoji]

A mapping of emoji IDs to the objects of emojis in this guild.

get_member #

get_member(
    user: SnowflakeishOr[PartialUser],
) -> Member | None

Get a cached member that belongs to the guild by it's user ID or object.

PARAMETER DESCRIPTION
user

The object or ID of the user to get the cached member for.

TYPE: SnowflakeishOr[PartialUser]

RETURNS DESCRIPTION
Optional[Member]

The cached member object if found, else None.

get_members #

get_members() -> Mapping[Snowflake, Member]

Get the members cached for the guild.

RETURNS DESCRIPTION
Mapping[Snowflake, Member]

A mapping of user IDs to objects of the members cached for the guild.

get_my_member #

get_my_member() -> Member | None

Return the cached member for the bot user in this guild, if known.

RETURNS DESCRIPTION
Optional[Member]

The cached member for this guild, or None if not known.

get_presence #

get_presence(
    user: SnowflakeishOr[PartialUser],
) -> MemberPresence | None

Get a cached presence that belongs to the guild by it's user ID or object.

PARAMETER DESCRIPTION
user

The object or ID of the user to get the cached presence for.

TYPE: SnowflakeishOr[PartialUser]

RETURNS DESCRIPTION
Optional[MemberPresence]

The cached presence object if found, else None.

get_presences #

get_presences() -> Mapping[Snowflake, MemberPresence]

Get the presences cached for the guild.

RETURNS DESCRIPTION
Mapping[Snowflake, MemberPresence]

A mapping of user IDs to objects of the presences cached for the guild.

get_role #

get_role(role: SnowflakeishOr[PartialRole]) -> Role | None

Get a cached role that belongs to the guild by it's ID or object.

PARAMETER DESCRIPTION
role

The object or ID of the role to get for this guild from the cache.

TYPE: SnowflakeishOr[PartialRole]

RETURNS DESCRIPTION
Optional[Role]

The object of the role found in cache, else None.

get_roles #

get_roles() -> Mapping[Snowflake, Role]

Return the roles in this guild.

RETURNS DESCRIPTION
Mapping[Snowflake, Role]

A mapping of role IDs to the objects of roles in this guild.

get_sticker #

get_sticker(
    sticker: SnowflakeishOr[GuildSticker],
) -> GuildSticker | None

Get a cached sticker that belongs to the guild by it's ID or object.

PARAMETER DESCRIPTION
sticker

The object or ID of the sticker to get from the cache.

TYPE: SnowflakeishOr[GuildSticker]

RETURNS DESCRIPTION
Optional[GuildSticker]

The object of the sticker if found in cache, else None.

get_stickers #

get_stickers() -> Mapping[Snowflake, GuildSticker]

Return the stickers in this guild.

RETURNS DESCRIPTION
Mapping[Snowflake, GuildSticker]

A mapping of sticker IDs to the objects of sticker in this guild.

get_voice_state #

get_voice_state(
    user: SnowflakeishOr[PartialUser],
) -> VoiceState | None

Get a cached voice state that belongs to the guild by it's user.

PARAMETER DESCRIPTION
user

The object or ID of the user to get the cached voice state for.

TYPE: SnowflakeishOr[PartialUser]

RETURNS DESCRIPTION
Optional[VoiceState]

The cached voice state object if found, else None.

get_voice_states #

get_voice_states() -> Mapping[Snowflake, VoiceState]

Get the voice states cached for the guild.

RETURNS DESCRIPTION
Mapping[Snowflake, VoiceState]

A mapping of user IDs to objects of the voice states cached for the guild.

make_banner_url #

make_banner_url(
    *,
    file_format: UndefinedOr[
        Literal[
            "PNG", "JPEG", "JPG", "WEBP", "AWEBP", "GIF"
        ]
    ] = UNDEFINED,
    size: int = 4096,
    lossless: bool = True,
) -> URL | None

Generate the banner URL for this guild, if set.

If no banner is set, this returns None.

PARAMETER DESCRIPTION
file_format

The format to use for this URL.

Supports PNG, JPEG, JPG, WEBP, AWEBP and GIF.

If not specified, the format will be determined based on whether the banner is animated or not.

TYPE: UndefinedOr[Literal['PNG', 'JPEG', 'JPG', 'WEBP', 'AWEBP', 'GIF']] DEFAULT: UNDEFINED

size

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

TYPE: int DEFAULT: 4096

lossless

Whether to return a lossless or compressed WEBP image; This is ignored if file_format is not WEBP or AWEBP.

TYPE: bool DEFAULT: True

RETURNS DESCRIPTION
Optional[URL]

The URL, or None if no banner is set.

RAISES DESCRIPTION
TypeError

If an invalid format is passed for file_format; If an animated format is requested for a static banner.

ValueError

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

make_discovery_splash_url #

make_discovery_splash_url(
    *,
    file_format: Literal[
        "PNG", "JPEG", "JPG", "WEBP"
    ] = "PNG",
    size: int = 4096,
    lossless: bool = True,
) -> URL | None

Generate the discovery splash URL for this guild, if set.

If no discovery splash is set, this returns None.

PARAMETER DESCRIPTION
file_format

The format to use for this URL.

Supports PNG, JPEG, JPG, and WEBP.

If not specified, the format will be PNG.

TYPE: Literal['PNG', 'JPEG', 'JPG', 'WEBP'] DEFAULT: 'PNG'

size

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

TYPE: int DEFAULT: 4096

lossless

Whether to return a lossless or compressed WEBP image; This is ignored if file_format is not WEBP.

TYPE: bool DEFAULT: True

RETURNS DESCRIPTION
Optional[URL]

The URL, or None if no discovery splash is set.

RAISES DESCRIPTION
TypeError

If an invalid format is passed for file_format.

ValueError

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

make_splash_url #

make_splash_url(
    *,
    file_format: Literal[
        "PNG", "JPEG", "JPG", "WEBP"
    ] = "PNG",
    size: int = 4096,
    lossless: bool = True,
) -> URL | None

Generate the splash URL for this guild, if set.

If no splash is set, this returns None.

PARAMETER DESCRIPTION
file_format

The format to use for this URL.

Supports PNG, JPEG, JPG, and WEBP.

If not specified, the format will be PNG.

TYPE: Literal['PNG', 'JPEG', 'JPG', 'WEBP'] DEFAULT: 'PNG'

size

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

TYPE: int DEFAULT: 4096

lossless

Whether to return a lossless or compressed WEBP image; This is ignored if file_format is not WEBP.

TYPE: bool DEFAULT: True

RETURNS DESCRIPTION
Optional[URL]

The URL, or None if no splash is set.

RAISES DESCRIPTION
TypeError

If an invalid format is passed for file_format.

ValueError

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

GuildBan #

Used to represent guild bans.

reason class-attribute instance-attribute #

reason: str | None = attrs.field(repr=True)

The reason for this ban, will be None if no reason was given.

user class-attribute instance-attribute #

user: User = attrs.field(repr=True)

The object of the user this ban targets.

GuildExplicitContentFilterLevel #

Bases: int, Enum

Represents the explicit content filter setting for a guild.

ALL_MEMBERS class-attribute instance-attribute #

ALL_MEMBERS = 2

Filter all posts.

DISABLED class-attribute instance-attribute #

DISABLED = 0

No explicit content filter.

MEMBERS_WITHOUT_ROLES class-attribute instance-attribute #

MEMBERS_WITHOUT_ROLES = 1

Filter posts from anyone without a role.

GuildFeature #

Bases: str, Enum

Features that a guild can provide.

ANIMATED_ICON class-attribute instance-attribute #

ANIMATED_ICON = 'ANIMATED_ICON'

Guild has access to set an animated guild icon.

BANNER class-attribute instance-attribute #

BANNER = 'BANNER'

Guild has access to set a guild banner image.

COMMERCE class-attribute instance-attribute #

COMMERCE = 'COMMERCE'

Guild has access to use commerce features (i.e. create store channels).

COMMUNITY class-attribute instance-attribute #

COMMUNITY = 'COMMUNITY'

Guild has community features enabled.

CREATOR_MONETIZABLE class-attribute instance-attribute #

CREATOR_MONETIZABLE = 'CREATOR_MONETIZABLE_PROVISIONAL'

Guild has enabled monetization.

CREATOR_STORE_PAGE class-attribute instance-attribute #

CREATOR_STORE_PAGE = 'CREATOR_STORE_PAGE'

Guild has enabled the store page.

DISCOVERABLE class-attribute instance-attribute #

DISCOVERABLE = 'DISCOVERABLE'

Guild is able to be discovered in the directory.

This also implies the guild can be viewed without joining.

ENHANCED_ROLE_COLORS class-attribute instance-attribute #

ENHANCED_ROLE_COLORS = 'ENHANCED_ROLE_COLORS'

Guild is able to set gradient and holographic role colors.

FEATURABLE class-attribute instance-attribute #

FEATURABLE = 'FEATURABLE'

Guild is able to be featured in the directory.

INVITES_DISABLED class-attribute instance-attribute #

INVITES_DISABLED = 'INVITES_DISABLED'

Guild has paused invites, preventing new users from joining.

INVITE_SPLASH class-attribute instance-attribute #

INVITE_SPLASH = 'INVITE_SPLASH'

Guild has access to set an invite splash background.

MEMBER_VERIFICATION_GATE_ENABLED class-attribute instance-attribute #

MEMBER_VERIFICATION_GATE_ENABLED = (
    "MEMBER_VERIFICATION_GATE_ENABLED"
)

Guild has enabled Membership Screening.

MONETIZATION_ENABLED class-attribute instance-attribute #

MONETIZATION_ENABLED = 'MONETIZATION_ENABLED'

Guild has enabled monetization.

MORE_EMOJI class-attribute instance-attribute #

MORE_EMOJI = 'MORE_EMOJI'

More emojis can be hosted in this guild than normal.

MORE_STICKERS class-attribute instance-attribute #

MORE_STICKERS = 'MORE_STICKERS'

Guild has an increased custom stickers slots.

NEWS class-attribute instance-attribute #

NEWS = 'NEWS'

Guild has access to create news channels.

PARTNERED class-attribute instance-attribute #

PARTNERED = 'PARTNERED'

Guild is partnered.

PREVIEW_ENABLED class-attribute instance-attribute #

PREVIEW_ENABLED = 'PREVIEW_ENABLED'

Guild can be viewed before Membership Screening is complete.

RAID_ALERTS_DISABLED class-attribute instance-attribute #

RAID_ALERTS_DISABLED = 'RAID_ALERTS_DISABLED'

Guild has disabled alerts for join raids in the configured safety alerts channel.

RELAY_ENABLED class-attribute instance-attribute #

RELAY_ENABLED = 'RELAY_ENABLED'

Guild is using relays.

Relays are new infrastructure designed to handle large guilds more efficiently server-side.

ROLE_SUBSCRIPTIONS_AVAILABLE_FOR_PURCHASE class-attribute instance-attribute #

ROLE_SUBSCRIPTIONS_AVAILABLE_FOR_PURCHASE = (
    "ROLE_SUBSCRIPTIONS_AVAILABLE_FOR_PURCHASE"
)

Guild has role subscriptions available for purchase.

ROLE_SUBSCRIPTIONS_ENABLED class-attribute instance-attribute #

ROLE_SUBSCRIPTIONS_ENABLED = 'ROLE_SUBSCRIPTIONS_ENABLED'

Guild has enabled role subscriptions.

TICKETED_EVENTS_ENABLED class-attribute instance-attribute #

TICKETED_EVENTS_ENABLED = 'TICKETED_EVENTS_ENABLED'

Guild has enabled ticketed events.

VANITY_URL class-attribute instance-attribute #

VANITY_URL = 'VANITY_URL'

Guild has access to set a vanity URL.

VERIFIED class-attribute instance-attribute #

VERIFIED = 'VERIFIED'

Guild is verified.

VIP_REGIONS class-attribute instance-attribute #

VIP_REGIONS = 'VIP_REGIONS'

Guild has access to set 384kbps bitrate in voice.

Previously gave access to VIP voice servers.

WELCOME_SCREEN_ENABLED class-attribute instance-attribute #

WELCOME_SCREEN_ENABLED = 'WELCOME_SCREEN_ENABLED'

Guild has enabled the welcome screen.

GuildIncidents #

Represents the incidents of a guild.

dm_spam_detected_at class-attribute instance-attribute #

dm_spam_detected_at: datetime | None = attrs.field(
    repr=True
)

The datetime when the spam detection was triggered for the current incident session.

This will be None if no spam detection was triggered.

dms_disabled_until class-attribute instance-attribute #

dms_disabled_until: datetime | None = attrs.field(repr=True)

The datetime when direct messages between non-friend guild members will be enabled again.

This will be None if the direct messages are not temporarily disabled.

invites_disabled_until class-attribute instance-attribute #

invites_disabled_until: datetime | None = attrs.field(
    repr=True
)

The datetime when the invites will be enabled again.

This will be None if the invites are not temporarily disabled.

Note

This is independent of hikari.guilds.GuildFeature.INVITES_DISABLED which is used to indefinitely disable invites.

raid_detected_at class-attribute instance-attribute #

raid_detected_at: datetime | None = attrs.field(repr=True)

The datetime when the raid was detected for the current incident session.

This will be None if no raid was detected.

GuildMFALevel #

Bases: int, Enum

Represents the multi-factor authorization requirement for a guild.

ELEVATED class-attribute instance-attribute #

ELEVATED = 1

MFA requirement.

NONE class-attribute instance-attribute #

NONE = 0

No MFA requirement.

GuildMemberFlags #

Bases: Flag

Represents the flags that a member can have.

BYPASSES_VERIFICATION class-attribute instance-attribute #

BYPASSES_VERIFICATION = 1 << 2

Member is exempt from guild verification requirements.

COMPLETED_ONBOARDING class-attribute instance-attribute #

COMPLETED_ONBOARDING = 1 << 1

Member has completed onboarding.

DID_REJOIN class-attribute instance-attribute #

DID_REJOIN = 1 << 0

Member has left and rejoined the guild.

NONE class-attribute instance-attribute #

NONE = 0

No flags.

STARTED_ONBOARDING class-attribute instance-attribute #

STARTED_ONBOARDING = 1 << 3

Member has started onboarding.

GuildMessageNotificationsLevel #

Bases: int, Enum

Represents the default notification level for new messages in a guild.

ALL_MESSAGES class-attribute instance-attribute #

ALL_MESSAGES = 0

Notify users when any message is sent.

ONLY_MENTIONS class-attribute instance-attribute #

ONLY_MENTIONS = 1

Only notify users when they are @mentioned.

GuildNSFWLevel #

Bases: int, Enum

Represents the NSFW level of a guild.

AGE_RESTRICTED class-attribute instance-attribute #

AGE_RESTRICTED = 3

Guild may contain NSFW content.

DEFAULT class-attribute instance-attribute #

DEFAULT = 0

Guild has not been categorized yet.

EXPLICIT class-attribute instance-attribute #

EXPLICIT = 1

Guild contains explicit NSFW content.

SAFE class-attribute instance-attribute #

SAFE = 2

Guild is safe of NSFW content.

GuildOnboarding #

Used to represent the Guild Onboarding Object.

default_channel_ids class-attribute instance-attribute #

default_channel_ids: Sequence[Snowflake] = attrs.field(
    hash=False, repr=True
)

Channel IDs that members get opted into automatically.

enabled class-attribute instance-attribute #

enabled: bool = attrs.field(hash=False, repr=True)

Whether onboarding is enabled in the guild.

guild_id class-attribute instance-attribute #

guild_id: Snowflake = attrs.field(hash=True, repr=True)

The ID of the Guild this Onboarding belongs to.

mode class-attribute instance-attribute #

mode: GuildOnboardingMode = attrs.field(
    hash=False, repr=True
)

Current mode of onboarding.

prompts class-attribute instance-attribute #

prompts: Sequence[GuildOnboardingPrompt] = attrs.field(
    hash=False, repr=True
)

Prompts shown during onboarding and in customize community.

GuildOnboardingMode #

Bases: int, Enum

Defines the criteria used to satisfy Onboarding constraints that are required for enabling.

ONBOARDING_ADVANCED class-attribute instance-attribute #

ONBOARDING_ADVANCED = 1

Counts Default Channels and Questions towards constraints.

ONBOARDING_DEFAULT class-attribute instance-attribute #

ONBOARDING_DEFAULT = 0

Counts only Default Channels towards constraints.

GuildOnboardingPrompt #

Bases: Unique

Used to represent a Guild Onboarding Prompt.

id class-attribute instance-attribute #

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

The ID of the prompt.

in_onboarding class-attribute instance-attribute #

in_onboarding: bool = attrs.field(hash=False, repr=True)

Indicates whether the prompt is present in the onboarding flow.

If False, the prompt will only appear in the Channels & Roles tab

options class-attribute instance-attribute #

options: Sequence[GuildOnboardingPromptOption] = (
    attrs.field(hash=False, repr=True)
)

The options of the prompt.

required class-attribute instance-attribute #

required: bool = attrs.field(hash=False, repr=True)

Indicates whether the prompt is required before a user completes the onboarding flow.

single_select class-attribute instance-attribute #

single_select: bool = attrs.field(hash=False, repr=True)

Indicates whether users are limited to selecting one option for the prompt.

title class-attribute instance-attribute #

title: str = attrs.field(hash=False, repr=True)

The title of the prompt.

type class-attribute instance-attribute #

type: GuildOnboardingPromptType = attrs.field(
    hash=False, repr=True
)

The type of the prompt.

GuildOnboardingPromptOption #

Bases: Unique

Used to represent a Guild Onboarding Prompt Option.

channel_ids class-attribute instance-attribute #

channel_ids: Sequence[Snowflake] = attrs.field(
    hash=False, repr=True
)

The IDs of the channels a user is opted into when selecting this option.

description class-attribute instance-attribute #

description: str | None = attrs.field(hash=False, repr=True)

The description of the option.

emoji class-attribute instance-attribute #

emoji: Emoji = attrs.field(hash=False, repr=False)

Emoji of the option.

id class-attribute instance-attribute #

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

The ID of the option

role_ids class-attribute instance-attribute #

role_ids: Sequence[Snowflake] = attrs.field(
    hash=False, repr=True
)

The IDs of the roles a user will get assigned when selecting this option.

title class-attribute instance-attribute #

title: str = attrs.field(hash=False, repr=True)

The title of the option.

GuildOnboardingPromptType #

Bases: int, Enum

Guild Onboarding Prompt Type. This is automatically decided by discord.

DROPDOWN class-attribute instance-attribute #

DROPDOWN = 1

Similar to a select menu component.

MULTIPLE_CHOICE class-attribute instance-attribute #

MULTIPLE_CHOICE = 0

Multiple fields you can click at.

GuildPremiumTier #

Bases: int, Enum

Tier for Discord Nitro boosting in a guild.

NONE class-attribute instance-attribute #

NONE = 0

No Nitro boost level.

TIER_1 class-attribute instance-attribute #

TIER_1 = 1

Level 1 Nitro boost.

TIER_2 class-attribute instance-attribute #

TIER_2 = 2

Level 2 Nitro boost.

TIER_3 class-attribute instance-attribute #

TIER_3 = 3

Level 3 Nitro boost.

GuildPreview #

Bases: PartialGuild

A preview of a guild with the hikari.guilds.GuildFeature.DISCOVERABLE feature.

approximate_active_member_count class-attribute instance-attribute #

approximate_active_member_count: int = attrs.field(
    eq=False, hash=False, repr=True
)

The approximate amount of presences in this guild.

approximate_member_count class-attribute instance-attribute #

approximate_member_count: int = attrs.field(
    eq=False, hash=False, repr=True
)

The approximate amount of members in this guild.

description class-attribute instance-attribute #

description: str | None = attrs.field(
    eq=False, hash=False, repr=False
)

The guild's description, if set.

discovery_splash_hash class-attribute instance-attribute #

discovery_splash_hash: str | None = attrs.field(
    eq=False, hash=False, repr=False
)

The hash of the discovery splash for the guild, if there is one.

emojis class-attribute instance-attribute #

emojis: Mapping[Snowflake, KnownCustomEmoji] = attrs.field(
    eq=False, hash=False, repr=False
)

The mapping of IDs to the emojis this guild provides.

features class-attribute instance-attribute #

features: Sequence[str | GuildFeature] = attrs.field(
    eq=False, hash=False, repr=False
)

A list of the features in this guild.

splash_hash class-attribute instance-attribute #

splash_hash: str | None = attrs.field(
    eq=False, hash=False, repr=False
)

The hash of the splash for the guild, if there is one.

make_discovery_splash_url #

make_discovery_splash_url(
    *,
    file_format: Literal[
        "PNG", "JPEG", "JPG", "WEBP"
    ] = "PNG",
    size: int = 4096,
    lossless: bool = True,
) -> URL | None

Generate the discovery splash URL for this guild, if set.

If no discovery splash is set, this returns None.

PARAMETER DESCRIPTION
file_format

The format to use for this URL.

Supports PNG, JPEG, JPG, and WEBP.

If not specified, the format will be PNG.

TYPE: Literal['PNG', 'JPEG', 'JPG', 'WEBP'] DEFAULT: 'PNG'

size

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

TYPE: int DEFAULT: 4096

lossless

Whether to return a lossless or compressed WEBP image; This is ignored if file_format is not WEBP.

TYPE: bool DEFAULT: True

RETURNS DESCRIPTION
Optional[URL]

The URL, or None if no discovery splash is set.

RAISES DESCRIPTION
TypeError

If an invalid format is passed for file_format.

ValueError

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

make_splash_url #

make_splash_url(
    *,
    file_format: Literal[
        "PNG", "JPEG", "JPG", "WEBP"
    ] = "PNG",
    size: int = 4096,
    lossless: bool = True,
) -> URL | None

Generate the splash URL for this guild, if set.

If no splash is set, this returns None.

PARAMETER DESCRIPTION
file_format

The format to use for this URL.

Supports PNG, JPEG, JPG, and WEBP.

If not specified, the format will be PNG.

TYPE: Literal['PNG', 'JPEG', 'JPG', 'WEBP'] DEFAULT: 'PNG'

size

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

TYPE: int DEFAULT: 4096

lossless

Whether to return a lossless or compressed WEBP image; This is ignored if file_format is not WEBP.

TYPE: bool DEFAULT: True

RETURNS DESCRIPTION
Optional[URL]

The URL, or None if no splash is set.

RAISES DESCRIPTION
TypeError

If an invalid format is passed for file_format.

ValueError

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

GuildSystemChannelFlag #

Bases: Flag

Defines which features are suppressed in the system channel.

NONE class-attribute instance-attribute #

NONE = 0

Nothing is suppressed.

SUPPRESS_GUILD_REMINDER class-attribute instance-attribute #

SUPPRESS_GUILD_REMINDER = 1 << 2

Suppress displaying messages with guild setup tips.

SUPPRESS_PREMIUM_SUBSCRIPTION class-attribute instance-attribute #

SUPPRESS_PREMIUM_SUBSCRIPTION = 1 << 1

Suppress displaying a message when the guild is Nitro boosted.

SUPPRESS_USER_JOIN class-attribute instance-attribute #

SUPPRESS_USER_JOIN = 1 << 0

Suppress displaying a message about new users joining.

SUPPRESS_USER_JOIN_REPLIES class-attribute instance-attribute #

SUPPRESS_USER_JOIN_REPLIES = 1 << 3

Suppress displaying a reply button on join notifications.

GuildVerificationLevel #

Bases: int, Enum

Represents the level of verification of a guild.

HIGH class-attribute instance-attribute #

HIGH = 3

Must also be a member of the guild for longer than 10 minutes.

LOW class-attribute instance-attribute #

LOW = 1

Must have a verified email on their account.

MEDIUM class-attribute instance-attribute #

MEDIUM = 2

Must have been registered on Discord for more than 5 minutes.

NONE class-attribute instance-attribute #

NONE = 0

Unrestricted.

VERY_HIGH class-attribute instance-attribute #

VERY_HIGH = 4

Must have a verified phone number.

GuildWidget #

Represents a guild widget.

app class-attribute instance-attribute #

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

Client application that models may use for procedures.

channel_id class-attribute instance-attribute #

channel_id: Snowflake | None = attrs.field(repr=True)

The ID of the channel the invite for this embed targets, if enabled.

is_enabled class-attribute instance-attribute #

is_enabled: bool = attrs.field(repr=True)

Whether this embed is enabled.

fetch_channel async #

fetch_channel() -> GuildChannel | None

Fetch the widget channel.

This will be None if not set.

RETURNS DESCRIPTION
Optional[GuildChannel]

The requested channel.

You can check the type of the channel by using isinstance.

RAISES DESCRIPTION
UnauthorizedError

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

ForbiddenError

If you are missing the hikari.permissions.Permissions.VIEW_CHANNEL permission in the channel.

NotFoundError

If the channel is not found.

RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

InternalServerError

If an internal error occurs on Discord while handling the request.

Integration #

Bases: PartialIntegration

Represents a guild integration object.

application class-attribute instance-attribute #

application: IntegrationApplication | None = attrs.field(
    eq=False, hash=False, repr=False
)

The bot/OAuth2 application associated with this integration.

Note

This is only available for Discord integrations.

expire_behavior class-attribute instance-attribute #

expire_behavior: IntegrationExpireBehaviour | int | None = (
    attrs.field(eq=False, hash=False, repr=False)
)

How members should be treated after their connected subscription expires.

This will not be enacted until after GuildIntegration.expire_grace_period passes.

Note

This will always be None for Discord integrations.

expire_grace_period class-attribute instance-attribute #

expire_grace_period: timedelta | None = attrs.field(
    eq=False, hash=False, repr=False
)

How many days users with expired subscriptions are given until the expire behavior is enacted out on them.

Note

This will always be None for Discord integrations.

guild_id class-attribute instance-attribute #

guild_id: Snowflake = attrs.field()

The ID of the guild this integration belongs to.

is_emojis_enabled class-attribute instance-attribute #

is_emojis_enabled: bool | None = attrs.field(
    eq=False, hash=False, repr=False
)

Whether users under this integration are allowed to use it's custom emojis.

is_enabled class-attribute instance-attribute #

is_enabled: bool = attrs.field(
    eq=False, hash=False, repr=True
)

Whether this integration is enabled.

is_revoked class-attribute instance-attribute #

is_revoked: bool | None = attrs.field(
    eq=False, hash=False, repr=False
)

Whether the integration has been revoked.

is_syncing class-attribute instance-attribute #

is_syncing: bool | None = attrs.field(
    eq=False, hash=False, repr=False
)

Whether this integration is syncing subscribers/emojis.

last_synced_at class-attribute instance-attribute #

last_synced_at: datetime | None = attrs.field(
    eq=False, hash=False, repr=False
)

The datetime of when this integration's subscribers were last synced.

role_id class-attribute instance-attribute #

role_id: Snowflake | None = attrs.field(
    eq=False, hash=False, repr=False
)

The ID of the managed role used for this integration's subscribers.

subscriber_count class-attribute instance-attribute #

subscriber_count: int | None = attrs.field(
    eq=False, hash=False, repr=False
)

The number of subscribers this integration has.

user class-attribute instance-attribute #

user: User | None = attrs.field(
    eq=False, hash=False, repr=False
)

The user this integration belongs to.

IntegrationAccount #

An account that's linked to an integration.

id class-attribute instance-attribute #

id: str = attrs.field(hash=True, repr=True)

The string ID of this (likely) third party account.

name class-attribute instance-attribute #

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

The name of this account.

IntegrationApplication #

Bases: PartialApplication

An application that's linked to an integration.

bot class-attribute instance-attribute #

bot: User | None = attrs.field(
    eq=False, hash=False, repr=False
)

The bot associated with this application.

IntegrationExpireBehaviour #

Bases: int, Enum

Behavior for expiring integration subscribers.

KICK class-attribute instance-attribute #

KICK = 1

Kick the subscriber.

REMOVE_ROLE class-attribute instance-attribute #

REMOVE_ROLE = 0

Remove the role.

IntegrationType #

Bases: str, Enum

The integration type.

DISCORD_BOT class-attribute instance-attribute #

DISCORD_BOT = 'discord'

Discord bot.

GUILD_SUBSCRIPTION class-attribute instance-attribute #

GUILD_SUBSCRIPTION = 'guild_subscription'

Guild subscription.

TWITCH class-attribute instance-attribute #

TWITCH = 'twitch'

Twitch.

YOUTUBE class-attribute instance-attribute #

YOUTUBE = 'youtube'

Youtube.

Member #

Bases: User

Used to represent a guild bound member.

accent_color property #

accent_color: Color | None

The custom banner color for the user, if set else None.

The official client will decide the default color if not set.

app property #

app: RESTAware

Return the app that is bound to the user object.

avatar_decoration property #

avatar_decoration: AvatarDecoration | None

Avatar decoration for the user, if they have one, otherwise None.

avatar_hash property #

avatar_hash: str | None

Avatar hash for the user, if they have one, otherwise None.

banner_hash property #

banner_hash: str | None

Banner hash for the user, if they have one, otherwise None.

default_avatar_url property #

default_avatar_url: URL

Default avatar URL for this user.

discriminator property #

discriminator: str

Discriminator for the user.

!!! deprecated 2.0.0.dev120 Discriminators are deprecated and being replaced with "0" by Discord during username migration. This field will be removed after migration is complete. Learn more here: https://dis.gd/usernames

display_avatar_decoration property #

display_avatar_decoration: AvatarDecoration | None

Display avatar decoration for the user, if they have one set.

Will be None if no avatar decoration is set.

display_avatar_url property #

display_avatar_url: URL

Display avatar URL for this user.

display_banner_url property #

display_banner_url: URL | None

Display banner URL for this user, if they have one set.

Will be None if no banner is set.

display_name property #

display_name: str

Return the member's display name.

If the member has a nickname, this will return that nickname. If the user has a global name, this will return that global name. If the user has neither, the username will be returned instead.

See Also

flags property #

flags: UserFlag

Flag bits that are set for the user.

global_name property #

global_name: str | None

Global name for the user, if they have one, otherwise None.

guild_avatar_decoration class-attribute instance-attribute #

guild_avatar_decoration: AvatarDecoration | None = (
    attrs.field(eq=False, hash=False, repr=False)
)

Hash of the member's guild avatar decoration if set, else None.

Note

This takes precedence over hikari.guilds.Member.avatar_decoration in the client.

guild_avatar_hash class-attribute instance-attribute #

guild_avatar_hash: str | None = attrs.field(
    eq=False, hash=False, repr=False
)

Hash of the member's guild avatar if set, else None.

Note

This takes precedence over hikari.guilds.Member.avatar_hash in the client.

guild_banner_hash class-attribute instance-attribute #

guild_banner_hash: str | None = attrs.field(
    eq=False, hash=False, repr=False
)

Hash of the member's guild banner if set, else None.

Note

This takes precedence over hikari.guilds.Member.banner_hash in the client.

guild_flags class-attribute instance-attribute #

guild_flags: GuildMemberFlags | int = attrs.field(
    eq=False, hash=False, repr=False
)

The flags this member has in the guild.

guild_id class-attribute instance-attribute #

guild_id: Snowflake = attrs.field(repr=True)

The ID of the guild this member belongs to.

id property #

ID of this entity.

is_bot property #

is_bot: bool

Whether this user is a bot account.

is_deaf class-attribute instance-attribute #

is_deaf: UndefinedOr[bool] = attrs.field(repr=False)

True if this member is deafened in the current voice channel.

This will be hikari.undefined.UNDEFINED if it's state is unknown.

is_mute class-attribute instance-attribute #

is_mute: UndefinedOr[bool] = attrs.field(repr=False)

True if this member is muted in the current voice channel.

This will be hikari.undefined.UNDEFINED if it's state is unknown.

is_pending class-attribute instance-attribute #

is_pending: UndefinedOr[bool] = attrs.field(repr=False)

Whether the user has passed the guild's membership screening requirements.

This will be hikari.undefined.UNDEFINED if it's state is unknown.

is_system property #

is_system: bool

Whether this user is a system account.

joined_at class-attribute instance-attribute #

joined_at: datetime | None = attrs.field(repr=True)

The datetime of when this member joined the guild they belong to.

This will be None for guest members that have been temporarily invited.

mention property #

mention: str

Return a raw mention string for the given user.

Examples:

>>> some_user.mention
'<@123456789123456789>'

nickname class-attribute instance-attribute #

nickname: str | None = attrs.field(repr=True)

This member's nickname.

This will be None if not set.

premium_since class-attribute instance-attribute #

premium_since: datetime | None = attrs.field(repr=False)

The datetime of when this member started "boosting" this guild.

Will be None if the member is not a premium user.

primary_guild property #

primary_guild: PrimaryGuild | None

The primary guild of the member.

raw_communication_disabled_until class-attribute instance-attribute #

raw_communication_disabled_until: datetime | None = (
    attrs.field(repr=False)
)

The datetime when this member's timeout will expire.

Will be None if the member is not timed out.

Note

The datetime might be in the past, so it is recommended to use hikari.guilds.Member.communication_disabled_until method to check if the member is timed out at the time of the call.

role_ids class-attribute instance-attribute #

role_ids: Sequence[Snowflake] = attrs.field(repr=False)

A sequence of the IDs of the member's current roles.

user class-attribute instance-attribute #

user: User = attrs.field(repr=True)

This member's corresponding user object.

username property #

username: str

Username for the user.

add_role async #

add_role(
    role: SnowflakeishOr[PartialRole],
    *,
    reason: UndefinedOr[str] = UNDEFINED,
) -> None

Add a role to the member.

PARAMETER DESCRIPTION
role

The role to add. This may be the object or the ID of an existing role.

TYPE: SnowflakeishOr[PartialRole]

reason

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

TYPE: UndefinedOr[str] DEFAULT: UNDEFINED

RAISES DESCRIPTION
ForbiddenError

If you are missing the hikari.permissions.Permissions.MANAGE_ROLES permission.

UnauthorizedError

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

NotFoundError

If the guild, user or role are not found.

RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

InternalServerError

If an internal error occurs on Discord while handling the request.

ban async #

ban(
    *,
    delete_message_seconds: UndefinedOr[
        Intervalish
    ] = UNDEFINED,
    reason: UndefinedOr[str] = UNDEFINED,
) -> None

Ban this member from this guild.

PARAMETER DESCRIPTION
delete_message_seconds

If provided, the number of seconds to delete messages for. This can be represented as either an int/float between 0 and 604800 (7 days), or a datetime.timedelta object.

TYPE: UndefinedOr[Intervalish] DEFAULT: UNDEFINED

reason

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

TYPE: UndefinedOr[str] DEFAULT: UNDEFINED

RAISES DESCRIPTION
BadRequestError

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

ForbiddenError

If you are missing the hikari.permissions.Permissions.BAN_MEMBERS permission.

UnauthorizedError

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

NotFoundError

If the guild or user are not found.

RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

InternalServerError

If an internal error occurs on Discord while handling the request.

communication_disabled_until #

communication_disabled_until() -> datetime | None

Return when the timeout for this member ends.

Unlike raw_communication_disabled_until, this will always be None if the member is not currently timed out.

Note

The output of this function can depend based on when the function is called.

edit async #

Edit the member.

PARAMETER DESCRIPTION
nickname

If provided, the new nick for the member. If None, will remove the members nick.

Requires the hikari.permissions.Permissions.MANAGE_NICKNAMES permission.

TYPE: UndefinedNoneOr[str] DEFAULT: UNDEFINED

roles

If provided, the new roles for the member.

Requires the hikari.permissions.Permissions.MANAGE_ROLES permission.

TYPE: UndefinedOr[SnowflakeishSequence[PartialRole]] DEFAULT: UNDEFINED

mute

If provided, the new server mute state for the member.

Requires the hikari.permissions.Permissions.MUTE_MEMBERS permission.

TYPE: UndefinedOr[bool] DEFAULT: UNDEFINED

deaf

If provided, the new server deaf state for the member.

Requires the hikari.permissions.Permissions.DEAFEN_MEMBERS permission.

TYPE: UndefinedOr[bool] DEFAULT: UNDEFINED

voice_channel

If provided, None or the object or the ID of an existing voice channel to move the member to. If None, will disconnect the member from voice.

Requires the hikari.permissions.Permissions.MOVE_MEMBERS permission and the hikari.permissions.Permissions.CONNECT permission in the original voice channel and the target voice channel.

Note

If the member is not in a voice channel, this will take no effect.

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

communication_disabled_until

If provided, the datetime when the timeout (disable communication) of the member expires, up to 28 days in the future, or None to remove the timeout from the member.

Requires the hikari.permissions.Permissions.MODERATE_MEMBERS permission.

TYPE: UndefinedNoneOr[datetime] DEFAULT: UNDEFINED

reason

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

TYPE: UndefinedOr[str] DEFAULT: UNDEFINED

RETURNS DESCRIPTION
Member

Object of the member that was updated.

RAISES DESCRIPTION
BadRequestError

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

ForbiddenError

If you are missing a permission to do an action.

UnauthorizedError

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

NotFoundError

If the guild or the user are not found.

RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

InternalServerError

If an internal error occurs on Discord while handling the request.

fetch_dm_channel async #

fetch_dm_channel() -> DMChannel

Fetch the DM channel for this user.

RETURNS DESCRIPTION
DMChannel

The requested channel.

RAISES DESCRIPTION
UnauthorizedError

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

NotFoundError

If the user is not found.

RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

InternalServerError

If an internal error occurs on Discord while handling the request.

fetch_roles async #

fetch_roles() -> Sequence[Role]

Fetch an up-to-date view of this member's roles from the API.

RETURNS DESCRIPTION
Sequence[Role]

An up-to-date view of this member's roles.

RAISES DESCRIPTION
UnauthorizedError

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

NotFoundError

If the member is not found.

RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

InternalServerError

If an internal error occurs on Discord while handling the request.

fetch_self async #

fetch_self() -> Member

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

RETURNS DESCRIPTION
Member

An up-to-date view of this member.

RAISES DESCRIPTION
UnauthorizedError

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

NotFoundError

If the member is not found.

RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

InternalServerError

If an internal error occurs on Discord while handling the request.

get_guild #

get_guild() -> Guild | None

Return the guild associated with this member.

RETURNS DESCRIPTION
Optional[Guild]

The linked guild object or None if it's not cached.

get_presence #

get_presence() -> MemberPresence | None

Get the cached presence for this member, if known.

Presence info includes user status and activities.

This requires the hikari.intents.Intents.GUILD_PRESENCES intent to be enabled.

RETURNS DESCRIPTION
Optional[MemberPresence]

The member presence, or None if not known.

get_roles #

get_roles() -> Sequence[Role]

Return the roles the user has.

This will be empty if the roles are missing from the cache.

RETURNS DESCRIPTION
Sequence[Role]

The roles the users has.

get_top_role #

get_top_role() -> Role | None

Return the highest role the member has.

RETURNS DESCRIPTION
Optional[Role]

None if the cache is missing the roles information or the highest role the user has.

kick async #

kick(*, reason: UndefinedOr[str] = UNDEFINED) -> None

Kick this member from this guild.

PARAMETER DESCRIPTION
reason

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

TYPE: UndefinedOr[str] DEFAULT: UNDEFINED

RAISES DESCRIPTION
BadRequestError

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

ForbiddenError

If you are missing the hikari.permissions.Permissions.KICK_MEMBERS permission.

UnauthorizedError

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

NotFoundError

If the guild or user are not found.

RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

InternalServerError

If an internal error occurs on Discord while handling the request.

make_avatar_url #

make_avatar_url(
    *,
    file_format: UndefinedOr[
        Literal[
            "PNG", "JPEG", "JPG", "WEBP", "AWEBP", "GIF"
        ]
    ] = UNDEFINED,
    size: int = 4096,
    lossless: bool = True,
) -> URL | None

Generate the avatar URL for this user, if set.

If no avatar is set, this returns None.

PARAMETER DESCRIPTION
file_format

The format to use for this URL.

Supports PNG, JPEG, JPG, WEBP, AWEBP and GIF.

If not specified, the format will be determined based on whether the avatar is animated or not.

TYPE: UndefinedOr[Literal['PNG', 'JPEG', 'JPG', 'WEBP', 'AWEBP', 'GIF']] DEFAULT: UNDEFINED

size

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

TYPE: int DEFAULT: 4096

lossless

Whether to return a lossless or compressed WEBP image; This is ignored if file_format is not WEBP or AWEBP.

TYPE: bool DEFAULT: True

RETURNS DESCRIPTION
Optional[URL]

The URL, or None if no avatar is set.

RAISES DESCRIPTION
TypeError

If an invalid format is passed for file_format; If an animated format is requested for a static avatar.

ValueError

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

make_banner_url #

make_banner_url(
    *,
    file_format: UndefinedOr[
        Literal[
            "PNG", "JPEG", "JPG", "WEBP", "AWEBP", "GIF"
        ]
    ] = UNDEFINED,
    size: int = 4096,
    lossless: bool = True,
) -> URL | None

Generate the banner URL for this user, if set.

If no banner is set, this returns None.

PARAMETER DESCRIPTION
file_format

The format to use for this URL.

Supports PNG, JPEG, JPG, WEBP, AWEBP and GIF.

If not specified, the format will be determined based on whether the banner is animated or not.

TYPE: UndefinedOr[Literal['PNG', 'JPEG', 'JPG', 'WEBP', 'AWEBP', 'GIF']] DEFAULT: UNDEFINED

size

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

TYPE: int DEFAULT: 4096

lossless

Whether to return a lossless or compressed WEBP image; This is ignored if file_format is not WEBP or AWEBP.

TYPE: bool DEFAULT: True

RETURNS DESCRIPTION
Optional[URL]

The URL, or None if no banner is set.

RAISES DESCRIPTION
TypeError

If an invalid format is passed for file_format; If an animated format is requested for a static banner.

ValueError

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

make_guild_avatar_url #

make_guild_avatar_url(
    *,
    file_format: UndefinedOr[
        Literal[
            "PNG", "JPEG", "JPG", "WEBP", "AWEBP", "GIF"
        ]
    ] = UNDEFINED,
    size: int = 4096,
    lossless: bool = True,
) -> URL | None

Generate the guild-specific avatar URL for this member, if set.

If no guild-specific avatar is set, this returns None.

PARAMETER DESCRIPTION
file_format

The format to use for this URL.

Supports PNG, JPEG, JPG, WEBP, AWEBP and GIF.

If not specified, the format will be determined based on whether the avatar is animated or not.

TYPE: UndefinedOr[Literal['PNG', 'JPEG', 'JPG', 'WEBP', 'AWEBP', 'GIF']] DEFAULT: UNDEFINED

size

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

TYPE: int DEFAULT: 4096

lossless

Whether to return a lossless or compressed WEBP image; This is ignored if file_format is not WEBP or AWEBP.

TYPE: bool DEFAULT: True

RETURNS DESCRIPTION
Optional[URL]

The URL, or None if no avatar is set.

RAISES DESCRIPTION
TypeError

If an invalid format is passed for file_format; If an animated format is requested for a static avatar.

ValueError

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

make_guild_banner_url #

make_guild_banner_url(
    *,
    file_format: UndefinedOr[
        Literal[
            "PNG", "JPEG", "JPG", "WEBP", "AWEBP", "GIF"
        ]
    ] = UNDEFINED,
    size: int = 4096,
    lossless: bool = True,
) -> URL | None

Generate the guild-specific banner URL for this member, if set.

If no guild-specific banner is set, this returns None.

PARAMETER DESCRIPTION
file_format

The format to use for this URL.

Supports PNG, JPEG, JPG, WEBP, AWEBP and GIF.

If not specified, the format will be determined based on whether the banner is animated or not.

TYPE: UndefinedOr[Literal['PNG', 'JPEG', 'JPG', 'WEBP', 'AWEBP', 'GIF']] DEFAULT: UNDEFINED

size

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

TYPE: int DEFAULT: 4096

lossless

Whether to return a lossless or compressed WEBP image; This is ignored if file_format is not WEBP or AWEBP.

TYPE: bool DEFAULT: True

RETURNS DESCRIPTION
Optional[URL]

The URL to the banner, or None if not present.

RAISES DESCRIPTION
TypeError

If an invalid format is passed for file_format; If an animated format is requested for a static banner.

ValueError

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

remove_role async #

remove_role(
    role: SnowflakeishOr[PartialRole],
    *,
    reason: UndefinedOr[str] = UNDEFINED,
) -> None

Remove a role from the member.

PARAMETER DESCRIPTION
role

The role to remove. This may be the object or the ID of an existing role.

TYPE: SnowflakeishOr[PartialRole]

reason

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

TYPE: UndefinedOr[str] DEFAULT: UNDEFINED

RAISES DESCRIPTION
ForbiddenError

If you are missing the hikari.permissions.Permissions.MANAGE_ROLES permission.

UnauthorizedError

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

NotFoundError

If the guild, user or role are not found.

RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

InternalServerError

If an internal error occurs on Discord while handling the request.

unban async #

unban(*, reason: UndefinedOr[str] = UNDEFINED) -> None

Unban this member from the guild.

PARAMETER DESCRIPTION
reason

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

TYPE: UndefinedOr[str] DEFAULT: UNDEFINED

RAISES DESCRIPTION
BadRequestError

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

ForbiddenError

If you are missing the hikari.permissions.Permissions.BAN_MEMBERS permission.

UnauthorizedError

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

NotFoundError

If the guild or user are not found.

RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

InternalServerError

If an internal error occurs on Discord while handling the request.

PartialApplication #

Bases: Unique

A partial representation of a Discord application.

description class-attribute instance-attribute #

description: str | None = attrs.field(
    eq=False, hash=False, repr=False
)

The description of this application, if any.

icon_hash class-attribute instance-attribute #

icon_hash: str | None = attrs.field(
    eq=False, hash=False, repr=False
)

The CDN hash of this application's icon, if set.

id class-attribute instance-attribute #

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

The ID of this entity.

name class-attribute instance-attribute #

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

The name of this application.

make_icon_url #

make_icon_url(
    *,
    file_format: Literal[
        "PNG", "JPEG", "JPG", "WEBP"
    ] = "PNG",
    size: int = 4096,
    lossless: bool = True,
) -> URL | None

Generate the icon URL for this application, if set.

If no icon is set, this returns None.

PARAMETER DESCRIPTION
file_format

The format to use for this URL.

Supports PNG, JPEG, JPG, and WEBP.

If not specified, the format will be PNG.

TYPE: Literal['PNG', 'JPEG', 'JPG', 'WEBP'] DEFAULT: 'PNG'

size

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

TYPE: int DEFAULT: 4096

lossless

Whether to return a lossless or compressed WEBP image; This is ignored if file_format is not WEBP.

TYPE: bool DEFAULT: True

RETURNS DESCRIPTION
Optional[URL]

The URL, or None if no icon exists.

RAISES DESCRIPTION
TypeError

If an invalid format is passed for file_format.

ValueError

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

PartialGuild #

Bases: Unique

Base object for any partial guild objects.

app class-attribute instance-attribute #

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

Client application that models may use for procedures.

icon_hash class-attribute instance-attribute #

icon_hash: str | None = attrs.field(
    eq=False, hash=False, repr=False
)

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

id class-attribute instance-attribute #

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

The ID of this entity.

name class-attribute instance-attribute #

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

The name of the guild.

shard_id property #

shard_id: int | None

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

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

ban async #

ban(
    user: SnowflakeishOr[PartialUser],
    *,
    delete_message_seconds: UndefinedOr[
        Intervalish
    ] = UNDEFINED,
    reason: UndefinedOr[str] = UNDEFINED,
) -> None

Ban the given user from this guild.

PARAMETER DESCRIPTION
user

The user to ban from the guild.

TYPE: SnowflakeishOr[PartialUser]

delete_message_seconds

If provided, the number of seconds to delete messages for. This can be represented as either an int/float between 0 and 604800 (7 days), or a datetime.timedelta object.

TYPE: UndefinedOr[Intervalish] DEFAULT: UNDEFINED

reason

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

TYPE: UndefinedOr[str] DEFAULT: UNDEFINED

RAISES DESCRIPTION
BadRequestError

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

ForbiddenError

If you are missing the hikari.permissions.Permissions.BAN_MEMBERS permission.

UnauthorizedError

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

NotFoundError

If the guild or user are not found.

RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

InternalServerError

If an internal error occurs on Discord while handling the request.

create_category async #

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

Create a category in the guild.

PARAMETER DESCRIPTION
name

The channels name. Must be between 2 and 1000 characters.

TYPE: str

position

If provided, the position of the category.

TYPE: UndefinedOr[int] DEFAULT: UNDEFINED

permission_overwrites

If provided, the permission overwrites for the category.

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

reason

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

TYPE: UndefinedOr[str] DEFAULT: UNDEFINED

RETURNS DESCRIPTION
GuildCategory

The created category.

RAISES DESCRIPTION
BadRequestError

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

ForbiddenError

If you are missing the hikari.permissions.Permissions.MANAGE_CHANNELS permission.

UnauthorizedError

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

NotFoundError

If the guild is not found.

RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

InternalServerError

If an internal error occurs on Discord while handling the request.

create_forum_channel async #

create_forum_channel(
    name: str,
    *,
    position: UndefinedOr[int] = UNDEFINED,
    category: UndefinedOr[
        SnowflakeishOr[GuildCategory]
    ] = UNDEFINED,
    permission_overwrites: UndefinedOr[
        Sequence[PermissionOverwrite]
    ] = UNDEFINED,
    topic: UndefinedOr[str] = UNDEFINED,
    nsfw: UndefinedOr[bool] = UNDEFINED,
    rate_limit_per_user: UndefinedOr[
        Intervalish
    ] = UNDEFINED,
    default_auto_archive_duration: UndefinedOr[
        Intervalish
    ] = UNDEFINED,
    default_thread_rate_limit_per_user: UndefinedOr[
        Intervalish
    ] = UNDEFINED,
    default_forum_layout: UndefinedOr[
        ForumLayoutType | int
    ] = UNDEFINED,
    default_sort_order: UndefinedOr[
        ForumSortOrderType | int
    ] = UNDEFINED,
    available_tags: UndefinedOr[
        Sequence[ForumTag]
    ] = UNDEFINED,
    default_reaction_emoji: str
    | Emoji
    | UndefinedType
    | Snowflake = UNDEFINED,
    reason: UndefinedOr[str] = UNDEFINED,
) -> GuildForumChannel

Create a forum channel in the guild.

PARAMETER DESCRIPTION
name

The channels name. Must be between 2 and 1000 characters.

TYPE: str

position

If provided, the position of the category.

TYPE: UndefinedOr[int] DEFAULT: UNDEFINED

category

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

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

permission_overwrites

If provided, the permission overwrites for the category.

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

topic

If provided, the channels topic. Maximum 1024 characters.

TYPE: UndefinedOr[str] DEFAULT: UNDEFINED

nsfw

If provided, whether to mark the channel as NSFW.

TYPE: UndefinedOr[bool] DEFAULT: UNDEFINED

rate_limit_per_user

If provided, the amount of seconds a user has to wait before being able to send another message in the channel. Maximum 21600 seconds.

TYPE: UndefinedOr[Intervalish] DEFAULT: UNDEFINED

default_auto_archive_duration

If provided, the auto archive duration Discord's end user client should default to when creating threads in this channel.

This should be either 60, 1440, 4320 or 10080 minutes and, as of writing, ignores the parent channel's set default_auto_archive_duration when passed as hikari.undefined.UNDEFINED.

TYPE: UndefinedOr[Intervalish] DEFAULT: UNDEFINED

default_thread_rate_limit_per_user

If provided, the ratelimit that should be set in threads created from the forum.

TYPE: UndefinedOr[Intervalish] DEFAULT: UNDEFINED

default_forum_layout

If provided, the default forum layout to show in the client.

TYPE: UndefinedOr[ForumLayoutType | int] DEFAULT: UNDEFINED

default_sort_order

If provided, the default sort order to show in the client.

TYPE: UndefinedOr[ForumSortOrderType | int] DEFAULT: UNDEFINED

available_tags

If provided, the available tags to select from when creating a thread.

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

default_reaction_emoji

If provided, the new default reaction emoji for threads created in a forum channel.

TYPE: str | Emoji | UndefinedType | Snowflake DEFAULT: UNDEFINED

reason

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

TYPE: UndefinedOr[str] DEFAULT: UNDEFINED

RETURNS DESCRIPTION
GuildForumChannel

The created forum channel.

RAISES DESCRIPTION
BadRequestError

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

ForbiddenError

If you are missing the hikari.permissions.Permissions.MANAGE_CHANNELS permission.

UnauthorizedError

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

NotFoundError

If the guild is not found.

RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

InternalServerError

If an internal error occurs on Discord while handling the request.

create_news_channel async #

create_news_channel(
    name: str,
    *,
    position: UndefinedOr[int] = UNDEFINED,
    topic: UndefinedOr[str] = UNDEFINED,
    nsfw: UndefinedOr[bool] = UNDEFINED,
    rate_limit_per_user: UndefinedOr[
        Intervalish
    ] = UNDEFINED,
    permission_overwrites: UndefinedOr[
        Sequence[PermissionOverwrite]
    ] = UNDEFINED,
    category: UndefinedOr[
        SnowflakeishOr[GuildCategory]
    ] = UNDEFINED,
    reason: UndefinedOr[str] = UNDEFINED,
) -> GuildNewsChannel

Create a news channel in the guild.

PARAMETER DESCRIPTION
name

The channels name. Must be between 2 and 1000 characters.

TYPE: str

position

If provided, the position of the channel (relative to the category, if any).

TYPE: UndefinedOr[int] DEFAULT: UNDEFINED

topic

If provided, the channels topic. Maximum 1024 characters.

TYPE: UndefinedOr[str] DEFAULT: UNDEFINED

nsfw

If provided, whether to mark the channel as NSFW.

TYPE: UndefinedOr[bool] DEFAULT: UNDEFINED

rate_limit_per_user

If provided, the amount of seconds a user has to wait before being able to send another message in the channel. Maximum 21600 seconds.

TYPE: UndefinedOr[Intervalish] DEFAULT: UNDEFINED

permission_overwrites

If provided, the permission overwrites for the channel.

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

category

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

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

reason

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

TYPE: UndefinedOr[str] DEFAULT: UNDEFINED

RETURNS DESCRIPTION
GuildNewsChannel

The created channel.

RAISES DESCRIPTION
BadRequestError

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

ForbiddenError

If you are missing the hikari.permissions.Permissions.MANAGE_CHANNELS permission.

UnauthorizedError

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

NotFoundError

If the guild is not found.

RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

InternalServerError

If an internal error occurs on Discord while handling the request.

create_stage_channel async #

create_stage_channel(
    name: str,
    *,
    position: UndefinedOr[int] = UNDEFINED,
    user_limit: UndefinedOr[int] = UNDEFINED,
    bitrate: UndefinedOr[int] = UNDEFINED,
    permission_overwrites: UndefinedOr[
        Sequence[PermissionOverwrite]
    ] = UNDEFINED,
    region: UndefinedOr[VoiceRegion | str] = UNDEFINED,
    category: UndefinedOr[
        SnowflakeishOr[GuildCategory]
    ] = UNDEFINED,
    reason: UndefinedOr[str] = UNDEFINED,
) -> GuildStageChannel

Create a stage channel in the guild.

PARAMETER DESCRIPTION
name

The channel's name. Must be between 2 and 1000 characters.

TYPE: str

position

If provided, the position of the channel (relative to the category, if any).

TYPE: UndefinedOr[int] DEFAULT: UNDEFINED

user_limit

If provided, the maximum users in the channel at once. Must be between 0 and 99 with 0 meaning no limit.

TYPE: UndefinedOr[int] DEFAULT: UNDEFINED

bitrate

If provided, the bitrate for the channel. Must be between 8000 and 96000 or 8000 and 128000 for VIP servers.

TYPE: UndefinedOr[int] DEFAULT: UNDEFINED

permission_overwrites

If provided, the permission overwrites for the channel.

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

region

If provided, the voice region to for this channel. Passing None here will set it to "auto" mode where the used region will be decided based on the first person who connects to it when it's empty.

TYPE: UndefinedOr[VoiceRegion | str] DEFAULT: UNDEFINED

category

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

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

reason

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

TYPE: UndefinedOr[str] DEFAULT: UNDEFINED

RETURNS DESCRIPTION
GuildStageChannel

The created channel.

RAISES DESCRIPTION
BadRequestError

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

ForbiddenError

If you are missing the hikari.permissions.Permissions.MANAGE_CHANNELS permission.

UnauthorizedError

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

NotFoundError

If the guild is not found.

RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

InternalServerError

If an internal error occurs on Discord while handling the request.

create_sticker async #

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

Create a sticker in a guild.

Note

Lottie support is only available for verified and partnered servers.

PARAMETER DESCRIPTION
name

The name for the sticker.

TYPE: str

tag

The tag for the sticker.

TYPE: str

image

The 320x320 image for the sticker. Maximum upload size is 500kb. This can be a still PNG, an animated PNG, a Lottie, or a GIF.

TYPE: Resourceish

description

If provided, the description of the sticker.

TYPE: UndefinedOr[str] DEFAULT: UNDEFINED

reason

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

TYPE: UndefinedOr[str] DEFAULT: UNDEFINED

RETURNS DESCRIPTION
GuildSticker

The created sticker.

RAISES DESCRIPTION
BadRequestError

If any of the fields that are passed have an invalid value or if there are no more spaces for the sticker in the guild.

ForbiddenError
NotFoundError

If the guild is not found.

UnauthorizedError

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

RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

InternalServerError

If an internal error occurs on Discord while handling the request.

create_text_channel async #

create_text_channel(
    name: str,
    *,
    position: UndefinedOr[int] = UNDEFINED,
    topic: UndefinedOr[str] = UNDEFINED,
    nsfw: UndefinedOr[bool] = UNDEFINED,
    rate_limit_per_user: UndefinedOr[
        Intervalish
    ] = UNDEFINED,
    permission_overwrites: UndefinedOr[
        Sequence[PermissionOverwrite]
    ] = UNDEFINED,
    category: UndefinedOr[
        SnowflakeishOr[GuildCategory]
    ] = UNDEFINED,
    reason: UndefinedOr[str] = UNDEFINED,
) -> GuildTextChannel

Create a text channel in the guild.

PARAMETER DESCRIPTION
name

The channels name. Must be between 2 and 1000 characters.

TYPE: str

position

If provided, the position of the channel (relative to the category, if any).

TYPE: UndefinedOr[int] DEFAULT: UNDEFINED

topic

If provided, the channels topic. Maximum 1024 characters.

TYPE: UndefinedOr[str] DEFAULT: UNDEFINED

nsfw

If provided, whether to mark the channel as NSFW.

TYPE: UndefinedOr[bool] DEFAULT: UNDEFINED

rate_limit_per_user

If provided, the amount of seconds a user has to wait before being able to send another message in the channel. Maximum 21600 seconds.

TYPE: UndefinedOr[Intervalish] DEFAULT: UNDEFINED

permission_overwrites

If provided, the permission overwrites for the channel.

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

category

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

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

reason

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

TYPE: UndefinedOr[str] DEFAULT: UNDEFINED

RETURNS DESCRIPTION
GuildTextChannel

The created channel.

RAISES DESCRIPTION
BadRequestError

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

ForbiddenError

If you are missing the hikari.permissions.Permissions.MANAGE_CHANNELS permission.

UnauthorizedError

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

NotFoundError

If the guild is not found.

RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

InternalServerError

If an internal error occurs on Discord while handling the request.

create_voice_channel async #

create_voice_channel(
    name: str,
    *,
    position: UndefinedOr[int] = UNDEFINED,
    user_limit: UndefinedOr[int] = UNDEFINED,
    bitrate: UndefinedOr[int] = UNDEFINED,
    video_quality_mode: UndefinedOr[
        VideoQualityMode | int
    ] = UNDEFINED,
    permission_overwrites: UndefinedOr[
        Sequence[PermissionOverwrite]
    ] = UNDEFINED,
    region: UndefinedOr[VoiceRegion | str] = UNDEFINED,
    category: UndefinedOr[
        SnowflakeishOr[GuildCategory]
    ] = UNDEFINED,
    reason: UndefinedOr[str] = UNDEFINED,
) -> GuildVoiceChannel

Create a voice channel in a guild.

PARAMETER DESCRIPTION
name

The channels name. Must be between 2 and 1000 characters.

TYPE: str

position

If provided, the position of the channel (relative to the category, if any).

TYPE: UndefinedOr[int] DEFAULT: UNDEFINED

user_limit

If provided, the maximum users in the channel at once. Must be between 0 and 99 with 0 meaning no limit.

TYPE: UndefinedOr[int] DEFAULT: UNDEFINED

bitrate

If provided, the bitrate for the channel. Must be between 8000 and 96000 or 8000 and 128000 for VIP servers.

TYPE: UndefinedOr[int] DEFAULT: UNDEFINED

video_quality_mode

If provided, the new video quality mode for the channel.

TYPE: UndefinedOr[VideoQualityMode | int] DEFAULT: UNDEFINED

permission_overwrites

If provided, the permission overwrites for the channel.

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

region

If provided, the voice region to for this channel. Passing None here will set it to "auto" mode where the used region will be decided based on the first person who connects to it when it's empty.

TYPE: UndefinedOr[VoiceRegion | str] DEFAULT: UNDEFINED

category

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

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

reason

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

TYPE: UndefinedOr[str] DEFAULT: UNDEFINED

RETURNS DESCRIPTION
GuildVoiceChannel

The created channel.

RAISES DESCRIPTION
BadRequestError

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

ForbiddenError

If you are missing the hikari.permissions.Permissions.MANAGE_CHANNELS permission.

UnauthorizedError

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

NotFoundError

If the gui ld is not found.

RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

InternalServerError

If an internal error occurs on Discord while handling the request.

delete_channel async #

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

Delete a channel in the guild.

Note

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

Note

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

PARAMETER DESCRIPTION
channel

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

TYPE: SnowflakeishOr[GuildChannel]

RETURNS DESCRIPTION
GuildChannel

Object of the channel or category that was deleted.

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

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

ForbiddenError

If you are missing the hikari.permissions.Permissions.MANAGE_CHANNELS permission in the channel.

NotFoundError

If the channel is not found.

RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

InternalServerError

If an internal error occurs on Discord while handling the request.

delete_sticker async #

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

Delete a sticker in a guild.

PARAMETER DESCRIPTION
sticker

The sticker to delete. This can be a sticker object or the ID of an existing sticker.

TYPE: SnowflakeishOr[PartialSticker]

reason

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

TYPE: UndefinedOr[str] DEFAULT: UNDEFINED

RAISES DESCRIPTION
ForbiddenError
NotFoundError

If the guild or the sticker are not found.

UnauthorizedError

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

RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

InternalServerError

If an internal error occurs on Discord while handling the request.

edit async #

Edit the guild.

PARAMETER DESCRIPTION
name

If provided, the new name for the guild.

TYPE: UndefinedOr[str] DEFAULT: UNDEFINED

verification_level

If provided, the new verification level.

TYPE: UndefinedOr[GuildVerificationLevel] DEFAULT: UNDEFINED

default_message_notifications

If provided, the new default message notifications level.

TYPE: UndefinedOr[GuildMessageNotificationsLevel] DEFAULT: UNDEFINED

explicit_content_filter_level

If provided, the new explicit content filter level.

TYPE: UndefinedOr[GuildExplicitContentFilterLevel] DEFAULT: UNDEFINED

afk_channel

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

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

afk_timeout

If provided, the new afk timeout.

TYPE: UndefinedOr[Intervalish] DEFAULT: UNDEFINED

icon

If provided, the new guild icon. Must be a 1024x1024 image or can be an animated gif when the guild has the hikari.guilds.GuildFeature.ANIMATED_ICON feature.

TYPE: UndefinedNoneOr[Resourceish] DEFAULT: UNDEFINED

owner

If provided, the new guild owner.

Warning

You need to be the owner of the server to use this.

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

splash

If provided, the new guild splash. Must be a 16:9 image and the guild must have the hikari.guilds.GuildFeature.INVITE_SPLASH feature.

TYPE: UndefinedNoneOr[Resourceish] DEFAULT: UNDEFINED

banner

If provided, the new guild banner. Must be a 16:9 image and the guild must have the hikari.guilds.GuildFeature.BANNER feature.

TYPE: UndefinedNoneOr[Resourceish] DEFAULT: UNDEFINED

system_channel

If provided, the new system channel.

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

rules_channel

If provided, the new rules channel.

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

public_updates_channel

If provided, the new public updates channel.

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

preferred_locale

If provided, the new preferred locale.

TYPE: UndefinedOr[str | Locale] DEFAULT: UNDEFINED

features

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

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

reason

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

TYPE: UndefinedOr[str] DEFAULT: UNDEFINED

RETURNS DESCRIPTION
RESTGuild

The edited guild.

RAISES DESCRIPTION
BadRequestError

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

ForbiddenError

If you are missing the hikari.permissions.Permissions.MANAGE_GUILD permission or if you tried to pass ownership without being the server owner.

UnauthorizedError

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

NotFoundError

If the guild is not found.

RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

InternalServerError

If an internal error occurs on Discord while handling the request.

edit_sticker async #

edit_sticker(
    sticker: SnowflakeishOr[PartialSticker],
    *,
    name: UndefinedOr[str] = UNDEFINED,
    description: UndefinedOr[str] = UNDEFINED,
    tag: UndefinedOr[str] = UNDEFINED,
    reason: UndefinedOr[str] = UNDEFINED,
) -> GuildSticker

Edit a sticker in a guild.

PARAMETER DESCRIPTION
sticker

The sticker to edit. This can be a sticker object or the ID of an existing sticker.

TYPE: SnowflakeishOr[PartialSticker]

name

If provided, the new name for the sticker.

TYPE: UndefinedOr[str] DEFAULT: UNDEFINED

description

If provided, the new description for the sticker.

TYPE: UndefinedOr[str] DEFAULT: UNDEFINED

tag

If provided, the new sticker tag.

TYPE: UndefinedOr[str] DEFAULT: UNDEFINED

reason

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

TYPE: UndefinedOr[str] DEFAULT: UNDEFINED

RETURNS DESCRIPTION
GuildSticker

The edited sticker.

RAISES DESCRIPTION
BadRequestError

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

ForbiddenError
NotFoundError

If the guild or the sticker are not found.

UnauthorizedError

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

RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

InternalServerError

If an internal error occurs on Discord while handling the request.

fetch_emoji async #

fetch_emoji(
    emoji: SnowflakeishOr[CustomEmoji],
) -> KnownCustomEmoji

Fetch an emoji from the guild.

PARAMETER DESCRIPTION
emoji

The emoji to fetch. This can be a hikari.emojis.CustomEmoji or the ID of an existing emoji.

TYPE: SnowflakeishOr[CustomEmoji]

RETURNS DESCRIPTION
KnownCustomEmoji

The requested emoji.

RAISES DESCRIPTION
NotFoundError

If the guild or the emoji are not found.

UnauthorizedError

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

RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

InternalServerError

If an internal error occurs on Discord while handling the request.

fetch_emojis async #

fetch_emojis() -> Sequence[KnownCustomEmoji]

Fetch the emojis of the guild.

RETURNS DESCRIPTION
Sequence[KnownCustomEmoji]

The requested emojis.

RAISES DESCRIPTION
NotFoundError

If the guild is not found.

UnauthorizedError

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

RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

InternalServerError

If an internal error occurs on Discord while handling the request.

fetch_roles async #

fetch_roles() -> Sequence[Role]

Fetch the roles of the guild.

RETURNS DESCRIPTION
Sequence[Role]

The requested roles.

RAISES DESCRIPTION
UnauthorizedError

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

NotFoundError

If the guild is not found.

RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

InternalServerError

If an internal error occurs on Discord while handling the request.

fetch_self async #

fetch_self() -> RESTGuild

Fetch the guild.

RETURNS DESCRIPTION
RESTGuild

The requested guild.

RAISES DESCRIPTION
ForbiddenError

If you are not part of the guild.

NotFoundError

If the guild is not found.

UnauthorizedError

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

RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

InternalServerError

If an internal error occurs on Discord while handling the request.

fetch_sticker async #

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

Fetch a sticker from the guild.

PARAMETER DESCRIPTION
sticker

The sticker to fetch. This can be a sticker object or the ID of an existing sticker.

TYPE: SnowflakeishOr[PartialSticker]

RETURNS DESCRIPTION
GuildSticker

The requested sticker.

RAISES DESCRIPTION
ForbiddenError

If you are not part of the server.

NotFoundError

If the guild or the sticker are not found.

UnauthorizedError

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

RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

InternalServerError

If an internal error occurs on Discord while handling the request.

fetch_stickers async #

fetch_stickers() -> Sequence[GuildSticker]

Fetch the stickers of the guild.

RETURNS DESCRIPTION
Sequence[GuildSticker]

The requested stickers.

RAISES DESCRIPTION
ForbiddenError

If you are not part of the server.

NotFoundError

If the guild is not found.

UnauthorizedError

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

RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

InternalServerError

If an internal error occurs on Discord while handling the request.

kick async #

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

Kick the given user from this guild.

PARAMETER DESCRIPTION
user

The user to kick from the guild.

TYPE: SnowflakeishOr[PartialUser]

reason

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

TYPE: UndefinedOr[str] DEFAULT: UNDEFINED

RAISES DESCRIPTION
BadRequestError

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

ForbiddenError

If you are missing the hikari.permissions.Permissions.KICK_MEMBERS permission.

UnauthorizedError

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

NotFoundError

If the guild or user are not found.

RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

InternalServerError

If an internal error occurs on Discord while handling the request.

make_icon_url #

make_icon_url(
    *,
    file_format: UndefinedOr[
        Literal[
            "PNG", "JPEG", "JPG", "WEBP", "AWEBP", "GIF"
        ]
    ] = UNDEFINED,
    size: int = 4096,
    lossless: bool = True,
) -> URL | None

Generate the guild's icon URL, if set.

If no icon is set, this returns None.

PARAMETER DESCRIPTION
file_format

The format to use for this URL.

Supports PNG, JPEG, JPG, WEBP, AWEBP and GIF.

If not specified, the format will be determined based on whether the icon is animated or not.

TYPE: UndefinedOr[Literal['PNG', 'JPEG', 'JPG', 'WEBP', 'AWEBP', 'GIF']] DEFAULT: UNDEFINED

size

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

TYPE: int DEFAULT: 4096

lossless

Whether to return a lossless or compressed WEBP image; This is ignored if file_format is not WEBP.

TYPE: bool DEFAULT: True

RETURNS DESCRIPTION
Optional[URL]

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

RAISES DESCRIPTION
TypeError

If an invalid format is passed for file_format; If an animated format is requested for a static icon.

ValueError

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

set_incident_actions async #

set_incident_actions(
    *,
    invites_disabled_until: datetime | None = None,
    dms_disabled_until: datetime | None = None,
) -> GuildIncidents

Set the incident actions for the guild.

Warning

This endpoint will reset any previous security measures if not specified. This is a Discord limitation.

PARAMETER DESCRIPTION
invites_disabled_until

The datetime when invites will be enabled again.

If None, invites will be enabled again immediately.

Note

If hikari.guilds.GuildFeature.INVITES_DISABLED is active, this value will be ignored.

TYPE: datetime | None DEFAULT: None

dms_disabled_until

The datetime when direct messages between non-friend guild members will be enabled again.

If None, direct messages will be enabled again immediately.

TYPE: datetime | None DEFAULT: None

RETURNS DESCRIPTION
GuildIncidents

A guild incidents object with the updated incident actions.

RAISES DESCRIPTION
BadRequestError

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

ForbiddenError
UnauthorizedError

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

NotFoundError

If the guild is not found.

RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

InternalServerError

If an internal error occurs on Discord while handling the request.

unban async #

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

Unban the given user from this guild.

PARAMETER DESCRIPTION
user

The user to unban from the guild.

TYPE: SnowflakeishOr[PartialUser]

reason

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

TYPE: UndefinedOr[str] DEFAULT: UNDEFINED

RAISES DESCRIPTION
BadRequestError

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

ForbiddenError

If you are missing the hikari.permissions.Permissions.BAN_MEMBERS permission.

UnauthorizedError

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

NotFoundError

If the guild or user are not found.

RateLimitTooLongError

Raised in the event that a rate limit occurs that is longer than max_rate_limit when making a request.

InternalServerError

If an internal error occurs on Discord while handling the request.

PartialIntegration #

Bases: Unique

A partial representation of an integration, found in audit logs.

account class-attribute instance-attribute #

account: IntegrationAccount = attrs.field(
    eq=False, hash=False, repr=False
)

The account connected to this integration.

id class-attribute instance-attribute #

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

The ID of this entity.

name class-attribute instance-attribute #

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

The name of this integration.

type class-attribute instance-attribute #

type: IntegrationType | str = attrs.field(
    eq=False, hash=False, repr=True
)

The type of this integration.

PartialRole #

Bases: Unique

Represents a partial guild bound role object.

app class-attribute instance-attribute #

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

Client application that models may use for procedures.

id class-attribute instance-attribute #

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

The ID of this entity.

mention property #

mention: str

Return a raw mention string for the role.

name class-attribute instance-attribute #

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

The role's name.

RESTGuild #

Bases: Guild

Guild specialization that is sent via the REST API only.

approximate_active_member_count class-attribute instance-attribute #

approximate_active_member_count: int | None = attrs.field(
    eq=False, hash=False, repr=False
)

The approximate number of members in the guild that are not offline.

This will be None when creating a guild.

approximate_member_count class-attribute instance-attribute #

approximate_member_count: int | None = attrs.field(
    eq=False, hash=False, repr=False
)

The approximate number of members in the guild.

This will be None when creating a guild.

emojis class-attribute instance-attribute #

emojis: Mapping[Snowflake, KnownCustomEmoji] = attrs.field(
    eq=False, hash=False, repr=False
)

A mapping of emoji IDs to the objects of the emojis this guild provides.

max_members class-attribute instance-attribute #

max_members: int = attrs.field(
    eq=False, hash=False, repr=False
)

The maximum number of members allowed in this guild.

max_presences class-attribute instance-attribute #

max_presences: int | None = attrs.field(
    eq=False, hash=False, repr=False
)

The maximum number of presences for the guild.

If None, then there is no limit.

roles class-attribute instance-attribute #

roles: Mapping[Snowflake, Role] = attrs.field(
    eq=False, hash=False, repr=False
)

The roles in this guild, represented as a mapping of role ID to role object.

stickers class-attribute instance-attribute #

stickers: Mapping[Snowflake, GuildSticker] = attrs.field(
    eq=False, hash=False, repr=False
)

A mapping of sticker IDs to the objects of the stickers this guild provides.

Role #

Bases: PartialRole

Represents a guild bound role object.

bot_id class-attribute instance-attribute #

bot_id: Snowflake | None = attrs.field(
    eq=False, hash=False, repr=True
)

The ID of the bot this role belongs to.

If None, this is not a bot role.

color class-attribute instance-attribute #

color: Color = attrs.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.

colors class-attribute instance-attribute #

colors: ColorGradient = attrs.field(
    eq=False, hash=False, repr=True
)

The colors of this role.

Unlike the color field, this can also hold the role's gradient or holographic colors if set.

colour property #

colour: Colour

Alias for the color field.

colours property #

colours: ColourGradient

Alias for the colors field.

guild_id class-attribute instance-attribute #

guild_id: Snowflake = attrs.field(
    eq=False, hash=False, repr=True
)

The ID of the guild this role belongs to.

icon_hash class-attribute instance-attribute #

icon_hash: str | None = attrs.field(
    eq=False, hash=False, repr=False
)

Hash of the role's icon if set, else None.

integration_id class-attribute instance-attribute #

integration_id: Snowflake | None = attrs.field(
    eq=False, hash=False, repr=True
)

The ID of the integration this role belongs to.

If None, this is not a integration role.

is_available_for_purchase class-attribute instance-attribute #

is_available_for_purchase: bool = attrs.field(
    eq=False, hash=False, repr=True
)

Whether this role is available for purchase.

is_guild_linked_role class-attribute instance-attribute #

is_guild_linked_role: bool = attrs.field(
    eq=False, hash=False, repr=True
)

Whether this role is a linked role in the guild.

is_hoisted class-attribute instance-attribute #

is_hoisted: bool = attrs.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_managed class-attribute instance-attribute #

is_managed: bool = attrs.field(
    eq=False, hash=False, repr=False
)

Whether this role is managed by an integration.

is_mentionable class-attribute instance-attribute #

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

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

is_premium_subscriber_role class-attribute instance-attribute #

is_premium_subscriber_role: bool = attrs.field(
    eq=False, hash=False, repr=True
)

Whether this role is the guild's nitro subscriber role.

mention property #

mention: str

Return a raw mention string for the role.

When this role represents @everyone mentions will only work if mentions_everyone is True.

permissions class-attribute instance-attribute #

permissions: Permissions = attrs.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.

position class-attribute instance-attribute #

position: int = attrs.field(
    eq=False, hash=False, repr=True
)

The position of this role in the role hierarchy.

This will start at 0 for the lowest role (@everyone) and increase as you go up the hierarchy.

subscription_listing_id class-attribute instance-attribute #

subscription_listing_id: Snowflake | None = attrs.field(
    eq=False, hash=False, repr=True
)

The ID of this role's subscription SKU and listing.

If None, this is not a purchasable role.

unicode_emoji class-attribute instance-attribute #

unicode_emoji: UnicodeEmoji | None = attrs.field(
    eq=False, hash=False, repr=False
)

Role's icon as an unicode emoji if set, else None.

make_icon_url #

make_icon_url(
    *,
    file_format: Literal[
        "PNG", "JPEG", "JPG", "WEBP"
    ] = "PNG",
    size: int = 4096,
    lossless: bool = True,
) -> URL | None

Generate the icon URL for this role, if set.

If no icon is set, this returns None.

PARAMETER DESCRIPTION
file_format

The format to use for this URL.

Supports PNG, JPEG, JPG, and WEBP.

If not specified, the format will be PNG.

TYPE: Literal['PNG', 'JPEG', 'JPG', 'WEBP'] DEFAULT: 'PNG'

size

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

TYPE: int DEFAULT: 4096

lossless

Whether to return a lossless or compressed WEBP image; This is ignored if file_format is not WEBP.

TYPE: bool DEFAULT: True

RETURNS DESCRIPTION
Optional[URL]

The URL, or None if no icon is set.

RAISES DESCRIPTION
TypeError

If an invalid format is passed for file_format.

ValueError

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

WelcomeChannel #

Used to represent channels on guild welcome screens.

channel_id class-attribute instance-attribute #

channel_id: Snowflake = attrs.field(hash=False, repr=True)

ID of the channel shown in the welcome screen.

description class-attribute instance-attribute #

description: str = attrs.field(hash=False, repr=False)

The description shown for this channel.

emoji_id class-attribute instance-attribute #

emoji_id: Snowflake | None = attrs.field(
    default=None, kw_only=True, hash=False, repr=True
)

ID of the emoji shown in the welcome screen channel if it's set to a custom emoji.

emoji_name class-attribute instance-attribute #

emoji_name: str | UnicodeEmoji | None = attrs.field(
    default=None, kw_only=True, hash=False, repr=True
)

The emoji shown in the welcome screen channel if set to a unicode emoji.

Warning

While it may also be present for custom emojis, this is neither guaranteed to be provided nor accurate.

WelcomeScreen #

Used to represent guild welcome screens on Discord.

channels class-attribute instance-attribute #

channels: Sequence[WelcomeChannel] = attrs.field(
    hash=False, repr=True
)

An array of up to 5 of the channels shown in the welcome screen.

description class-attribute instance-attribute #

description: str | None = attrs.field(hash=False, repr=True)

The guild's description shown in the welcome screen.