Invite
Represents a Discord Invite.
Attributes
int
The approximate amount of online users at the respective guild (or group channel). Defaults to 0
.
int
The approximate amount of users at the respective guild (or group channel). Defaults to 0
.
None
, Channel
The channel where the invite redirects. If it is announcements or store channel, then the invite is a lurk invite. If channel data was not sent with the invite's, then this attribute is set as None
.
str
The invite's unique identifier.
DateTime
When the invite was created. Defaults to Discord epoch.
The invite's flags.
None
, Guild
The guild the invite is for. If not included or if the invite's channel is a group channel, then set as None
.
The creator of the invite. If not included, then set as ZEROUSER
.
None
, int
The time in seconds after the invite will expire. Defaults to None
.
If the invite was created with max age as 0
, then this value will be negative instead of the expected 0
.
None
, int
How much times the invite can be used. Defaults to None
.
If the invite has no use limit, then this value is set as 0
.
None
, Application
The invite's target application.
The invite's target type.
None
, ClientUserBase
The target of the invite if applicable.
bool
Whether this invite only grants temporary membership.
When the user goes offline, they get kicked, except if they got a role meanwhile.
The invite's type.
None
, int
The amount how much times the invite was used. Defaults to None
.
Properties
channel_id
Returns the invite's channel's identifier.
guild_id
Returns the invite's guild's identifier.
Returns
guild_id : int
id
Compatibility property with other Discord entities.
Returns
id : int
= 0
inviter_id
Returns the invite's creator's identifier.
Returns
user_id : int
nsfw_level
Returns the invite's guild's nsfw level if applicable.
Deprecated and will be removed in 2024 February.
Returns
stage : NsfwLevel
partial
Returns whether the invite is partial.
Since it is not possible to check whether the invite is up to date, it will always return True
for non-template invites.
Returns
partial : bool
stage
Returns the invite's stage.
Deprecated and will be removed in 2024 February.
Returns
stage : None
, InviteStage
target_application_id
Returns the invite's target application's identifier.
Returns
target_application_id : int
target_user_id
Returns the invite's target user's identifier.
Returns
target_user_id : int
url
Methods
(...)
__new__Creates a partial invite with the given fields.
Parameter | Type | Optional | Keyword only | Description |
---|---|---|---|---|
flags |
| The invite's flags. | ||
max_age |
| The time in seconds after the invite will expire. | ||
max_uses |
| How much times the invite can be used. | ||
target_application |
| The invite's target application. | ||
target_type |
| The invite's target type. | ||
target_user |
| The target of the invite if applicable. | ||
temporary |
| Whether this invite only grants temporary membership. |
Raises
TypeError
- If a parameter's type is incorrect.
ValueError
- If a parameter's value is incorrect.
()
copyCopies the invite returning a new partial one.
Returns
new : instance<type<self>>
(...)
copy_withCopies the invite with the given fields.
Parameter | Type | Optional | Keyword only | Description |
---|---|---|---|---|
flags |
| The invite's flags. | ||
max_age |
| The time in seconds after the invite will expire. | ||
max_uses |
| How much times the invite can be used. | ||
target_application |
| The invite's target application. | ||
target_type |
| The invite's target type. | ||
target_user |
| The target of the invite if applicable. | ||
temporary |
| Whether this invite only grants temporary membership. |
Returns
new : instance<type<self>>
Raises
TypeError
- If a parameter's type is incorrect.
ValueError
- If a parameter's value is incorrect.
(data)
from_dataCreates an invite from the given invite data.
Parameter | Type | Description |
---|---|---|
data |
| Invite data. |
Returns
self : instance<cls>
(code, ...)
precreatePrecreates an invite object with the given parameters.
Parameter | Type | Optional | Keyword only | Description |
---|---|---|---|---|
code |
| The invite's code. | ||
**keyword_parameters | keyword parameters | Additional predefined attributes for the invite. | ||
approximate_online_count |
| The amount of online users at the respective guild (or group channel). | ||
approximate_user_count |
| The amount of users at the respective guild (or group channel). | ||
channel |
| The channel where the invite redirects. | ||
created_at |
| When the invite was created. | ||
flags |
| The invite's flags. | ||
guild |
| The guild the invite is for. | ||
invite_type |
| The invite's type. | ||
inviter | The creator of the invite. | |||
max_age |
| The time in seconds after the invite will expire. | ||
max_uses |
| How much times the invite can be used. | ||
target_application |
| The target application of the invite. | ||
target_type |
| The invite's target type. | ||
target_user |
| The target user of the invite. | ||
temporary |
| Whether this invite only grants temporary membership. | ||
uses |
| The amount how much times the invite was used. |
Returns
self : instance<cls>
Raises
TypeError
- If a parameter's type is incorrect.
ValueError
- If a parameter's value is incorrect.
(...)
to_dataConverts the invite to json serializable dictionary.
Parameter | Type | Optional | Keyword only | Default | Description |
---|---|---|---|---|---|
defaults |
|
| Whether fields with their default values should be included as well. | ||
include_internals |
|
| Whether internal fields, like id-s should be present as well. |
Returns
data : dict
of (str
, object
) items
(code)
_create_emptyCreates an empty invite with default attributes set.
Parameter | Type | Description |
---|---|---|
code |
| Unique identifier of the invite. |
Returns
self : instance<cls>
()
_get_hash_partialReturns a partial invite's hash value.
Returns
hash_value : int
(other)
_is_equal_same_typeReturns whether the two types are equal.
Helper method for .__eq__
Parameter | Type | Description |
---|---|---|
other |
| The other instance. Must be from the same type. |
Returns
is_equal : bool
(data)
_set_attributesSets the invite's attributes (except code).
Parameter | Type | Description |
---|---|---|
data |
| Invite data. |
(data)
_set_attributes_commonSets the common attributes of the invite. Used both in ._set_attributes
and ._update_attributes
.
Parameter | Type | Description |
---|---|---|
data |
| Invite data. |
(data)
_set_counts_onlySets the invite's counts.
Parameter | Type | Description |
---|---|---|
data |
| Received invite data. |
(data)
_update_attributesUpdates the invite with the given data.
Parameter | Type | Description |
---|---|---|
data |
| Invite data. |
(data)
_update_attributes_partialUpdates the invite's fields that are received with a partial data.
Parameter | Type | Description |
---|---|---|
data |
| Invite data. |
(data)
_update_counts_onlyUpdates the invite's counts if given.
Parameter | Type | Description |
---|---|---|
data |
| Received invite data. |
()
__eq__Returns whether the two invites are equal.
()
__ge__Whether this entity's id is greater or equal than the other's.
()
__getattr__Drops a rich attribute error.
()
__gt__Whether this entity's id is greater than the other's.
()
__hash__Returns the invite's code's hash.
()
__le__Whether this entity's id is less or equal than the other's.
()
__lt__Whether this entity's id is less than the other's.
()
__ne__Returns whether the two invites are not equal.
()
__repr__Returns the representation of the invite.