Invites¶
This section documents everything related to invites.
Discord Models¶
Invite¶
- asyncdelete
- class disnake.Invite[source]¶
Represents a Discord
Guild
orabc.GuildChannel
invite.Depending on the way this object was created, some of the attributes can have a value of
None
(see table below).- x == y
Checks if two invites are equal.
- x != y
Checks if two invites are not equal.
- hash(x)
Returns the invite hash.
- str(x)
Returns the invite URL.
The following table illustrates what methods will obtain the attributes:
Attribute
Method
Client.fetch_invite()
withwith_counts
enabledClient.fetch_invite()
withwith_counts
enabledClient.fetch_invite()
withwith_expiration
enabledClient.fetch_invite()
with validguild_scheduled_event_id
or valid event ID in URL or invite objectIf something is not in the table above, then it’s available by all methods.
- type¶
The type of the invite.
New in version 2.10.
- Type:
- guild¶
The guild the invite is for. Can be
None
if it’s not a guild invite (seetype
).- Type:
Optional[Union[
Guild
,Object
,PartialInviteGuild
]]
- max_age¶
How long before the invite expires in seconds. A value of
0
indicates that it doesn’t expire.Optional according to the table above.
- Type:
Optional[
int
]
- max_uses¶
How many times the invite can be used. A value of
0
indicates that it has unlimited uses.Optional according to the table above.
- Type:
Optional[
int
]
- created_at¶
An aware UTC datetime object denoting the time the invite was created.
Optional according to the table above.
- Type:
Optional[
datetime.datetime
]
- temporary¶
Whether the invite grants temporary membership. If
True
, members who joined via this invite will be kicked upon disconnect.Optional according to the table above.
- Type:
Optional[
bool
]
- uses¶
How many times the invite has been used.
Optional according to the table above.
- Type:
Optional[
int
]
- approximate_member_count¶
The approximate number of members in the guild.
Optional according to the table above.
- Type:
Optional[
int
]
- approximate_presence_count¶
The approximate number of members currently active in the guild. This includes idle, dnd, online, and invisible members. Offline members are excluded.
Optional according to the table above.
- Type:
Optional[
int
]
- expires_at¶
The expiration date of the invite. If the value is
None
when received throughClient.fetch_invite()
withwith_expiration
enabled, the invite will never expire.New in version 2.0.
- Type:
Optional[
datetime.datetime
]
- inviter¶
The user who created the invite, if any.
This is
None
in vanity invites, for example.- Type:
Optional[
User
]
- channel¶
The channel the invite is for.
- Type:
Optional[Union[
abc.GuildChannel
,Object
,PartialInviteChannel
]]
- target_type¶
The type of target for the voice channel invite.
New in version 2.0.
- Type:
- target_user¶
The user whose stream to display for this invite, if any.
New in version 2.0.
- Type:
Optional[
User
]
- target_application¶
The embedded application the invite targets, if any.
New in version 2.0.
- Type:
Optional[
PartialAppInfo
]
- guild_scheduled_event¶
The guild scheduled event included in the invite, if any.
New in version 2.3.
- Type:
Optional[
GuildScheduledEvent
]
- guild_welcome_screen¶
The partial guild’s welcome screen, if any.
New in version 2.5.
- Type:
Optional[
WelcomeScreen
]
- await delete(*, reason=None)[source]¶
This function is a coroutine.
Revokes the instant invite.
You must have
manage_channels
permission to do this.- Parameters:
reason (Optional[
str
]) – The reason for deleting this invite. Shows up on the audit log.- Raises:
Forbidden – You do not have permissions to revoke invites.
NotFound – The invite is invalid or expired.
HTTPException – Revoking the invite failed.
PartialInviteGuild¶
- class disnake.PartialInviteGuild[source]¶
Represents a “partial” invite guild.
This model will be given when the user is not part of the guild the
Invite
resolves to.- x == y
Checks if two partial guilds are the same.
- x != y
Checks if two partial guilds are not the same.
- hash(x)
Return the partial guild’s hash.
- str(x)
Returns the partial guild’s name.
- features¶
A list of features the partial guild has. See
Guild.features
for more information.- Type:
List[
str
]
- vanity_url_code¶
The partial guild’s vanity url code, if any.
New in version 2.4.
- Type:
Optional[
str
]
- verification_level¶
The partial guild’s verification level.
- Type:
The number of “boosts” this guild currently has.
New in version 2.5.
- Type:
PartialInviteChannel¶
- class disnake.PartialInviteChannel[source]¶
Represents a “partial” invite channel.
This model will be given when the user is not part of the guild the
Invite
resolves to.- x == y
Checks if two partial channels are the same.
- x != y
Checks if two partial channels are not the same.
- hash(x)
Return the partial channel’s hash.
- str(x)
Returns the partial channel’s name.
Changed in version 2.5: if the channel is of type
ChannelType.group
, returns the name that’s rendered by the official client.
- type¶
The partial channel’s type.
- Type: