Skip to content

hikari.invites#

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

Invite #

Bases: InviteCode

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

app class-attribute instance-attribute #

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

Client application that models may use for procedures.

approximate_active_member_count class-attribute instance-attribute #

approximate_active_member_count: Optional[int] = field(eq=False, hash=False, repr=False)

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

This is only returned by the GET REST Invites endpoint.

approximate_member_count class-attribute instance-attribute #

approximate_member_count: Optional[int] = field(eq=False, hash=False, repr=False)

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

This is only returned by the GET Invites REST endpoint.

channel class-attribute instance-attribute #

channel: Optional[PartialChannel] = field(eq=False, hash=False, repr=False)

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 hikari.invites.Invite.channel_id.

channel_id class-attribute instance-attribute #

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

The ID of the channel this invite targets.

code class-attribute instance-attribute #

code: str = field(hash=True, repr=True)

The code for this invite.

expires_at class-attribute instance-attribute #

expires_at: Optional[datetime] = field(eq=False, hash=False, repr=False)

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 class-attribute instance-attribute #

guild: Optional[InviteGuild] = field(eq=False, hash=False, repr=False)

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 hikari.invites.Invite.guild_id.

guild_id class-attribute instance-attribute #

guild_id: Optional[Snowflake] = field(eq=False, hash=False, repr=True)

The ID of the guild this invite belongs to.

Will be None for group DM invites.

inviter class-attribute instance-attribute #

inviter: Optional[User] = field(eq=False, hash=False, repr=False)

The object of the user who created this invite.

target_application class-attribute instance-attribute #

target_application: Optional[InviteApplication] = field(eq=False, hash=False, repr=False)

The embedded application this invite targets, if applicable.

target_type class-attribute instance-attribute #

target_type: Union[TargetType, int, None] = field(eq=False, hash=False, repr=False)

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

target_user class-attribute instance-attribute #

target_user: Optional[User] = field(eq=False, hash=False, repr=False)

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

InviteCode #

Bases: ABC

A representation of a guild/channel invite.

code abstractmethod property #

code: str

Code for this invite.

InviteGuild #

Bases: PartialGuild

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

banner_hash class-attribute instance-attribute #

banner_hash: Optional[str] = field(eq=False, hash=False, repr=False)

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.

banner_url property #

banner_url: Optional[URL]

Banner URL for the guild, if set.

description class-attribute instance-attribute #

description: Optional[str] = field(eq=False, hash=False, repr=False)

The guild's description.

features class-attribute instance-attribute #

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

A list of the features in this guild.

nsfw_level class-attribute instance-attribute #

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

The NSFW level of the guild.

splash_hash class-attribute instance-attribute #

splash_hash: Optional[str] = field(eq=False, hash=False, repr=False)

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

splash_url property #

splash_url: Optional[URL]

Splash URL for the guild, if set.

vanity_url_code class-attribute instance-attribute #

vanity_url_code: Optional[str] = field(eq=False, hash=False, repr=True)

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 class-attribute instance-attribute #

verification_level: Union[GuildVerificationLevel, int] = field(eq=False, hash=False, repr=False)

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

welcome_screen class-attribute instance-attribute #

welcome_screen: Optional[WelcomeScreen] = field(eq=False, hash=False, repr=False)

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

make_banner_url #

make_banner_url(*, ext: Optional[str] = None, size: int = 4096) -> Optional[URL]

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

PARAMETER DESCRIPTION
ext

The ext to use for this URL. 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.

TYPE: Optional[str] DEFAULT: None

size

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

TYPE: int DEFAULT: 4096

RETURNS DESCRIPTION
Optional[URL]

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

RAISES DESCRIPTION
ValueError

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

make_splash_url #

make_splash_url(*, ext: str = 'png', size: int = 4096) -> Optional[URL]

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

PARAMETER DESCRIPTION
ext

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

TYPE: str DEFAULT: 'png'

size

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

TYPE: int DEFAULT: 4096

RETURNS DESCRIPTION
Optional[URL]

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

RAISES DESCRIPTION
ValueError

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

InviteWithMetadata #

Bases: Invite

Extends the base hikari.invites.Invite object with metadata.

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

created_at class-attribute instance-attribute #

created_at: datetime = field(eq=False, hash=False, repr=False)

When this invite was created.

expires_at instance-attribute #

expires_at: Optional[datetime]

When this invite will expire.

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

is_temporary class-attribute instance-attribute #

is_temporary: bool = field(eq=False, hash=False, repr=True)

Whether this invite grants temporary membership.

max_age class-attribute instance-attribute #

max_age: Optional[timedelta] = field(eq=False, hash=False, repr=False)

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

If set to None then this is unlimited.

max_uses class-attribute instance-attribute #

max_uses: Optional[int] = field(eq=False, hash=False, repr=True)

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

If set to None then this is unlimited.

uses class-attribute instance-attribute #

uses: int = field(eq=False, hash=False, repr=True)

The amount of times this invite has been used.

uses_left property #

uses_left: Optional[int]

Return the number of uses left for this invite.

This will be None if the invite has unlimited uses.

TargetType #

Bases: int, Enum

The target of the invite.

EMBEDDED_APPLICATION class-attribute instance-attribute #

EMBEDDED_APPLICATION = 2

This invite is targeting an embedded application.

STREAM class-attribute instance-attribute #

STREAM = 1

This invite is targeting a "Go Live" stream.

VanityURL #

Bases: InviteCode

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

app class-attribute instance-attribute #

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

Client application that models may use for procedures.

code class-attribute instance-attribute #

code: str = field(hash=True, repr=True)

The code for this invite.

uses class-attribute instance-attribute #

uses: int = field(eq=False, hash=False, repr=True)

The amount of times this invite has been used.