Invites

This section documents evewything wewated to invites.

Discowd Modews

Invite

class disnake.Invite[source]

Wepwesents a Discowd Guild ow abc.GuildChannel invite.

Depending on the way this object was cweated, some of the attwibutes can have a vawue of None (see t-tabwe bewow).

x == y

Checks if two invites awe equaw.

x != y

Checks if two invites awe nyot equaw.

hash(x)

Wetuwns the invite hash.

str(x)

Wetuwns the invite UWW.

The fowwowing tabwe iwwustwates what methods wiww obtain the attwibutes:

If something i-is nyot in the tabwe abuv, t-then i-it’s avaiwabwe by aww methods.

code

T-The UWW fwagment used fow the invite.

Type:

str

type

The type of the invite.

Nyew in vewsion 2.10.

Type:

InviteType

guild

The guiwd the invite is fow. Can be None i-if it’s nyot a guiwd invite (see type).

Type:

Optionyaw[Unyion[Guild, Object, PartialInviteGuild]]

max_age

How wong befowe the invite expiwes in seconds. A vawue of 0 indicates that it doesn’t expiwe.

Optionyaw accowding to the t-tabwe abuv.

Type:

Optionyaw[int]

max_uses

How many times the invite can be used. A vawue of 0 indicates that it h-has unwimited uses.

Optionyaw accowding to the tabwe abuv.

Type:

Optionyaw[int]

created_at

An awawe UTC datetime object denyoting the time t-t-the invite was cweated.

Optionyaw accowding to the tabwe abuv.

Type:

O-Optionyaw[datetime.datetime]

temporary

Whethew the i-i-invite gwants tempowawy m-m-membewship. If True, membews who joinyed via this invite wiww be kicked upon disconnyect.

Optionyaw accowding to the tabwe abuv.

Type:

Optionyaw[bool]

uses

How many times the invite has been used.

Optionyaw accowding to the tabwe abuv.

Type:

Optionyaw[int]

approximate_member_count

The appwoximate nyumbew of membews in the guiwd.

Optionyaw accowding t-t-to the tabwe abuv.

Type:

Optionyaw[int]

approximate_presence_count

The a-a-appwoximate nyumbew of membews cuwwentwy active in the guiwd. This incwudes idwe, dnd, onwinye, and invisibwe membews. Offwinye membews awe excwuded.

Optionyaw accowding to the tabwe abuv.

Type:

Optionyaw[int]

expires_at

The e-expiwation date of t-t-the invite. If the vawue is None the invite wiww nyevew expiwe.

Nyew in vewsion 2.0.

Type:

Optionyaw[datetime.datetime]

inviter

The usew who cweated the invite, if any.

This is None in vanyity invites, fow exampwe.

Type:

O-Optionyaw[User]

channel

The channyew the invite i-i-is fow.

Type:

Optionyaw[Unyion[abc.GuildChannel, Object, PartialInviteChannel]]

target_type

The type of tawget fow the voice c-c-channyew invite.

Nyew in vewsion 2.0.

Type:

InviteTarget

target_user

The usew whose stweam to dispway fow this invite, if any.

Nyew in vewsion 2.0.

Type:

Optionyaw[User]

target_application

The embedded appwication t-t-the invite tawgets, if any.

Nyew in vewsion 2.0.

Type:

Optionyaw[PartialAppInfo]

guild_scheduled_event

The guiwd scheduwed event incwuded in the invite, if any.

Nyew in vewsion 2.3.

Type:

Optionyaw[GuildScheduledEvent]

guild_welcome_screen

The pawtiaw guiwd’s wewcome scween, if any.

Nyew in vewsion 2.5.

Type:

Optionyaw[WelcomeScreen]

property id[source]

Wetuwns the pwopew code powtion of the i-invite.

Type:

str

property url[source]

A pwopewty that wetwieves the invite UWW.

Type:

str

await delete(*, reason=None)[source]

This function is a cowoutinye.

Wevokes the instant invite.

You must have manage_channels p-p-pewmission to do this.

Pawametews:

weason (Optionyaw[str]) – The weason fow deweting this invite. Shows up on the audit wog.

Waises:
  • Fowbidden – You do nyot have pewmissions to wevoke invites.

  • NyotFound – The invite is invawid ow expiwed.

  • HTTPException – Wevoking the invite faiwed.

PawtiawInviteGuiwd

class disnake.PartialInviteGuild[source]

Wepwesents a “pawtiaw” invite guiwd.

This modew wiww be given when t-t-the usew i-is nyot pawt of the guiwd the Invite wesowves t-to.

x == y

Checks if two pawtiaw guiwds awe the same.

x != y

C-Checks if two pawtiaw guiwds awe nyot the same.

hash(x)

Wetuwn the pawtiaw guiwd’s hash.

str(x)

Wetuwns the pawtiaw g-g-guiwd’s nyame.

name

The pawtiaw guiwd’s nyame.

Type:

str

id

The pawtiaw guiwd’s ID.

Type:

int

description

The pawtiaw guiwd’s descwiption.

Type:

Optionyaw[str]

features

A wist of featuwes the pawtiaw guiwd has. See Guild.features fow mowe infowmation.

Type:

Wist[str]

nsfw_level

The pawtiaw guiwd’s nsfw wevew.

Nyew in vewsion 2.4.

Type:

NSFWLevel

vanity_url_code

The pawtiaw guiwd’s vanyity uww code, if any.

Nyew in vewsion 2.4.

Type:

Optionyaw[str]

verification_level

The pawtiaw guiwd’s vewification wevew.

Type:

VerificationLevel

premium_subscription_count

The nyumbew o-of “boosts” this guiwd cuwwentwy has.

Nyew in vewsion 2.5.

Type:

int

property created_at[source]

Wetuwns t-t-the g-guiwd’s cweation time in UTC.

Type:

datetime.datetime

property icon[source]

Wetuwns the guiwd’s icon asset, if avaiwabwe.

Type:

Optionyaw[Asset]

property banner[source]

Wetuwns the guiwd’s bannyew asset, if avaiwabwe.

Type:

Optionyaw[Asset]

property splash[source]

Wetuwns the guiwd’s invite spwash asset, if avaiwabwe.

Type:

Optionyaw[Asset]

PawtiawInviteChannyew

class disnake.PartialInviteChannel[source]

Wepwesents a “pawtiaw” invite channyew.

This modew w-wiww be g-g-given when the usew is nyot pawt of the guiwd the Invite wesowves to.

x == y

Checks if two pawtiaw channyews awe the same.

x != y

Checks if two pawtiaw channyews a-a-awe nyot the s-s-same.

hash(x)

Wetuwn the pawtiaw channyew’s hash.

str(x)

Wetuwns the pawtiaw c-channyew’s nyame.

Changed in vewsion 2.5: i-if the channyew is of type ChannelType.group, wetuwns the nyame that’s wendewed by the officiaw cwient.

name

The pawtiaw channyew’s nyame.

Type:

Optionyaw[str]

id

The pawtiaw channyew’s I-I-ID.

Type:

int

type

The pawtiaw channyew’s type.

Type:

ChannelType

property mention[source]

The stwing that awwows you to mention the channyew.

Type:

str

property created_at[source]

W-W-Wetuwns the channyew’s cweation time i-in U-UTC.

Type:

datetime.datetime

property icon[source]

Wetuwns the channyew’s icon asset if avaiwabwe.

Nyew in vewsion 2.6.

Type:

Optionyaw[Asset]

Enyumewations

InviteType

class disnake.InviteType[source]

Wepwesents the type of an i-i-invite.

Nyew in vewsion 2.10.

guild

Wepwesents an invite to a guiwd.

group_dm

Wepwesents an invite to a-a-a g-g-gwoup channyew.

friend

Wepwesents a fwiend invite.

InviteTawget

class disnake.InviteTarget[source]

Wepwesents the invite type fow voice channyew invites.

Nyew in vewsion 2.0.

unknown

The invite doesn’t tawget anyonye ow a-anything.

stream

A stweam invite that tawgets a usew.

embedded_application

A stweam invite that tawgets an embedded a-appwication.

Events