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 #
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 #
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 #
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 #
The code for this invite.
expires_at class-attribute instance-attribute #
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 #
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 #
The object of the user who created this invite.
role_ids class-attribute instance-attribute #
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 #
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 #
InviteFlags #
InviteGuild #
Bases: PartialGuild
Represents the partial data of a guild that is attached to invites.
banner_hash class-attribute instance-attribute #
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 #
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 #
The hash of the splash for the guild, if there is one.
vanity_url_code class-attribute instance-attribute #
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 If not specified, the format will be determined based on whether the banner is animated or not. TYPE: |
size | The size to set for the URL; Can be any power of two between TYPE: |
lossless | Whether to return a lossless or compressed WEBP image; This is ignored if TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
Optional[URL] | The URL, or |
| RAISES | DESCRIPTION |
|---|---|
TypeError | If an invalid format is passed for |
ValueError | If |
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 If not specified, the format will be TYPE: |
size | The size to set for the URL; Can be any power of two between TYPE: |
lossless | Whether to return a lossless or compressed WEBP image; This is ignored if TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
Optional[URL] | The URL, or |
| RAISES | DESCRIPTION |
|---|---|
TypeError | If an invalid format is passed for |
ValueError | If |
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 #
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.
position class-attribute instance-attribute #
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 If not specified, the format will be TYPE: |
size | The size to set for the URL; Can be any power of two between TYPE: |
lossless | Whether to return a lossless or compressed WEBP image; This is ignored if TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
Optional[URL] | The URL, or |
| RAISES | DESCRIPTION |
|---|---|
TypeError | If an invalid format is passed for |
ValueError | If |
InviteType #
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 #
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 #
Whether this invite grants temporary membership.
max_age class-attribute instance-attribute #
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 #
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 #
The amount of times this invite has been used.
TargetType #
VanityURL #
Bases: InviteCode
A special case invite object, that represents a guild's vanity url.