Invite

discord_http.invite module

class discord_http.invite.Invite(*, state, data)

Bases: PartialInvite

Represents an invite object.

Parameters:
uses: int

The number of times the invite has been used.

max_uses: int

The maximum number of times the invite can be used.

temporary: bool

Whether the invite grants temporary membership.

created_at: datetime | None

The time the invite was created.

expires_at: datetime | None

The time the invite expires, if applicable.

inviter: User | None

The user who created the invite, if applicable.

guild_id: int | None

The ID of the guild the invite is in, if applicable.

approximate_presence_count: int | None

The approximate number of online members, if applicable.

approximate_member_count: int | None

The approximate number of total members, if applicable.

BASE: str = 'https://discord.gg'
property channel: PartialChannel | None

The channel the invite is in.

code

The invite code.

async delete(*, reason=None) → Invite

Deletes the invite.

Parameters:

reason (str | None) – The reason for deleting the invite

Return type:

Invite

Returns:

The invite object

async edit_target_users(user_ids) → None

Update the list of users allowed to use this invite.

Parameters:

user_ids (list[Snowflake | int]) – The user IDs to allow to use this invite

Return type:

None

async fetch() → Invite

Fetches the invite details.

Return type:

Invite

Returns:

The invite object

async fetch_target_users() → list[PartialUser]

Fetch the list of users allowed to use this invite.

Return type:

list[PartialUser]

Returns:

The users from the target users file

async fetch_target_users_job_status() → InviteTargetUsersJobStatus

Fetch the status of the target users file processing job.

Return type:

InviteTargetUsersJobStatus

Returns:

The status of the target users file processing job

property url: str

The URL of the invite.

roles: list[Role]

The roles a user gets when joining via this invite.

target_type: InviteTargetType | None

The target type of the invite, if applicable.

target_user: User | None

The user of the invite whose stream to display for this invite.

channel_id: int | None

The ID of the channel the invite is in, if applicable.

property guild: Guild | PartialGuild | None

The guild associated with the invite, if applicable. Resolved live from cache.

property type: InviteType

The type of the invite.

property flags: GuildInviteFlags

The flags associated with the invite.

is_vanity() → bool

Whether the invite is a vanity invite.

Return type:

bool

class discord_http.invite.InviteTargetUsersJobStatus(status, total_users, processed_users, created_at, completed_at, error_message)

Bases: NamedTuple

Represents the status of an invite’s target users file processing job.

Parameters:
status: InviteTargetUsersJobStatusType

Alias for field number 0

total_users: int

Alias for field number 1

processed_users: int

Alias for field number 2

created_at: datetime

Alias for field number 3

completed_at: datetime | None

Alias for field number 4

error_message: str | None

Alias for field number 5

count(value, /)

Return number of occurrences of value.

index(value, start=0, stop=9223372036854775807, /)

Return first index of value.

Raises ValueError if the value is not present.

class discord_http.invite.PartialInvite(*, state, code, channel_id=None, guild_id=None)

Bases: object

Represents a partial invite object.

Parameters:
BASE: str = 'https://discord.gg'
code

The invite code.

channel_id: int | None

The ID of the channel the invite is in, if applicable.

guild_id: int | None

The ID of the guild the invite is in, if applicable.

property guild: Guild | PartialGuild | None

The guild associated with the invite, if applicable. Resolved live from cache.

property channel: PartialChannel | None

The channel the invite is in.

async fetch() → Invite

Fetches the invite details.

Return type:

Invite

Returns:

The invite object

async fetch_target_users() → list[PartialUser]

Fetch the list of users allowed to use this invite.

Return type:

list[PartialUser]

Returns:

The users from the target users file

async edit_target_users(user_ids) → None

Update the list of users allowed to use this invite.

Parameters:

user_ids (list[Snowflake | int]) – The user IDs to allow to use this invite

Return type:

None

async fetch_target_users_job_status() → InviteTargetUsersJobStatus

Fetch the status of the target users file processing job.

Return type:

InviteTargetUsersJobStatus

Returns:

The status of the target users file processing job

async delete(*, reason=None) → Invite

Deletes the invite.

Parameters:

reason (str | None) – The reason for deleting the invite

Return type:

Invite

Returns:

The invite object

property url: str

The URL of the invite.