hikari.guilds#

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

Module Contents#

class hikari.guilds.GatewayGuild[source]#

Bases: Guild

Guild specialization that is sent via the gateway only.

is_large: bool | None[source]#

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: datetime.datetime | None[source]#

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: int | None[source]#

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.

class hikari.guilds.Guild[source]#

Bases: PartialGuild

A representation of a guild on Discord.

property banner_url: hikari.files.URL | None[source]#

Banner URL for the guild, if set.

property discovery_splash_url: hikari.files.URL | None[source]#

Discovery splash URL for the guild, if set.

property splash_url: hikari.files.URL | None[source]#

Splash URL for the guild, if set.

afk_channel_id: hikari.snowflakes.Snowflake | None[source]#

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

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

afk_timeout: datetime.timedelta[source]#

Timeout for activity before a member is classed as AFK.

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

application_id: hikari.snowflakes.Snowflake | None[source]#

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: str | None[source]#

The hash for the guild’s banner.

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

default_message_notifications: GuildMessageNotificationsLevel | int[source]#

The default setting for message notifications in this guild.

description: str | None[source]#

The guild’s description.

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

discovery_splash_hash: str | None[source]#

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

explicit_content_filter: GuildExplicitContentFilterLevel | int[source]#

The setting for the explicit content filter in this guild.

features: Sequence[str | GuildFeature][source]#

A list of the features in this guild.

is_widget_enabled: bool | None[source]#

Describes whether the guild widget is enabled or not.

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

max_video_channel_users: int | None[source]#

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: GuildMFALevel | int[source]#

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

nsfw_level: GuildNSFWLevel[source]#

The NSFW level of the guild.

owner_id: hikari.snowflakes.Snowflake[source]#

The ID of the owner of this guild.

preferred_locale: str | hikari.locales.Locale[source]#

The preferred locale to use for this guild.

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

premium_subscription_count: int | None[source]#

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: GuildPremiumTier | int[source]#

The premium tier for this guild.

public_updates_channel_id: hikari.snowflakes.Snowflake | None[source]#

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

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

rules_channel_id: hikari.snowflakes.Snowflake | None[source]#

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

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

splash_hash: str | None[source]#

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

system_channel_flags: GuildSystemChannelFlag[source]#

Return flags for the guild system channel.

These are used to describe which notifications are suppressed.

system_channel_id: hikari.snowflakes.Snowflake | None[source]#

The ID of the system channel or None if it is not enabled.

Welcome messages and Nitro boost messages may be sent to this channel.

vanity_url_code: str | None[source]#

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

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

verification_level: GuildVerificationLevel | int[source]#

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

widget_channel_id: hikari.snowflakes.Snowflake | None[source]#

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.

async fetch_afk_channel()[source]#

Fetch the channel that AFK voice users get sent to.

Returns:
typing.Optional[hikari.channels.GuildVoiceChannel]

The AFK channel or None if not enabled.

Raises:
hikari.errors.UnauthorizedError

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

hikari.errors.ForbiddenError

If you are missing the READ_MESSAGES permission in the channel.

hikari.errors.NotFoundError

If the channel is not found.

hikari.errors.RateLimitTooLongError

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

hikari.errors.InternalServerError

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

async fetch_owner()[source]#

Fetch the owner of the guild.

Returns:
hikari.guilds.Member

The guild owner.

Raises:
hikari.errors.UnauthorizedError

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

hikari.errors.NotFoundError

If the guild or the user are not found.

hikari.errors.RateLimitTooLongError

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

hikari.errors.InternalServerError

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

async fetch_public_updates_channel()[source]#

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

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

Returns:
typing.Optional[hikari.channels.GuildTextChannel]

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

Raises:
hikari.errors.UnauthorizedError

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

hikari.errors.ForbiddenError

If you are missing the READ_MESSAGES permission in the channel.

hikari.errors.NotFoundError

If the channel is not found.

hikari.errors.RateLimitTooLongError

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

hikari.errors.InternalServerError

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

async fetch_rules_channel()[source]#

Fetch the channel where guilds display rules and guidelines.

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

Returns:
typing.Optional[hikari.channels.GuildTextChannel]

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

Raises:
hikari.errors.UnauthorizedError

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

hikari.errors.ForbiddenError

If you are missing the READ_MESSAGES permission in the channel.

hikari.errors.NotFoundError

If the channel is not found.

hikari.errors.RateLimitTooLongError

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

hikari.errors.InternalServerError

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

async fetch_system_channel()[source]#

Fetch the system channel.

Returns:
typing.Optional[hikari.channels.GuildTextChannel]

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

Raises:
hikari.errors.UnauthorizedError

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

hikari.errors.ForbiddenError

If you are missing the READ_MESSAGES permission in the channel.

hikari.errors.NotFoundError

If the channel is not found.

hikari.errors.RateLimitTooLongError

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

hikari.errors.InternalServerError

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

async fetch_widget_channel()[source]#

Fetch the widget channel.

This will be None if not set.

Returns:
typing.Optional[hikari.channels.GuildChannel]

The channel the widget is linked to or else None.

Raises:
hikari.errors.UnauthorizedError

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

hikari.errors.ForbiddenError

If you are missing the READ_MESSAGES permission in the channel.

hikari.errors.NotFoundError

If the channel is not found.

hikari.errors.RateLimitTooLongError

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

hikari.errors.InternalServerError

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

get_channel(channel)[source]#

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

Parameters:
channelhikari.snowflakes.SnowflakeishOr[hikari.channels.PartialChannel]

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

Returns:
typing.Optional[hikari.channels.GuildChannel]

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

get_channels()[source]#

Get the channels cached for the guild.

Returns:
typing.Mapping[hikari.snowflakes.Snowflake, hikari.channels.GuildChannel]

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

get_emoji(emoji)[source]#

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

Parameters:
emojihikari.snowflakes.SnowflakeishOr[hikari.emojis.CustomEmoji]

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

Returns:
typing.Optional[hikari.emojis.KnownCustomEmoji]

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

get_emojis()[source]#

Return the emojis in this guild.

Returns:
typing.Mapping[hikari.snowflakes.Snowflake, hikari.emojis.KnownCustomEmoji]

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

get_member(user)[source]#

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

Parameters:
userhikari.snowflakes.SnowflakeishOr[hikari.users.PartialUser]

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

Returns:
typing.Optional[Member]

The cached member object if found, else None.

get_members()[source]#

Get the members cached for the guild.

Returns:
typing.Mapping[hikari.snowflakes.Snowflake, Member]

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

get_my_member()[source]#

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

Returns:
typing.Optional[Member]

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

get_presence(user)[source]#

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

Parameters:
userhikari.snowflakes.SnowflakeishOr[hikari.users.PartialUser]

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

Returns:
typing.Optional[hikari.presences.MemberPresence]

The cached presence object if found, else None.

get_presences()[source]#

Get the presences cached for the guild.

Returns:
typing.Mapping[hikari.snowflakes.Snowflake, hikari.presences.MemberPresence]

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

get_role(role)[source]#

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

Parameters:
rolehikari.snowflakes.SnowflakeishOr[PartialRole]

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

Returns:
typing.Optional[Role]

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

get_roles()[source]#

Return the roles in this guild.

Returns:
typing.Mapping[hikari.snowflakes.Snowflake, Role]

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

get_sticker(sticker)[source]#

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

Parameters:
stickerhikari.snowflakes.SnowflakeishOr[hikari.stickers.GuildSticker]

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

Returns:
typing.Optional[hikari.stickers.GuildSticker]

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

get_stickers()[source]#

Return the stickers in this guild.

Returns:
typing.Mapping[hikari.snowflakes.Snowflake, hikari.stickers.GuildSticker]

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

get_voice_state(user)[source]#

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

Parameters:
userhikari.snowflakes.SnowflakeishOr[hikari.users.PartialUser]

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

Returns:
typing.Optional[hikari.voices.VoiceState]

The cached voice state object if found, else None.

get_voice_states()[source]#

Get the voice states cached for the guild.

Returns:
typing.Mapping[hikari.snowflakes.Snowflake, hikari.voices.VoiceState]

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

make_banner_url(*, ext=None, size=4096)[source]#

Generate the guild’s banner image URL, if set.

Parameters:
exttyping.Optional[str]

The ext to use for this URL, defaults to png or gif. Supports png, jpeg, jpg, webp and gif (when animated).

If None, then the correct default extension is determined based on whether the banner is animated or not.

sizeint

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

Returns:
typing.Optional[hikari.files.URL]

The URL of the banner, or None if no banner is set.

Raises:
ValueError

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

make_discovery_splash_url(*, ext='png', size=4096)[source]#

Generate the guild’s discovery splash image URL, if set.

Parameters:
extstr

The extension to use for this URL, defaults to png. Supports png, jpeg, jpg and webp.

sizeint

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

Returns:
typing.Optional[hikari.files.URL]

The string URL.

Raises:
ValueError

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

make_splash_url(*, ext='png', size=4096)[source]#

Generate the guild’s splash image URL, if set.

Parameters:
extstr

The extension to use for this URL, defaults to png. Supports png, jpeg, jpg and webp.

sizeint

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

Returns:
typing.Optional[hikari.files.URL]

The URL to the splash, or None if not set.

Raises:
ValueError

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

class hikari.guilds.GuildBan[source]#

Used to represent guild bans.

reason: str | None[source]#

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

user: hikari.users.User[source]#

The object of the user this ban targets.

class hikari.guilds.GuildExplicitContentFilterLevel[source]#

Bases: int, hikari.internal.enums.Enum

Represents the explicit content filter setting for a guild.

ALL_MEMBERS = 2[source]#

Filter all posts.

DISABLED = 0[source]#

No explicit content filter.

MEMBERS_WITHOUT_ROLES = 1[source]#

Filter posts from anyone without a role.

class hikari.guilds.GuildFeature[source]#

Bases: str, hikari.internal.enums.Enum

Features that a guild can provide.

ANIMATED_ICON = 'ANIMATED_ICON'[source]#

Guild has access to set an animated guild icon.

BANNER = 'BANNER'[source]#

Guild has access to set a guild banner image.

COMMERCE = 'COMMERCE'[source]#

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

COMMUNITY = 'COMMUNITY'[source]#

Guild has community features enabled.

CREATOR_MONETIZABLE = 'CREATOR_MONETIZABLE_PROVISIONAL'[source]#

Guild has enabled monetization.

CREATOR_STORE_PAGE = 'CREATOR_STORE_PAGE'[source]#

Guild has enabled the store page.

DISCOVERABLE = 'DISCOVERABLE'[source]#

Guild is able to be discovered in the directory.

This also implies the guild can be viewed without joining.

FEATURABLE = 'FEATURABLE'[source]#

Guild is able to be featured in the directory.

INVITE_SPLASH = 'INVITE_SPLASH'[source]#

Guild has access to set an invite splash background.

MEMBER_VERIFICATION_GATE_ENABLED = 'MEMBER_VERIFICATION_GATE_ENABLED'[source]#

Guild has enabled Membership Screening.

MONETIZATION_ENABLED = 'MONETIZATION_ENABLED'[source]#

Guild has enabled monetization.

MORE_EMOJI = 'MORE_EMOJI'[source]#

More emojis can be hosted in this guild than normal.

MORE_STICKERS = 'MORE_STICKERS'[source]#

Guild has an increased custom stickers slots.

NEWS = 'NEWS'[source]#

Guild has access to create news channels.

PARTNERED = 'PARTNERED'[source]#

Guild is partnered.

PREVIEW_ENABLED = 'PREVIEW_ENABLED'[source]#

Guild can be viewed before Membership Screening is complete.

RELAY_ENABLED = 'RELAY_ENABLED'[source]#

Guild is using relays.

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

ROLE_SUBSCRIPTIONS_AVAILABLE_FOR_PURCHASE = 'ROLE_SUBSCRIPTIONS_AVAILABLE_FOR_PURCHASE'[source]#

Guild has role subscriptions available for purchase.

ROLE_SUBSCRIPTIONS_ENABLED = 'ROLE_SUBSCRIPTIONS_ENABLED'[source]#

Guild has enabled role subscriptions.

TICKETED_EVENTS_ENABLED = 'TICKETED_EVENTS_ENABLED'[source]#

Guild has enabled ticketed events.

VANITY_URL = 'VANITY_URL'[source]#

Guild has access to set a vanity URL.

VERIFIED = 'VERIFIED'[source]#

Guild is verified.

VIP_REGIONS = 'VIP_REGIONS'[source]#

Guild has access to set 384kbps bitrate in voice.

Previously gave access to VIP voice servers.

WELCOME_SCREEN_ENABLED = 'WELCOME_SCREEN_ENABLED'[source]#

Guild has enabled the welcome screen.

class hikari.guilds.GuildMFALevel[source]#

Bases: int, hikari.internal.enums.Enum

Represents the multi-factor authorization requirement for a guild.

ELEVATED = 1[source]#

MFA requirement.

NONE = 0[source]#

No MFA requirement.

class hikari.guilds.GuildMessageNotificationsLevel[source]#

Bases: int, hikari.internal.enums.Enum

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

ALL_MESSAGES = 0[source]#

Notify users when any message is sent.

ONLY_MENTIONS = 1[source]#

Only notify users when they are @mentioned.

class hikari.guilds.GuildNSFWLevel[source]#

Bases: int, hikari.internal.enums.Enum

Represents the NSFW level of a guild.

AGE_RESTRICTED = 3[source]#

Guild may contain NSFW content.

DEFAULT = 0[source]#

Guild has not been categorized yet.

EXPLICIT = 1[source]#

Guild contains explicit NSFW content.

SAFE = 2[source]#

Guild is safe of NSFW content.

class hikari.guilds.GuildPremiumTier[source]#

Bases: int, hikari.internal.enums.Enum

Tier for Discord Nitro boosting in a guild.

NONE = 0[source]#

No Nitro boost level.

TIER_1 = 1[source]#

Level 1 Nitro boost.

TIER_2 = 2[source]#

Level 2 Nitro boost.

TIER_3 = 3[source]#

Level 3 Nitro boost.

class hikari.guilds.GuildPreview[source]#

Bases: PartialGuild

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

property discovery_splash_url: hikari.files.URL | None[source]#

Discovery URL splash for the guild, if set.

property splash_url: hikari.files.URL | None[source]#

Splash URL for the guild, if set.

approximate_active_member_count: int[source]#

The approximate amount of presences in this guild.

approximate_member_count: int[source]#

The approximate amount of members in this guild.

description: str | None[source]#

The guild’s description, if set.

discovery_splash_hash: str | None[source]#

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

emojis: Mapping[hikari.snowflakes.Snowflake, hikari.emojis.KnownCustomEmoji][source]#

The mapping of IDs to the emojis this guild provides.

features: Sequence[str | GuildFeature][source]#

A list of the features in this guild.

splash_hash: str | None[source]#

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

make_discovery_splash_url(*, ext='png', size=4096)[source]#

Generate the guild’s discovery splash image URL, if set.

Parameters:
extstr

The extension to use for this URL, defaults to png. Supports png, jpeg, jpg and webp.

sizeint

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

Returns:
typing.Optional[hikari.files.URL]

The string URL.

Raises:
ValueError

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

make_splash_url(*, ext='png', size=4096)[source]#

Generate the guild’s splash image URL, if set.

Parameters:
extstr

The extension to use for this URL, defaults to png. Supports png, jpeg, jpg and webp.

sizeint

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

Returns:
typing.Optional[hikari.files.URL]

The URL to the splash, or None if not set.

Raises:
ValueError

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

class hikari.guilds.GuildSystemChannelFlag[source]#

Bases: hikari.internal.enums.Flag

Defines which features are suppressed in the system channel.

NONE = 0[source]#

Nothing is suppressed.

SUPPRESS_GUILD_REMINDER[source]#

Suppress displaying messages with guild setup tips.

SUPPRESS_PREMIUM_SUBSCRIPTION[source]#

Suppress displaying a message when the guild is Nitro boosted.

SUPPRESS_USER_JOIN[source]#

Suppress displaying a message about new users joining.

SUPPRESS_USER_JOIN_REPLIES[source]#

Suppress displaying a reply button on join notifications.

class hikari.guilds.GuildVerificationLevel[source]#

Bases: int, hikari.internal.enums.Enum

Represents the level of verification of a guild.

HIGH = 3[source]#

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

LOW = 1[source]#

Must have a verified email on their account.

MEDIUM = 2[source]#

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

NONE = 0[source]#

Unrestricted.

VERY_HIGH = 4[source]#

Must have a verified phone number.

class hikari.guilds.GuildWidget[source]#

Represents a guild widget.

app: hikari.traits.RESTAware[source]#

Client application that models may use for procedures.

channel_id: hikari.snowflakes.Snowflake | None[source]#

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

is_enabled: bool[source]#

Whether this embed is enabled.

async fetch_channel()[source]#

Fetch the widget channel.

This will be None if not set.

Returns:
typing.Optional[hikari.channels.GuildChannel]

The requested channel.

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

Raises:
hikari.errors.UnauthorizedError

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

hikari.errors.ForbiddenError

If you are missing the READ_MESSAGES permission in the channel.

hikari.errors.NotFoundError

If the channel is not found.

hikari.errors.RateLimitTooLongError

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

hikari.errors.InternalServerError

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

class hikari.guilds.Integration[source]#

Bases: PartialIntegration

Represents a guild integration object.

application: IntegrationApplication | None[source]#

The bot/OAuth2 application associated with this integration.

Note

This is only available for Discord integrations.

expire_behavior: IntegrationExpireBehaviour | int | None[source]#

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: datetime.timedelta | None[source]#

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: hikari.snowflakes.Snowflake[source]#

The ID of the guild this integration belongs to.

is_emojis_enabled: bool | None[source]#

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

is_enabled: bool[source]#

Whether this integration is enabled.

is_revoked: bool | None[source]#

Whether the integration has been revoked.

is_syncing: bool | None[source]#

Whether this integration is syncing subscribers/emojis.

last_synced_at: datetime.datetime | None[source]#

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

role_id: hikari.snowflakes.Snowflake | None[source]#

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

subscriber_count: int | None[source]#

The number of subscribers this integration has.

user: hikari.users.User | None[source]#

The user this integration belongs to.

class hikari.guilds.IntegrationAccount[source]#

An account that’s linked to an integration.

id: str[source]#

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

name: str[source]#

The name of this account.

class hikari.guilds.IntegrationApplication[source]#

Bases: PartialApplication

An application that’s linked to an integration.

bot: hikari.users.User | None[source]#

The bot associated with this application.

class hikari.guilds.IntegrationExpireBehaviour[source]#

Bases: int, hikari.internal.enums.Enum

Behavior for expiring integration subscribers.

KICK = 1[source]#

Kick the subscriber.

REMOVE_ROLE = 0[source]#

Remove the role.

class hikari.guilds.IntegrationType[source]#

Bases: str, hikari.internal.enums.Enum

The integration type.

DISCORD_BOT = 'discord'[source]#

Discord bot.

GUILD_SUBSCRIPTION = 'guild_subscription'[source]#

Guild subscription.

TWITCH = 'twitch'[source]#

Twitch.

YOUTUBE = 'youtube'[source]#

Youtube.

class hikari.guilds.Member[source]#

Bases: hikari.users.User

Used to represent a guild bound member.

property app: hikari.traits.RESTAware[source]#

Return the app that is bound to the user object.

property display_name: str[source]#

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

Nickname

Member.nickname.

Username

Member.username.

Globalname

Member.global_name.

property guild_avatar_url: hikari.files.URL | None[source]#

Guild Avatar URL for the user, if they have one set.

May be None if no guild avatar is set. In this case, you should use avatar_hash or default_avatar_url instead.

guild_avatar_hash: str | None[source]#

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

Note

This takes precedence over Member.avatar_hash.

guild_id: hikari.snowflakes.Snowflake[source]#

The ID of the guild this member belongs to.

is_deaf: hikari.undefined.UndefinedOr[bool][source]#

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: hikari.undefined.UndefinedOr[bool][source]#

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: hikari.undefined.UndefinedOr[bool][source]#

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

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

joined_at: datetime.datetime[source]#

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

nickname: str | None[source]#

This member’s nickname.

This will be None if not set.

premium_since: datetime.datetime | None[source]#

The datetime of when this member started “boosting” this guild.

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

raw_communication_disabled_until: datetime.datetime | None[source]#

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 communication_disabled_until method to check if the member is timed out at the time of the call.

role_ids: Sequence[hikari.snowflakes.Snowflake][source]#

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

user: hikari.users.User[source]#

This member’s corresponding user object.

async add_role(role, *, reason=undefined.UNDEFINED)[source]#

Add a role to the member.

Parameters:
rolehikari.snowflakes.SnowflakeishOr[hikari.guilds.PartialRole]

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

Other Parameters:
reasonhikari.undefined.UndefinedOr[str]

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

Raises:
hikari.errors.ForbiddenError

If you are missing the MANAGE_ROLES permission.

hikari.errors.UnauthorizedError

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

hikari.errors.NotFoundError

If the guild, user or role are not found.

hikari.errors.RateLimitTooLongError

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

hikari.errors.InternalServerError

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

async ban(*, delete_message_seconds=undefined.UNDEFINED, reason=undefined.UNDEFINED)[source]#

Ban this member from this guild.

Other Parameters:
delete_message_secondshikari.undefined.UndefinedNoneOr[hikari.internal.time.Intervalish]

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.

reasonhikari.undefined.UndefinedOr[str]

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

Raises:
hikari.errors.BadRequestError

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

hikari.errors.ForbiddenError

If you are missing the BAN_MEMBERS permission.

hikari.errors.UnauthorizedError

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

hikari.errors.NotFoundError

If the guild or user are not found.

hikari.errors.RateLimitTooLongError

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

hikari.errors.InternalServerError

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

communication_disabled_until()[source]#

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.

async edit(*, nickname=undefined.UNDEFINED, roles=undefined.UNDEFINED, mute=undefined.UNDEFINED, deaf=undefined.UNDEFINED, voice_channel=undefined.UNDEFINED, communication_disabled_until=undefined.UNDEFINED, reason=undefined.UNDEFINED)[source]#

Edit the member.

Other Parameters:
nicknamehikari.undefined.UndefinedNoneOr[str]

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

Requires the MANAGE_NICKNAMES permission.

roleshikari.undefined.UndefinedOr[hikari.snowflakes.SnowflakeishSequence[hikari.guilds.PartialRole]]

If provided, the new roles for the member.

Requires the MANAGE_ROLES permission.

mutehikari.undefined.UndefinedOr[bool]

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

Requires the MUTE_MEMBERS permission.

deafhikari.undefined.UndefinedOr[bool]

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

Requires the DEAFEN_MEMBERS permission.

voice_channelhikari.undefined.UndefinedOr[hikari.snowflakes.SnowflakeishOr[hikari.channels.GuildVoiceChannel]]]

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 MOVE_MEMBERS permission and the 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.

communication_disabled_untilhikari.undefined.UndefinedNoneOr[datetime.datetime]

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 MODERATE_MEMBERS permission.

reasonhikari.undefined.UndefinedOr[str]

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

Returns:
hikari.guilds.Member

Object of the member that was updated.

Raises:
hikari.errors.BadRequestError

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

hikari.errors.ForbiddenError

If you are missing a permission to do an action.

hikari.errors.UnauthorizedError

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

hikari.errors.NotFoundError

If the guild or the user are not found.

hikari.errors.RateLimitTooLongError

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

hikari.errors.InternalServerError

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

async fetch_roles()[source]#

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

Returns:
typing.Sequence[hikari.guilds.Role]

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

Raises:
hikari.errors.UnauthorizedError

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

hikari.errors.NotFoundError

If the member is not found.

hikari.errors.RateLimitTooLongError

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

hikari.errors.InternalServerError

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

async fetch_self()[source]#

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

Returns:
hikari.guilds.Member

An up-to-date view of this member.

Raises:
hikari.errors.UnauthorizedError

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

hikari.errors.NotFoundError

If the member is not found.

hikari.errors.RateLimitTooLongError

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

hikari.errors.InternalServerError

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

get_guild()[source]#

Return the guild associated with this member.

Returns:
typing.Optional[hikari.guilds.Guild]

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

get_presence()[source]#

Get the cached presence for this member, if known.

Presence info includes user status and activities.

This requires the GUILD_PRESENCES intent to be enabled.

Returns:
typing.Optional[hikari.presences.MemberPresence]

The member presence, or None if not known.

get_roles()[source]#

Return the roles the user has.

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

Returns:
typing.Sequence[hikari.guilds.Role]

The roles the users has.

get_top_role()[source]#

Return the highest role the member has.

Returns:
typing.Optional[hikari.guilds.Role]

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

async kick(*, reason=undefined.UNDEFINED)[source]#

Kick this member from this guild.

Other Parameters:
reasonhikari.undefined.UndefinedOr[str]

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

Raises:
hikari.errors.BadRequestError

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

hikari.errors.ForbiddenError

If you are missing the KICK_MEMBERS permission.

hikari.errors.UnauthorizedError

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

hikari.errors.NotFoundError

If the guild or user are not found.

hikari.errors.RateLimitTooLongError

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

hikari.errors.InternalServerError

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

make_guild_avatar_url(*, ext=None, size=4096)[source]#

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

If no guild avatar is set, this returns None. You can then use the make_avatar_url to get their global custom avatar or default_avatar_url if they have no custom avatar set.

Parameters:
exttyping.Optional[str]

The ext to use for this URL, defaults to png or gif. Supports png, jpeg, jpg, webp and gif (when animated). Will be ignored for default avatars which can only be png.

If None, then the correct default extension is determined based on whether the icon is animated or not.

sizeint

The size to set for the URL, defaults to 4096. Can be any power of two between 16 and 4096. Will be ignored for default avatars.

Returns:
typing.Optional[hikari.files.URL]

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

Raises:
ValueError

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

async remove_role(role, *, reason=undefined.UNDEFINED)[source]#

Remove a role from the member.

Parameters:
rolehikari.snowflakes.SnowflakeishOr[hikari.guilds.PartialRole]

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

Other Parameters:
reasonhikari.undefined.UndefinedOr[str]

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

Raises:
hikari.errors.ForbiddenError

If you are missing the MANAGE_ROLES permission.

hikari.errors.UnauthorizedError

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

hikari.errors.NotFoundError

If the guild, user or role are not found.

hikari.errors.RateLimitTooLongError

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

hikari.errors.InternalServerError

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

async unban(*, reason=undefined.UNDEFINED)[source]#

Unban this member from the guild.

Other Parameters:
reasonhikari.undefined.UndefinedOr[str]

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

Raises:
hikari.errors.BadRequestError

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

hikari.errors.ForbiddenError

If you are missing the BAN_MEMBERS permission.

hikari.errors.UnauthorizedError

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

hikari.errors.NotFoundError

If the guild or user are not found.

hikari.errors.RateLimitTooLongError

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

hikari.errors.InternalServerError

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

class hikari.guilds.PartialApplication[source]#

Bases: hikari.snowflakes.Unique

A partial representation of a Discord application.

property icon_url: hikari.files.URL | None[source]#

Team icon URL, if there is one.

description: str | None[source]#

The description of this application, if any.

icon_hash: str | None[source]#

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

id: hikari.snowflakes.Snowflake[source]#

The ID of this entity.

name: str[source]#

The name of this application.

make_icon_url(*, ext='png', size=4096)[source]#

Generate the icon URL for this application.

Parameters:
extstr

The extension to use for this URL, defaults to png. Supports png, jpeg, jpg and webp.

sizeint

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

Returns:
typing.Optional[hikari.files.URL]

The URL, or None if no icon exists.

Raises:
ValueError

If the size is not an integer power of 2 between 16 and 4096 (inclusive).

class hikari.guilds.PartialGuild[source]#

Bases: hikari.snowflakes.Unique

Base object for any partial guild objects.

property icon_url: hikari.files.URL | None[source]#

Icon URL for the guild, if set; otherwise None.

property shard_id: int | None[source]#

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

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

app: hikari.traits.RESTAware[source]#

Client application that models may use for procedures.

icon_hash: str | None[source]#

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

id: hikari.snowflakes.Snowflake[source]#

The ID of this entity.

name: str[source]#

The name of the guild.

async ban(user, *, delete_message_seconds=undefined.UNDEFINED, reason=undefined.UNDEFINED)[source]#

Ban the given user from this guild.

Parameters:
userhikari.snowflakes.Snowflakeish[hikari.users.PartialUser]

The user to ban from the guild.

Other Parameters:
delete_message_secondshikari.undefined.UndefinedNoneOr[hikari.internal.time.Intervalish]

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.

reasonhikari.undefined.UndefinedOr[str]

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

Raises:
hikari.errors.BadRequestError

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

hikari.errors.ForbiddenError

If you are missing the BAN_MEMBERS permission.

hikari.errors.UnauthorizedError

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

hikari.errors.NotFoundError

If the guild or user are not found.

hikari.errors.RateLimitTooLongError

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

hikari.errors.InternalServerError

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

async create_category(name, *, position=undefined.UNDEFINED, permission_overwrites=undefined.UNDEFINED, reason=undefined.UNDEFINED)[source]#

Create a category in the guild.

Parameters:
namestr

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

Other Parameters:
positionhikari.undefined.UndefinedOr[int]

If provided, the position of the category.

permission_overwriteshikari.undefined.UndefinedOr[typing.Sequence[hikari.channels.PermissionOverwrite]]

If provided, the permission overwrites for the category.

reasonhikari.undefined.UndefinedOr[str]

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

Returns:
hikari.channels.GuildCategory

The created category.

Raises:
hikari.errors.BadRequestError

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

hikari.errors.ForbiddenError

If you are missing the MANAGE_CHANNEL permission.

hikari.errors.UnauthorizedError

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

hikari.errors.NotFoundError

If the guild is not found.

hikari.errors.RateLimitTooLongError

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

hikari.errors.InternalServerError

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

async create_forum_channel(name, *, position=undefined.UNDEFINED, category=undefined.UNDEFINED, permission_overwrites=undefined.UNDEFINED, topic=undefined.UNDEFINED, nsfw=undefined.UNDEFINED, rate_limit_per_user=undefined.UNDEFINED, default_auto_archive_duration=undefined.UNDEFINED, default_thread_rate_limit_per_user=undefined.UNDEFINED, default_forum_layout=undefined.UNDEFINED, default_sort_order=undefined.UNDEFINED, available_tags=undefined.UNDEFINED, default_reaction_emoji=undefined.UNDEFINED, reason=undefined.UNDEFINED)[source]#

Create a forum channel in the guild.

Parameters:
namestr

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

Other Parameters:
positionhikari.undefined.UndefinedOr[int]

If provided, the position of the category.

categoryhikari.undefined.UndefinedOr[hikari.snowflakes.SnowflakeishOr[hikari.channels.GuildCategory]]

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

permission_overwriteshikari.undefined.UndefinedOr[typing.Sequence[hikari.channels.PermissionOverwrite]]

If provided, the permission overwrites for the category.

topichikari.undefined.UndefinedOr[str]

If provided, the channels topic. Maximum 1024 characters.

nsfwhikari.undefined.UndefinedOr[bool]

If provided, whether to mark the channel as NSFW.

rate_limit_per_userhikari.undefined.UndefinedOr[hikari.internal.time.Intervalish]

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

default_auto_archive_durationhikari.undefined.UndefinedOr[hikari.internal.time.Intervalish]

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.

default_thread_rate_limit_per_userhikari.undefined.UndefinedOr[hikari.internal.time.Intervalish]

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

default_forum_layouthikari.undefined.UndefinedOr[typing.Union[hikari.channels.ForumLayoutType, int]]

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

default_sort_orderhikari.undefined.UndefinedOr[typing.Union[hikari.channels.ForumSortOrderType, int]]

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

available_tagshikari.undefined.UndefinedOr[typing.Sequence[hikari.channels.ForumTag]]

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

default_reaction_emojityping.Union[str, hikari.emojis.Emoji, hikari.undefined.UndefinedType, hikari.snowflakes.Snowflake]

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

reasonhikari.undefined.UndefinedOr[str]

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

Returns:
hikari.channels.GuildForumChannel

The created forum channel.

Raises:
hikari.errors.BadRequestError

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

hikari.errors.ForbiddenError

If you are missing the MANAGE_CHANNEL permission.

hikari.errors.UnauthorizedError

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

hikari.errors.NotFoundError

If the guild is not found.

hikari.errors.RateLimitTooLongError

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

hikari.errors.InternalServerError

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

async create_news_channel(name, *, position=undefined.UNDEFINED, topic=undefined.UNDEFINED, nsfw=undefined.UNDEFINED, rate_limit_per_user=undefined.UNDEFINED, permission_overwrites=undefined.UNDEFINED, category=undefined.UNDEFINED, reason=undefined.UNDEFINED)[source]#

Create a news channel in the guild.

Parameters:
namestr

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

Other Parameters:
positionhikari.undefined.UndefinedOr[int]

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

topichikari.undefined.UndefinedOr[str]

If provided, the channels topic. Maximum 1024 characters.

nsfwhikari.undefined.UndefinedOr[bool]

If provided, whether to mark the channel as NSFW.

rate_limit_per_userhikari.undefined.UndefinedOr[hikari.internal.time.Intervalish]

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

permission_overwriteshikari.undefined.UndefinedOr[typing.Sequence[hikari.channels.PermissionOverwrite]]

If provided, the permission overwrites for the channel.

categoryhikari.undefined.UndefinedOr[hikari.snowflakes.SnowflakeishOr[hikari.channels.GuildCategory]]

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

reasonhikari.undefined.UndefinedOr[str]

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

Returns:
hikari.channels.GuildNewsChannel

The created channel.

Raises:
hikari.errors.BadRequestError

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

hikari.errors.ForbiddenError

If you are missing the MANAGE_CHANNEL permission.

hikari.errors.UnauthorizedError

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

hikari.errors.NotFoundError

If the guild is not found.

hikari.errors.RateLimitTooLongError

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

hikari.errors.InternalServerError

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

async create_stage_channel(name, *, position=undefined.UNDEFINED, user_limit=undefined.UNDEFINED, bitrate=undefined.UNDEFINED, permission_overwrites=undefined.UNDEFINED, region=undefined.UNDEFINED, category=undefined.UNDEFINED, reason=undefined.UNDEFINED)[source]#

Create a stage channel in the guild.

Parameters:
namestr

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

Other Parameters:
positionhikari.undefined.UndefinedOr[int]

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

user_limithikari.undefined.UndefinedOr[int]

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

bitratehikari.undefined.UndefinedOr[int]

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

permission_overwriteshikari.undefined.UndefinedOr[typing.Sequence[hikari.channels.PermissionOverwrite]]

If provided, the permission overwrites for the channel.

regionhikari.undefined.UndefinedOr[typing.Union[hikari.voices.VoiceRegion, str]]

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

categoryhikari.undefined.UndefinedOr[hikari.snowflakes.SnowflakeishOr[hikari.channels.GuildCategory]]

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

reasonhikari.undefined.UndefinedOr[str]

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

Returns:
hikari.channels.GuildStageChannel

The created channel.

Raises:
hikari.errors.BadRequestError

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

hikari.errors.ForbiddenError

If you are missing the MANAGE_CHANNEL permission.

hikari.errors.UnauthorizedError

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

hikari.errors.NotFoundError

If the guild is not found.

hikari.errors.RateLimitTooLongError

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

hikari.errors.InternalServerError

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

async create_sticker(name, tag, image, *, description=undefined.UNDEFINED, reason=undefined.UNDEFINED)[source]#

Create a sticker in a guild.

Note

Lottie support is only available for verified and partnered servers.

Parameters:
namestr

The name for the sticker.

tagstr

The tag for the sticker.

imagehikari.files.Resourceish

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.

Other Parameters:
descriptionhikari.undefined.UndefinedOr[str]

If provided, the description of the sticker.

reasonhikari.undefined.UndefinedOr[str]

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

Returns:
hikari.stickers.GuildSticker

The created sticker.

Raises:
hikari.errors.BadRequestError

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

hikari.errors.ForbiddenError

If you are missing MANAGE_EMOJIS_AND_STICKERS in the server.

hikari.errors.NotFoundError

If the guild is not found.

hikari.errors.UnauthorizedError

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

hikari.errors.RateLimitTooLongError

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

hikari.errors.InternalServerError

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

async create_text_channel(name, *, position=undefined.UNDEFINED, topic=undefined.UNDEFINED, nsfw=undefined.UNDEFINED, rate_limit_per_user=undefined.UNDEFINED, permission_overwrites=undefined.UNDEFINED, category=undefined.UNDEFINED, reason=undefined.UNDEFINED)[source]#

Create a text channel in the guild.

Parameters:
namestr

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

Other Parameters:
positionhikari.undefined.UndefinedOr[int]

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

topichikari.undefined.UndefinedOr[str]

If provided, the channels topic. Maximum 1024 characters.

nsfwhikari.undefined.UndefinedOr[bool]

If provided, whether to mark the channel as NSFW.

rate_limit_per_userhikari.undefined.UndefinedOr[hikari.internal.time.Intervalish]

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

permission_overwriteshikari.undefined.UndefinedOr[typing.Sequence[hikari.channels.PermissionOverwrite]]

If provided, the permission overwrites for the channel.

categoryhikari.undefined.UndefinedOr[hikari.snowflakes.SnowflakeishOr[hikari.channels.GuildCategory]]

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

reasonhikari.undefined.UndefinedOr[str]

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

Returns:
hikari.channels.GuildTextChannel

The created channel.

Raises:
hikari.errors.BadRequestError

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

hikari.errors.ForbiddenError

If you are missing the MANAGE_CHANNEL permission.

hikari.errors.UnauthorizedError

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

hikari.errors.NotFoundError

If the guild is not found.

hikari.errors.RateLimitTooLongError

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

hikari.errors.InternalServerError

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

async create_voice_channel(name, *, position=undefined.UNDEFINED, user_limit=undefined.UNDEFINED, bitrate=undefined.UNDEFINED, video_quality_mode=undefined.UNDEFINED, permission_overwrites=undefined.UNDEFINED, region=undefined.UNDEFINED, category=undefined.UNDEFINED, reason=undefined.UNDEFINED)[source]#

Create a voice channel in a guild.

Parameters:
namestr

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

Other Parameters:
positionhikari.undefined.UndefinedOr[int]

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

user_limithikari.undefined.UndefinedOr[int]

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

bitratehikari.undefined.UndefinedOr[int]

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

video_quality_modehikari.undefined.UndefinedOr[typing.Union[hikari.channels.VideoQualityMode, int]]

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

permission_overwriteshikari.undefined.UndefinedOr[typing.Sequence[hikari.channels.PermissionOverwrite]]

If provided, the permission overwrites for the channel.

regionhikari.undefined.UndefinedOr[typing.Union[hikari.voices.VoiceRegion, str]]

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

categoryhikari.undefined.UndefinedOr[hikari.snowflakes.SnowflakeishOr[hikari.channels.GuildCategory]]

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

reasonhikari.undefined.UndefinedOr[str]

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

Returns:
hikari.channels.GuildVoiceChannel

The created channel.

Raises:
hikari.errors.BadRequestError

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

hikari.errors.ForbiddenError

If you are missing the MANAGE_CHANNEL permission.

hikari.errors.UnauthorizedError

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

hikari.errors.NotFoundError

If the gui ld is not found.

hikari.errors.RateLimitTooLongError

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

hikari.errors.InternalServerError

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

async delete_channel(channel)[source]#

Delete a channel in the guild.

Note

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

Note

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

Parameters:
channelhikari.snowflakes.SnowflakeishOr[hikari.channels.GuildChannel]

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

Returns:
hikari.channels.GuildChannel

Object of the channel or category that was deleted.

Raises:
hikari.errors.UnauthorizedError, or close a DM.

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

hikari.errors.ForbiddenError

If you are missing the MANAGE_CHANNEL permission in the channel.

hikari.errors.NotFoundError

If the channel is not found.

hikari.errors.RateLimitTooLongError

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

hikari.errors.InternalServerError

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

async delete_sticker(sticker, *, reason=undefined.UNDEFINED)[source]#

Delete a sticker in a guild.

Parameters:
stickerhikari.snowflakes.SnowflakeishOr[hikari.stickers.PartialSticker]

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

Other Parameters:
reasonhikari.undefined.UndefinedOr[str]

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

Raises:
hikari.errors.ForbiddenError

If you are missing MANAGE_EMOJIS_AND_STICKERS in the server.

hikari.errors.NotFoundError

If the guild or the sticker are not found.

hikari.errors.UnauthorizedError

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

hikari.errors.RateLimitTooLongError

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

hikari.errors.InternalServerError

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

async edit(*, name=undefined.UNDEFINED, verification_level=undefined.UNDEFINED, default_message_notifications=undefined.UNDEFINED, explicit_content_filter_level=undefined.UNDEFINED, afk_channel=undefined.UNDEFINED, afk_timeout=undefined.UNDEFINED, icon=undefined.UNDEFINED, owner=undefined.UNDEFINED, splash=undefined.UNDEFINED, banner=undefined.UNDEFINED, system_channel=undefined.UNDEFINED, rules_channel=undefined.UNDEFINED, public_updates_channel=undefined.UNDEFINED, preferred_locale=undefined.UNDEFINED, reason=undefined.UNDEFINED)[source]#

Edit the guild.

Parameters:
namehikari.undefined.UndefinedOr[str]

If provided, the new name for the guild.

verification_levelhikari.undefined.UndefinedOr[hikari.guilds.GuildVerificationLevel]

If provided, the new verification level.

default_message_notificationshikari.undefined.UndefinedOr[hikari.guilds.GuildMessageNotificationsLevel]

If provided, the new default message notifications level.

explicit_content_filter_levelhikari.undefined.UndefinedOr[hikari.guilds.GuildExplicitContentFilterLevel]

If provided, the new explicit content filter level.

afk_channelhikari.undefined.UndefinedOr[hikari.snowflakes.SnowflakeishOr[hikari.channels.GuildVoiceChannel]]

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

afk_timeouthikari.undefined.UndefinedOr[hikari.internal.time.Intervalish]

If provided, the new afk timeout.

iconhikari.undefined.UndefinedOr[hikari.files.Resourceish]

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

ownerhikari.undefined.UndefinedOr[hikari.snowflakes.SnowflakeishOr[hikari.users.PartialUser]]]

If provided, the new guild owner.

Warning

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

splashhikari.undefined.UndefinedNoneOr[hikari.files.Resourceish]

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

bannerhikari.undefined.UndefinedNoneOr[hikari.files.Resourceish]

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

system_channelhikari.undefined.UndefinedNoneOr[hikari.snowflakes.SnowflakeishOr[hikari.channels.GuildTextChannel]]

If provided, the new system channel.

rules_channelhikari.undefined.UndefinedNoneOr[hikari.snowflakes.SnowflakeishOr[hikari.channels.GuildTextChannel]]

If provided, the new rules channel.

public_updates_channelhikari.undefined.UndefinedNoneOr[hikari.snowflakes.SnowflakeishOr[hikari.channels.GuildTextChannel]]

If provided, the new public updates channel.

preferred_localehikari.undefined.UndefinedNoneOr[str]

If provided, the new preferred locale.

reasonhikari.undefined.UndefinedOr[str]

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

Returns:
hikari.guilds.RESTGuild

The edited guild.

Raises:
hikari.errors.BadRequestError

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

hikari.errors.ForbiddenError

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

hikari.errors.UnauthorizedError

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

hikari.errors.NotFoundError

If the guild is not found.

hikari.errors.RateLimitTooLongError

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

hikari.errors.InternalServerError

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

async edit_sticker(sticker, *, name=undefined.UNDEFINED, description=undefined.UNDEFINED, tag=undefined.UNDEFINED, reason=undefined.UNDEFINED)[source]#

Edit a sticker in a guild.

Parameters:
stickerhikari.snowflakes.SnowflakeishOr[hikari.stickers.PartialSticker]

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

Other Parameters:
namehikari.undefined.UndefinedOr[str]

If provided, the new name for the sticker.

descriptionhikari.undefined.UndefinedOr[str]

If provided, the new description for the sticker.

taghikari.undefined.UndefinedOr[str]

If provided, the new sticker tag.

reasonhikari.undefined.UndefinedOr[str]

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

Returns:
hikari.stickers.GuildSticker

The edited sticker.

Raises:
hikari.errors.BadRequestError

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

hikari.errors.ForbiddenError

If you are missing MANAGE_EMOJIS_AND_STICKERS in the server.

hikari.errors.NotFoundError

If the guild or the sticker are not found.

hikari.errors.UnauthorizedError

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

hikari.errors.RateLimitTooLongError

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

hikari.errors.InternalServerError

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

async fetch_emoji(emoji)[source]#

Fetch an emoji from the guild.

Parameters:
emojihikari.snowflakes.SnowflakeishOr[hikari.emojis.CustomEmoji]

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

Returns:
hikari.emojis.KnownCustomEmoji

The requested emoji.

Raises:
hikari.errors.NotFoundError

If the guild or the emoji are not found.

hikari.errors.UnauthorizedError

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

hikari.errors.RateLimitTooLongError

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

hikari.errors.InternalServerError

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

async fetch_emojis()[source]#

Fetch the emojis of the guild.

Returns:
typing.Sequence[hikari.emojis.KnownCustomEmoji]

The requested emojis.

Raises:
hikari.errors.NotFoundError

If the guild is not found.

hikari.errors.UnauthorizedError

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

hikari.errors.RateLimitTooLongError

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

hikari.errors.InternalServerError

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

async fetch_roles()[source]#

Fetch the roles of the guild.

Returns:
typing.Sequence[hikari.guilds.Role]

The requested roles.

Raises:
hikari.errors.UnauthorizedError

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

hikari.errors.NotFoundError

If the guild is not found.

hikari.errors.RateLimitTooLongError

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

hikari.errors.InternalServerError

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

async fetch_self()[source]#

Fetch the guild.

Returns:
hikari.guilds.RESTGuild

The requested guild.

Raises:
hikari.errors.ForbiddenError

If you are not part of the guild.

hikari.errors.NotFoundError

If the guild is not found.

hikari.errors.UnauthorizedError

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

hikari.errors.RateLimitTooLongError

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

hikari.errors.InternalServerError

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

async fetch_sticker(sticker)[source]#

Fetch a sticker from the guild.

Parameters:
stickersnowflakes.SnowflakeishOr[hikari.stickers.PartialSticker]

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

Returns:
hikari.stickers.GuildSticker

The requested sticker.

Raises:
hikari.errors.ForbiddenError

If you are not part of the server.

hikari.errors.NotFoundError

If the guild or the sticker are not found.

hikari.errors.UnauthorizedError

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

hikari.errors.RateLimitTooLongError

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

hikari.errors.InternalServerError

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

async fetch_stickers()[source]#

Fetch the stickers of the guild.

Returns:
typing.Sequence[hikari.stickers.GuildSticker]

The requested stickers.

Raises:
hikari.errors.ForbiddenError

If you are not part of the server.

hikari.errors.NotFoundError

If the guild is not found.

hikari.errors.UnauthorizedError

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

hikari.errors.RateLimitTooLongError

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

hikari.errors.InternalServerError

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

async kick(user, *, reason=undefined.UNDEFINED)[source]#

Kick the given user from this guild.

Parameters:
userhikari.snowflakes.Snowflakeish[hikari.users.PartialUser]

The user to kick from the guild.

Other Parameters:
reasonhikari.undefined.UndefinedOr[str]

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

Raises:
hikari.errors.BadRequestError

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

hikari.errors.ForbiddenError

If you are missing the KICK_MEMBERS permission.

hikari.errors.UnauthorizedError

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

hikari.errors.NotFoundError

If the guild or user are not found.

hikari.errors.RateLimitTooLongError

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

hikari.errors.InternalServerError

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

make_icon_url(*, ext=None, size=4096)[source]#

Generate the guild’s icon URL, if set.

Parameters:
exttyping.Optional[str]

The extension to use for this URL, defaults to png or gif. Supports png, jpeg, jpg, webp and gif (when animated).

If None, then the correct default extension is determined based on whether the icon is animated or not.

sizeint

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

Returns:
typing.Optional[hikari.files.URL]

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

Raises:
ValueError

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

async unban(user, *, reason=undefined.UNDEFINED)[source]#

Unban the given user from this guild.

Parameters:
userhikari.snowflakes.Snowflakeish[hikari.users.PartialUser]

The user to unban from the guild.

Other Parameters:
reasonhikari.undefined.UndefinedOr[str]

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

Raises:
hikari.errors.BadRequestError

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

hikari.errors.ForbiddenError

If you are missing the BAN_MEMBERS permission.

hikari.errors.UnauthorizedError

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

hikari.errors.NotFoundError

If the guild or user are not found.

hikari.errors.RateLimitTooLongError

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

hikari.errors.InternalServerError

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

class hikari.guilds.PartialIntegration[source]#

Bases: hikari.snowflakes.Unique

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

account: IntegrationAccount[source]#

The account connected to this integration.

id: hikari.snowflakes.Snowflake[source]#

The ID of this entity.

name: str[source]#

The name of this integration.

type: IntegrationType | str[source]#

The type of this integration.

class hikari.guilds.PartialRole[source]#

Bases: hikari.snowflakes.Unique

Represents a partial guild bound role object.

property mention: str[source]#

Return a raw mention string for the role.

app: hikari.traits.RESTAware[source]#

Client application that models may use for procedures.

id: hikari.snowflakes.Snowflake[source]#

The ID of this entity.

name: str[source]#

The role’s name.

class hikari.guilds.RESTGuild[source]#

Bases: Guild

Guild specialization that is sent via the REST API only.

approximate_active_member_count: int | None[source]#

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

This will be None when creating a guild.

approximate_member_count: int | None[source]#

The approximate number of members in the guild.

This will be None when creating a guild.

emojis: Mapping[hikari.snowflakes.Snowflake, hikari.emojis.KnownCustomEmoji][source]#

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

max_members: int[source]#

The maximum number of members allowed in this guild.

max_presences: int | None[source]#

The maximum number of presences for the guild.

If None, then there is no limit.

roles: Mapping[hikari.snowflakes.Snowflake, Role][source]#

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

stickers: Mapping[hikari.snowflakes.Snowflake, stickers.GuildSticker][source]#

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

class hikari.guilds.Role[source]#

Bases: PartialRole

Represents a guild bound role object.

property colour: hikari.colours.Colour[source]#

Alias for the color field.

property icon_url: hikari.files.URL | None[source]#

Role icon URL, if there is one.

property mention: str[source]#

Return a raw mention string for the role.

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

bot_id: hikari.snowflakes.Snowflake | None[source]#

The ID of the bot this role belongs to.

If None, this is not a bot role.

color: hikari.colors.Color[source]#

The colour of this role.

This will be applied to a member’s name in chat if it’s their top coloured role.

guild_id: hikari.snowflakes.Snowflake[source]#

The ID of the guild this role belongs to.

icon_hash: str | None[source]#

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

integration_id: hikari.snowflakes.Snowflake | None[source]#

The ID of the integration this role belongs to.

If None, this is not a integration role.

is_available_for_purchase: bool[source]#

Whether this role is available for purchase.

is_guild_linked_role: bool[source]#

Whether this role is a linked role in the guild.

is_hoisted: bool[source]#

Whether this role is hoisting the members it’s attached to in the member list.

Members will be hoisted under their highest role where this is set to True.

is_managed: bool[source]#

Whether this role is managed by an integration.

is_mentionable: bool[source]#

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

is_premium_subscriber_role: bool[source]#

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

permissions: hikari.permissions.Permissions[source]#

The guild wide permissions this role gives to the members it’s attached to.

This may be overridden by channel overwrites.

position: int[source]#

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: hikari.snowflakes.Snowflake | None[source]#

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

If None, this is not a purchasable role.

unicode_emoji: hikari.emojis.UnicodeEmoji | None[source]#

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

make_icon_url(*, ext='png', size=4096)[source]#

Generate the icon URL for this role, if set.

If no role icon is set, this returns None.

Parameters:
extstr

The extension to use for this URL, defaults to png. Supports png, jpeg, jpg and webp.

sizeint

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

Returns:
typing.Optional[hikari.files.URL]

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

Raises:
ValueError

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

class hikari.guilds.WelcomeChannel[source]#

Used to represent channels on guild welcome screens.

channel_id: hikari.snowflakes.Snowflake[source]#

ID of the channel shown in the welcome screen.

description: str[source]#

The description shown for this channel.

emoji_id: hikari.snowflakes.Snowflake | None[source]#

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

emoji_name: str | hikari.emojis.UnicodeEmoji | None[source]#

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.

class hikari.guilds.WelcomeScreen[source]#

Used to represent guild welcome screens on Discord.

channels: Sequence[WelcomeChannel][source]#

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

description: str | None[source]#

The guild’s description shown in the welcome screen.