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 = attrs.field(
    repr=False,
    eq=False,
    hash=False,
    metadata={attrs_extensions.SKIP_DEEP_COPY: True},
)

Client application that models may use for procedures.

approximate_active_member_count class-attribute instance-attribute #

approximate_active_member_count: int | None = attrs.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: int | None = attrs.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: PartialChannel | None = attrs.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 | None = attrs.field(
    eq=False, hash=False, repr=True
)

The ID of the channel this invite targets.

Will be None for friend invites, which target a user directly instead of a channel.

code class-attribute instance-attribute #

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

The code for this invite.

expires_at class-attribute instance-attribute #

expires_at: datetime | None = attrs.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.

flags class-attribute instance-attribute #

flags: InviteFlags = attrs.field(
    eq=False, hash=False, repr=False
)

The flags of this guild invite.

guild class-attribute instance-attribute #

guild: InviteGuild | None = attrs.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: Snowflake | None = attrs.field(
    eq=False, hash=False, repr=True
)

The ID of the guild this invite belongs to.

Will be None for group DM invites.

guild_scheduled_event class-attribute instance-attribute #

guild_scheduled_event: ScheduledEvent | None = attrs.field(
    eq=False, hash=False, repr=False
)

The scheduled event data attached to this invite, if any.

inviter class-attribute instance-attribute #

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

The object of the user who created this invite.

role_ids class-attribute instance-attribute #

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

The IDs of the roles assigned to the user upon accepting this invite.

roles class-attribute instance-attribute #

roles: Sequence[InviteRole] = attrs.field(
    eq=False, hash=False, repr=False
)

The partial objects of the roles assigned to the user upon accepting this invite.

Note

Invite payloads attached to gateway events only include the role IDs, in which case this will be empty and you should refer to hikari.invites.Invite.role_ids.

target_application class-attribute instance-attribute #

target_application: InviteApplication | None = attrs.field(
    eq=False, hash=False, repr=False
)

The embedded application this invite targets, if applicable.

target_type class-attribute instance-attribute #

target_type: TargetType | int | None = attrs.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: User | None = attrs.field(
    eq=False, hash=False, repr=False
)

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

type class-attribute instance-attribute #

type: InviteType | int = attrs.field(
    eq=False, hash=False, repr=True
)

The type of this invite.

Note

Invite payloads attached to gateway events don't include the type, in which case this will default to hikari.invites.InviteType.GUILD.

InviteCode #

Bases: ABC

A representation of a guild/channel invite.

code abstractmethod property #

code: str

Code for this invite.

InviteFlags #

Bases: Flag

The flags of a guild invite.

IS_GUEST_INVITE class-attribute instance-attribute #

IS_GUEST_INVITE = 1 << 0

This invite is a guest invite for a voice channel.

NONE class-attribute instance-attribute #

NONE = 0

No flags set.

InviteGuild #

Bases: PartialGuild

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

banner_hash class-attribute instance-attribute #

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

The hash for the guild's banner.

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

description class-attribute instance-attribute #

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

The guild's description.

features class-attribute instance-attribute #

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

A list of the features in this guild.

nsfw_level class-attribute instance-attribute #

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

The NSFW level of the guild.

splash_hash class-attribute instance-attribute #

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

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

vanity_url_code class-attribute instance-attribute #

vanity_url_code: str | None = attrs.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: GuildVerificationLevel | int = (
    attrs.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: WelcomeScreen | None = attrs.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(
    *,
    file_format: UndefinedOr[
        Literal[
            "PNG", "JPEG", "JPG", "WEBP", "AWEBP", "GIF"
        ]
    ] = UNDEFINED,
    size: int = 4096,
    lossless: bool = True,
) -> URL | None

Generate the banner URL for this guild, if set.

If no banner is set, this returns None.

PARAMETER DESCRIPTION
file_format

The format to use for this URL.

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

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

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

size

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

TYPE: int DEFAULT: 4096

lossless

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

TYPE: bool DEFAULT: True

RETURNS DESCRIPTION
Optional[URL]

The URL, or None if no banner is set.

RAISES DESCRIPTION
TypeError

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

ValueError

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

make_splash_url #

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

Generate the splash URL for this guild, if set.

If no splash is set, this returns None.

PARAMETER DESCRIPTION
file_format

The format to use for this URL.

Supports PNG, JPEG, JPG, and WEBP.

If not specified, the format will be PNG.

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

size

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

TYPE: int DEFAULT: 4096

lossless

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

TYPE: bool DEFAULT: True

RETURNS DESCRIPTION
Optional[URL]

The URL, or None if no splash is set.

RAISES DESCRIPTION
TypeError

If an invalid format is passed for file_format.

ValueError

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

InviteRole #

Bases: PartialRole

Represents the partial role objects attached to an invite.

These are the roles which will be assigned to the user upon accepting the invite.

color class-attribute instance-attribute #

color: Color = attrs.field(eq=False, hash=False, repr=True)

The colour of this role.

colors class-attribute instance-attribute #

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

The colors of this role.

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

colour property #

colour: Colour

Alias for the color field.

colours property #

colours: ColourGradient

Alias for the colors field.

icon_hash class-attribute instance-attribute #

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

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

position class-attribute instance-attribute #

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

The position of this role in the role hierarchy.

unicode_emoji class-attribute instance-attribute #

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

Unicode emoji that makes up the role's icon, if set.

make_icon_url #

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

Generate the icon URL for this role, if set.

If no icon is set, this returns None.

PARAMETER DESCRIPTION
file_format

The format to use for this URL.

Supports PNG, JPEG, JPG, and WEBP.

If not specified, the format will be PNG.

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

size

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

TYPE: int DEFAULT: 4096

lossless

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

TYPE: bool DEFAULT: True

RETURNS DESCRIPTION
Optional[URL]

The URL, or None if no icon is set.

RAISES DESCRIPTION
TypeError

If an invalid format is passed for file_format.

ValueError

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

InviteType #

Bases: int, Enum

The type of an invite.

FRIEND class-attribute instance-attribute #

FRIEND = 2

This invite is a friend invite, inviting directly to a user.

GROUP_DM class-attribute instance-attribute #

GROUP_DM = 1

This invite is inviting to a group DM.

GUILD class-attribute instance-attribute #

GUILD = 0

This invite is inviting to a guild.

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 = attrs.field(
    eq=False, hash=False, repr=False
)

When this invite was created.

expires_at instance-attribute #

expires_at: datetime | None

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 = attrs.field(
    eq=False, hash=False, repr=True
)

Whether this invite grants temporary membership.

max_age class-attribute instance-attribute #

max_age: timedelta | None = attrs.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: int | None = attrs.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 = attrs.field(eq=False, hash=False, repr=True)

The amount of times this invite has been used.

uses_left property #

uses_left: int | None

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 = attrs.field(
    repr=False,
    eq=False,
    hash=False,
    metadata={attrs_extensions.SKIP_DEEP_COPY: True},
)

Client application that models may use for procedures.

code class-attribute instance-attribute #

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

The code for this invite.

uses class-attribute instance-attribute #

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

The amount of times this invite has been used.