hikari.invites#

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

Module Contents#

class hikari.invites.Invite[source]#

Bases: InviteCode

Represents an invite that’s used to add users to a guild or group dm.

app: hikari.traits.RESTAware[source]#

Client application that models may use for procedures.

approximate_active_member_count: int | None[source]#

The approximate amount of presences in this invite’s guild.

This is only returned by the GET REST Invites endpoint.

approximate_member_count: int | None[source]#

The approximate amount of members in this invite’s guild.

This is only returned by the GET Invites REST endpoint.

channel: hikari.channels.PartialChannel | None[source]#

The partial object of the channel this invite targets.

Will be None for invite objects that are attached to gateway events, in which case you should refer to Invite.channel_id.

channel_id: hikari.snowflakes.Snowflake[source]#

The ID of the channel this invite targets.

code: str[source]#

The code for this invite.

expires_at: datetime.datetime | None[source]#

When this invite will expire.

This field is only returned by the GET Invite REST endpoint and will be returned as None by said endpoint if the invite doesn’t have a set expiry date. Other places will always return this as None.

guild: InviteGuild | None[source]#

The partial object of the guild this invite belongs to.

Will be None for group DM invites and when attached to a gateway event; for invites received over the gateway you should refer to Invite.guild_id.

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

The ID of the guild this invite belongs to.

Will be None for group DM invites.

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

The object of the user who created this invite.

target_application: hikari.applications.InviteApplication | None[source]#

The embedded application this invite targets, if applicable.

target_type: TargetType | int | None[source]#

The type of the target of this invite, if applicable.

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

The object of the user who this invite targets, if set.

class hikari.invites.InviteCode[source]#

Bases: abc.ABC

A representation of a guild/channel invite.

abstract property code: str[source]#

Code for this invite.

class hikari.invites.InviteGuild[source]#

Bases: hikari.guilds.PartialGuild

Represents the partial data of a guild that is attached to invites.

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

Banner URL for the guild, if set.

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

Splash URL for the guild, if set.

banner_hash: str | None[source]#

The hash for the guild’s banner.

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

description: str | None[source]#

The guild’s description.

This is only present if certain features are set in this guild. Otherwise, this will always be None. For all other purposes, it is None.

features: Sequence[str | hikari.guilds.GuildFeature][source]#

A list of the features in this guild.

nsfw_level: hikari.guilds.GuildNSFWLevel[source]#

The NSFW level of the guild.

splash_hash: str | None[source]#

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

vanity_url_code: str | None[source]#

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

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

verification_level: hikari.guilds.GuildVerificationLevel | int[source]#

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

welcome_screen: hikari.guilds.WelcomeScreen | None[source]#

The welcome screen of a community guild shown to new members, if set.

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_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.invites.InviteWithMetadata[source]#

Bases: Invite

Extends the base Invite object with metadata.

The metadata is only returned when getting an invite with guild permissions, rather than it’s code.

property uses_left: int | None[source]#

Return the number of uses left for this invite.

This will be None if the invite has unlimited uses.

created_at: datetime.datetime[source]#

When this invite was created.

expires_at: datetime.datetime | None[source]#

When this invite will expire.

If this invite doesn’t have a set expiry then this will be None.

is_temporary: bool[source]#

Whether this invite grants temporary membership.

max_age: datetime.timedelta | None[source]#

The timedelta of how long this invite will be valid for.

If set to None then this is unlimited.

max_uses: int | None[source]#

The limit for how many times this invite can be used before it expires.

If set to None then this is unlimited.

uses: int[source]#

The amount of times this invite has been used.

class hikari.invites.TargetType[source]#

Bases: int, hikari.internal.enums.Enum

The target of the invite.

EMBEDDED_APPLICATION = 2[source]#

This invite is targeting an embedded application.

STREAM = 1[source]#

This invite is targeting a “Go Live” stream.

class hikari.invites.VanityURL[source]#

Bases: InviteCode

A special case invite object, that represents a guild’s vanity url.

app: hikari.traits.RESTAware[source]#

Client application that models may use for procedures.

code: str[source]#

The code for this invite.

uses: int[source]#

The amount of times this invite has been used.