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 beNone
.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 beNone
.
- 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
inGuild.features
for this guild. For all other purposes, it isNone
.
- 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 inGuild.features
for this guild. Otherwise, this will always beNone
.
- 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 inGuild.features
for this guild and will otherwise default toen-US
.
The number of nitro boosts that the server currently has.
This information may not be present, in which case, it will be
None
.
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 inGuild.features
for this guild. For all other purposes, it should be considered to beNone
.
- 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 isNone
.
- 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 inGuild.features
for this guild. If not, this will always beNone
.
- 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 inGuild.features
for this guild. For all other purposes, it should be considered to beNone
.- 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 isNone
.- 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:
- channel
hikari.snowflakes.SnowflakeishOr
[hikari.channels.PartialChannel
] The object or ID of the guild channel to get from the cache.
- channel
- 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:
- emoji
hikari.snowflakes.SnowflakeishOr
[hikari.emojis.CustomEmoji
] The object or ID of the emoji to get from the cache.
- emoji
- 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:
- user
hikari.snowflakes.SnowflakeishOr
[hikari.users.PartialUser
] The object or ID of the user to get the cached member for.
- user
- 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:
- user
hikari.snowflakes.SnowflakeishOr
[hikari.users.PartialUser
] The object or ID of the user to get the cached presence for.
- user
- 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:
- role
hikari.snowflakes.SnowflakeishOr
[PartialRole
] The object or ID of the role to get for this guild from the cache.
- role
- 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:
- sticker
hikari.snowflakes.SnowflakeishOr
[hikari.stickers.GuildSticker
] The object or ID of the sticker to get from the cache.
- sticker
- 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:
- user
hikari.snowflakes.SnowflakeishOr
[hikari.users.PartialUser
] The object or ID of the user to get the cached voice state for.
- user
- 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:
- ext
typing.Optional
[str
] The ext to use for this URL, defaults to
png
orgif
. Supportspng
,jpeg
,jpg
,webp
andgif
(when animated).If
None
, then the correct default extension is determined based on whether the banner is animated or not.- size
int
The size to set for the URL, defaults to
4096
. Can be any power of two between 16 and 4096.
- ext
- 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:
- 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:
- 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.
- 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.
- class hikari.guilds.GuildFeature[source]#
Bases:
str
,hikari.internal.enums.Enum
Features that a guild can provide.
- COMMERCE = 'COMMERCE'[source]#
Guild has access to use commerce features (i.e. create store channels).
- DISCOVERABLE = 'DISCOVERABLE'[source]#
Guild is able to be discovered in the directory.
This also implies the guild can be viewed without joining.
- MEMBER_VERIFICATION_GATE_ENABLED = 'MEMBER_VERIFICATION_GATE_ENABLED'[source]#
Guild has enabled Membership Screening.
- 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.
- class hikari.guilds.GuildMFALevel[source]#
Bases:
int
,hikari.internal.enums.Enum
Represents the multi-factor authorization requirement for a guild.
- class hikari.guilds.GuildMessageNotificationsLevel[source]#
Bases:
int
,hikari.internal.enums.Enum
Represents the default notification level for new messages in a guild.
- class hikari.guilds.GuildNSFWLevel[source]#
Bases:
int
,hikari.internal.enums.Enum
Represents the NSFW level of a guild.
- class hikari.guilds.GuildPremiumTier[source]#
Bases:
int
,hikari.internal.enums.Enum
Tier for Discord Nitro boosting in a guild.
- 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.
- 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.
- make_discovery_splash_url(*, ext='png', size=4096)[source]#
Generate the guild’s discovery splash image URL, if set.
- Parameters:
- 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:
- 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.
- class hikari.guilds.GuildVerificationLevel[source]#
Bases:
int
,hikari.internal.enums.Enum
Represents the level of verification of a guild.
- 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.
- 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.
- 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.
- user: hikari.users.User | None[source]#
The user this integration belongs to.
- 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.
- class hikari.guilds.IntegrationType[source]#
Bases:
str
,hikari.internal.enums.Enum
The integration type.
- 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. Otherwise, it will return the username instead.
See also
Nickname
Username
Member.username
.
- 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 useavatar_hash
ordefault_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.
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:
- role
hikari.snowflakes.SnowflakeishOr
[hikari.guilds.PartialRole
] The role to add. This may be the object or the ID of an existing role.
- role
- Other Parameters:
- reason
hikari.undefined.UndefinedOr
[str
] If provided, the reason that will be recorded in the audit logs. Maximum of 512 characters.
- reason
- 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_seconds
hikari.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.- reason
hikari.undefined.UndefinedOr
[str
] If provided, the reason that will be recorded in the audit logs. Maximum of 512 characters.
- delete_message_seconds
- 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 beNone
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:
- nickname
hikari.undefined.UndefinedNoneOr
[str
] If provided, the new nick for the member. If
None
, will remove the members nick.Requires the
MANAGE_NICKNAMES
permission.- roles
hikari.undefined.UndefinedOr
[hikari.snowflakes.SnowflakeishSequence
[hikari.guilds.PartialRole
]] If provided, the new roles for the member.
Requires the
MANAGE_ROLES
permission.- mute
hikari.undefined.UndefinedOr
[bool] If provided, the new server mute state for the member.
Requires the
MUTE_MEMBERS
permission.- deaf
hikari.undefined.UndefinedOr
[bool] If provided, the new server deaf state for the member.
Requires the
DEAFEN_MEMBERS
permission.- voice_channel
hikari.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. IfNone
, will disconnect the member from voice.Requires the
MOVE_MEMBERS
permission and theCONNECT
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_until
hikari.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.- reason
hikari.undefined.UndefinedOr
[str
] If provided, the reason that will be recorded in the audit logs. Maximum of 512 characters.
- nickname
- 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:
- reason
hikari.undefined.UndefinedOr
[str
] If provided, the reason that will be recorded in the audit logs. Maximum of 512 characters.
- reason
- 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 themake_avatar_url
to get their global custom avatar ordefault_avatar_url
if they have no custom avatar set.- Parameters:
- ext
typing.Optional
[str
] The ext to use for this URL, defaults to
png
orgif
. Supportspng
,jpeg
,jpg
,webp
andgif
(when animated). Will be ignored for default avatars which can only bepng
.If
None
, then the correct default extension is determined based on whether the icon is animated or not.- size
int
The size to set for the URL, defaults to
4096
. Can be any power of two between 16 and 4096. Will be ignored for default avatars.
- ext
- 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:
- role
hikari.snowflakes.SnowflakeishOr
[hikari.guilds.PartialRole
] The role to remove. This may be the object or the ID of an existing role.
- role
- Other Parameters:
- reason
hikari.undefined.UndefinedOr
[str
] If provided, the reason that will be recorded in the audit logs. Maximum of 512 characters.
- reason
- 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:
- reason
hikari.undefined.UndefinedOr
[str
] If provided, the reason that will be recorded in the audit logs. Maximum of 512 characters.
- reason
- 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.
- id: hikari.snowflakes.Snowflake[source]#
The ID of this entity.
- make_icon_url(*, ext='png', size=4096)[source]#
Generate the icon URL for this application.
- Parameters:
- 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.
- id: hikari.snowflakes.Snowflake[source]#
The ID of this entity.
- async ban(user, *, delete_message_seconds=undefined.UNDEFINED, reason=undefined.UNDEFINED)[source]#
Ban the given user from this guild.
- Parameters:
- user
hikari.snowflakes.Snowflakeish
[hikari.users.PartialUser
] The user to ban from the guild.
- user
- Other Parameters:
- delete_message_seconds
hikari.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.- reason
hikari.undefined.UndefinedOr
[str
] If provided, the reason that will be recorded in the audit logs. Maximum of 512 characters.
- delete_message_seconds
- 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:
- name
str
The channels name. Must be between 2 and 1000 characters.
- name
- Other Parameters:
- position
hikari.undefined.UndefinedOr
[int
] If provided, the position of the category.
- permission_overwrites
hikari.undefined.UndefinedOr
[typing.Sequence
[hikari.channels.PermissionOverwrite
]] If provided, the permission overwrites for the category.
- reason
hikari.undefined.UndefinedOr
[str
] If provided, the reason that will be recorded in the audit logs. Maximum of 512 characters.
- position
- 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:
- name
str
The channels name. Must be between 2 and 1000 characters.
- name
- Other Parameters:
- position
hikari.undefined.UndefinedOr
[int
] If provided, the position of the category.
- category
hikari.undefined.UndefinedOr
[hikari.snowflakes.SnowflakeishOr
[hikari.channels.GuildCategory
]] The category to create the channel under. This may be the object or the ID of an existing category.
- permission_overwrites
hikari.undefined.UndefinedOr
[typing.Sequence
[hikari.channels.PermissionOverwrite
]] If provided, the permission overwrites for the category.
- topic
hikari.undefined.UndefinedOr
[str
] If provided, the channels topic. Maximum 1024 characters.
- nsfw
hikari.undefined.UndefinedOr
[bool] If provided, whether to mark the channel as NSFW.
- rate_limit_per_user
hikari.undefined.UndefinedOr
[hikari.internal.time.Intervalish
] If provided, the amount of seconds a user has to wait before being able to send another message in the channel. Maximum 21600 seconds.
- default_auto_archive_duration
hikari.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_user
hikari.undefined.UndefinedOr
[hikari.internal.time.Intervalish
] If provided, the ratelimit that should be set in threads created from the forum.
- default_forum_layout
hikari.undefined.UndefinedOr
[typing.Union
[hikari.channels.ForumLayoutType
,int
]] If provided, the default forum layout to show in the client.
- default_sort_order
hikari.undefined.UndefinedOr
[typing.Union
[hikari.channels.ForumSortOrderType
,int
]] If provided, the default sort order to show in the client.
- available_tags
hikari.undefined.UndefinedOr
[typing.Sequence
[hikari.channels.ForumTag
]] If provided, the available tags to select from when creating a thread.
- default_reaction_emoji
typing.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.
- reason
hikari.undefined.UndefinedOr
[str
] If provided, the reason that will be recorded in the audit logs. Maximum of 512 characters.
- position
- 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:
- name
str
The channels name. Must be between 2 and 1000 characters.
- name
- Other Parameters:
- position
hikari.undefined.UndefinedOr
[int
] If provided, the position of the channel (relative to the category, if any).
- topic
hikari.undefined.UndefinedOr
[str
] If provided, the channels topic. Maximum 1024 characters.
- nsfw
hikari.undefined.UndefinedOr
[bool] If provided, whether to mark the channel as NSFW.
- rate_limit_per_user
hikari.undefined.UndefinedOr
[hikari.internal.time.Intervalish
] If provided, the amount of seconds a user has to wait before being able to send another message in the channel. Maximum 21600 seconds.
- permission_overwrites
hikari.undefined.UndefinedOr
[typing.Sequence
[hikari.channels.PermissionOverwrite
]] If provided, the permission overwrites for the channel.
- category
hikari.undefined.UndefinedOr
[hikari.snowflakes.SnowflakeishOr
[hikari.channels.GuildCategory
]] The category to create the channel under. This may be the object or the ID of an existing category.
- reason
hikari.undefined.UndefinedOr
[str
] If provided, the reason that will be recorded in the audit logs. Maximum of 512 characters.
- position
- 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:
- name
str
The channel’s name. Must be between 2 and 1000 characters.
- name
- Other Parameters:
- position
hikari.undefined.UndefinedOr
[int
] If provided, the position of the channel (relative to the category, if any).
- user_limit
hikari.undefined.UndefinedOr
[int
] If provided, the maximum users in the channel at once. Must be between 0 and 99 with 0 meaning no limit.
- bitrate
hikari.undefined.UndefinedOr
[int
] If provided, the bitrate for the channel. Must be between 8000 and 96000 or 8000 and 128000 for VIP servers.
- permission_overwrites
hikari.undefined.UndefinedOr
[typing.Sequence
[hikari.channels.PermissionOverwrite
]] If provided, the permission overwrites for the channel.
- region
hikari.undefined.UndefinedOr
[typing.Union
[hikari.voices.VoiceRegion
,str
]] If provided, the voice region to for this channel. Passing
None
here will set it to “auto” mode where the used region will be decided based on the first person who connects to it when it’s empty.- category
hikari.undefined.UndefinedOr
[hikari.snowflakes.SnowflakeishOr
[hikari.channels.GuildCategory
]] The category to create the channel under. This may be the object or the ID of an existing category.
- reason
hikari.undefined.UndefinedOr
[str
] If provided, the reason that will be recorded in the audit logs. Maximum of 512 characters.
- position
- 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:
- name
str
The name for the sticker.
- tag
str
The tag for the sticker.
- image
hikari.files.Resourceish
The 320x320 image for the sticker. Maximum upload size is 500kb. This can be a still PNG, an animated PNG, a Lottie, or a GIF.
- name
- Other Parameters:
- description
hikari.undefined.UndefinedOr
[str
] If provided, the description of the sticker.
- reason
hikari.undefined.UndefinedOr
[str
] If provided, the reason that will be recorded in the audit logs. Maximum of 512 characters.
- description
- 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:
- name
str
The channels name. Must be between 2 and 1000 characters.
- name
- Other Parameters:
- position
hikari.undefined.UndefinedOr
[int
] If provided, the position of the channel (relative to the category, if any).
- topic
hikari.undefined.UndefinedOr
[str
] If provided, the channels topic. Maximum 1024 characters.
- nsfw
hikari.undefined.UndefinedOr
[bool] If provided, whether to mark the channel as NSFW.
- rate_limit_per_user
hikari.undefined.UndefinedOr
[hikari.internal.time.Intervalish
] If provided, the amount of seconds a user has to wait before being able to send another message in the channel. Maximum 21600 seconds.
- permission_overwrites
hikari.undefined.UndefinedOr
[typing.Sequence
[hikari.channels.PermissionOverwrite
]] If provided, the permission overwrites for the channel.
- category
hikari.undefined.UndefinedOr
[hikari.snowflakes.SnowflakeishOr
[hikari.channels.GuildCategory
]] The category to create the channel under. This may be the object or the ID of an existing category.
- reason
hikari.undefined.UndefinedOr
[str
] If provided, the reason that will be recorded in the audit logs. Maximum of 512 characters.
- position
- 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:
- name
str
The channels name. Must be between 2 and 1000 characters.
- name
- Other Parameters:
- position
hikari.undefined.UndefinedOr
[int
] If provided, the position of the channel (relative to the category, if any).
- user_limit
hikari.undefined.UndefinedOr
[int
] If provided, the maximum users in the channel at once. Must be between 0 and 99 with 0 meaning no limit.
- bitrate
hikari.undefined.UndefinedOr
[int
] If provided, the bitrate for the channel. Must be between 8000 and 96000 or 8000 and 128000 for VIP servers.
- video_quality_mode
hikari.undefined.UndefinedOr
[typing.Union
[hikari.channels.VideoQualityMode
,int
]] If provided, the new video quality mode for the channel.
- permission_overwrites
hikari.undefined.UndefinedOr
[typing.Sequence
[hikari.channels.PermissionOverwrite
]] If provided, the permission overwrites for the channel.
- region
hikari.undefined.UndefinedOr
[typing.Union
[hikari.voices.VoiceRegion
,str
]] If provided, the voice region to for this channel. Passing
None
here will set it to “auto” mode where the used region will be decided based on the first person who connects to it when it’s empty.- category
hikari.undefined.UndefinedOr
[hikari.snowflakes.SnowflakeishOr
[hikari.channels.GuildCategory
]] The category to create the channel under. This may be the object or the ID of an existing category.
- reason
hikari.undefined.UndefinedOr
[str
] If provided, the reason that will be recorded in the audit logs. Maximum of 512 characters.
- position
- 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:
- channel
hikari.snowflakes.SnowflakeishOr
[hikari.channels.GuildChannel
] The channel or category to delete. This may be the object or the ID of an existing channel.
- 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:
- sticker
hikari.snowflakes.SnowflakeishOr
[hikari.stickers.PartialSticker
] The sticker to delete. This can be a sticker object or the ID of an existing sticker.
- sticker
- Other Parameters:
- reason
hikari.undefined.UndefinedOr
[str
] If provided, the reason that will be recorded in the audit logs. Maximum of 512 characters.
- reason
- 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:
- name
hikari.undefined.UndefinedOr
[str
] If provided, the new name for the guild.
- verification_level
hikari.undefined.UndefinedOr
[hikari.guilds.GuildVerificationLevel
] If provided, the new verification level.
- default_message_notifications
hikari.undefined.UndefinedOr
[hikari.guilds.GuildMessageNotificationsLevel
] If provided, the new default message notifications level.
- explicit_content_filter_level
hikari.undefined.UndefinedOr
[hikari.guilds.GuildExplicitContentFilterLevel
] If provided, the new explicit content filter level.
- afk_channel
hikari.undefined.UndefinedOr
[hikari.snowflakes.SnowflakeishOr
[hikari.channels.GuildVoiceChannel
]] If provided, the new afk channel. Requires
afk_timeout
to be set to work.- afk_timeout
hikari.undefined.UndefinedOr
[hikari.internal.time.Intervalish
] If provided, the new afk timeout.
- icon
hikari.undefined.UndefinedOr
[hikari.files.Resourceish
] If provided, the new guild icon. Must be a 1024x1024 image or can be an animated gif when the guild has the
ANIMATED_ICON
feature.- owner
hikari.undefined.UndefinedOr
[hikari.snowflakes.SnowflakeishOr
[hikari.users.PartialUser
]]] If provided, the new guild owner.
Warning
You need to be the owner of the server to use this.
- splash
hikari.undefined.UndefinedNoneOr
[hikari.files.Resourceish
] If provided, the new guild splash. Must be a 16:9 image and the guild must have the
INVITE_SPLASH
feature.- banner
hikari.undefined.UndefinedNoneOr
[hikari.files.Resourceish
] If provided, the new guild banner. Must be a 16:9 image and the guild must have the
BANNER
feature.- system_channel
hikari.undefined.UndefinedNoneOr
[hikari.snowflakes.SnowflakeishOr
[hikari.channels.GuildTextChannel
]] If provided, the new system channel.
- rules_channel
hikari.undefined.UndefinedNoneOr
[hikari.snowflakes.SnowflakeishOr
[hikari.channels.GuildTextChannel
]] If provided, the new rules channel.
- public_updates_channel
hikari.undefined.UndefinedNoneOr
[hikari.snowflakes.SnowflakeishOr
[hikari.channels.GuildTextChannel
]] If provided, the new public updates channel.
- preferred_locale
hikari.undefined.UndefinedNoneOr
[str
] If provided, the new preferred locale.
- reason
hikari.undefined.UndefinedOr
[str
] If provided, the reason that will be recorded in the audit logs. Maximum of 512 characters.
- name
- 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:
- sticker
hikari.snowflakes.SnowflakeishOr
[hikari.stickers.PartialSticker
] The sticker to edit. This can be a sticker object or the ID of an existing sticker.
- sticker
- Other Parameters:
- name
hikari.undefined.UndefinedOr
[str
] If provided, the new name for the sticker.
- description
hikari.undefined.UndefinedOr
[str
] If provided, the new description for the sticker.
- tag
hikari.undefined.UndefinedOr
[str
] If provided, the new sticker tag.
- reason
hikari.undefined.UndefinedOr
[str
] If provided, the reason that will be recorded in the audit logs. Maximum of 512 characters.
- name
- 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:
- emoji
hikari.snowflakes.SnowflakeishOr
[hikari.emojis.CustomEmoji
] The emoji to fetch. This can be a
hikari.emojis.CustomEmoji
or the ID of an existing emoji.
- 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:
- sticker
snowflakes.SnowflakeishOr
[hikari.stickers.PartialSticker
] The sticker to fetch. This can be a sticker object or the ID of an existing sticker.
- 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:
- user
hikari.snowflakes.Snowflakeish
[hikari.users.PartialUser
] The user to kick from the guild.
- user
- Other Parameters:
- reason
hikari.undefined.UndefinedOr
[str
] If provided, the reason that will be recorded in the audit logs. Maximum of 512 characters.
- reason
- 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:
- ext
typing.Optional
[str
] The extension to use for this URL, defaults to
png
orgif
. Supportspng
,jpeg
,jpg
,webp
andgif
(when animated).If
None
, then the correct default extension is determined based on whether the icon is animated or not.- size
int
The size to set for the URL, defaults to
4096
. Can be any power of two between 16 and 4096.
- ext
- 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:
- user
hikari.snowflakes.Snowflakeish
[hikari.users.PartialUser
] The user to unban from the guild.
- user
- Other Parameters:
- reason
hikari.undefined.UndefinedOr
[str
] If provided, the reason that will be recorded in the audit logs. Maximum of 512 characters.
- reason
- 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.
- 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.
- app: hikari.traits.RESTAware[source]#
Client application that models may use for procedures.
- id: hikari.snowflakes.Snowflake[source]#
The ID of this entity.
- 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_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 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
isTrue
.
- 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.
- 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_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
.
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:
- 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.
- 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.