GuildProfile
Represents a user's profile at a guild.
Attributes
int
The respective user's avatar hash at the guild in uint128
.
The respective user's avatar type at the guild.
None
, datetime
Since when the user uses it's Nitro to boost the respective guild. If the user does not boost the guild then is set as None
.
The guild profile's flags.
None
, datetime
The date, since the user is the member of the guild. If this field was not included with the initial data, then it is set to None
.
None
, str
The user's nick at the guild if it has.
bool
Whether the user has not yet passed the guild's membership screening requirements. Defaults to False
.
None
, tuple
of int
The user's roles at the guild.
None
, datetime
Till when the user is timed out, and cannot interact with the guild.
Properties
avatar
color
created_at
roles
Methods
(...)
__new__Creates a new guild profile instance from the given parameters.
Parameter | Type | Optional | Keyword only | Description |
---|---|---|---|---|
avatar |
| The guild profile's avatar. | ||
boosts_since |
| Since when the user uses it's Nitro to boost the respective guild. | ||
flags |
| The guild profile's flags. | ||
joined_at |
| The date, since the user is the member of the guild. | ||
nick |
| The user's nick at the guild if it has. | ||
pending |
| Whether the user has not yet passed the guild's membership screening requirements. | ||
role_ids |
| The user's roles at the guild. | ||
timed_out_until |
| Till when the user is timed out, and cannot interact with the guild. |
Raises
TypeError
- If a parameter's type is incorrect.
ValueError
- If a parameter's value is incorrect.
()
copyCopies the guild profile.
Returns
new : instance<type<self>>
(...)
copy_withCopies the guild profile and modifies the defined the defined fields of it.
Parameter | Type | Optional | Keyword only | Description |
---|---|---|---|---|
avatar |
| The guild profile's avatar. | ||
boosts_since |
| Since when the user uses it's Nitro to boost the respective guild. | ||
flags |
| The guild profile's flags. | ||
joined_at |
| The date, since the user is the member of the guild. | ||
nick |
| The user's nick at the guild if it has. | ||
pending |
| Whether the user has not yet passed the guild's membership screening requirements. | ||
role_ids |
| The user's roles at the guild. | ||
timed_out_until |
| Till when the user is timed out, and cannot interact with the guild. |
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 a guild profile from the given data.
Parameter | Type | Description |
---|---|---|
data |
| Received guild profile data. |
Returns
self : instance<cls>
(...)
get_top_roleReturns the top role of the guild profile. If the profile has no roles, then returns the default
's value.
Parameter | Type | Optional | Default | Description |
---|---|---|---|---|
default |
|
| Default value to return if the respective user has no roles at the respective guild. Defaults to |
Returns
top_role : Role
, default
()
iter_role_idsIterates over the role-ids of the guild profile.
This method is an iterable generator.
Yields
role_id : int
()
iter_rolesIterates over the roles of the guild profile. The roles are not sorted by position like at the case of .roles
, but based on .id
.
This method is an iterable generator.
Yields
role : Role
(...)
to_dataConverts the guild profile to a json serializable object.
Parameter | Type | Optional | Keyword only | Default | Description |
---|---|---|---|---|---|
defaults |
|
| Whether default values should be included as well. | ||
include_internals |
|
| Whether internal fields should be included as well. |
Returns
data : dict
of (str
, object
) items
()
_create_emptyCreates a new guild profile with it's default attributes set.
Returns
self instance<cls>
(data)
_difference_update_attributesUpdates the guild profile and returns it's changed attributes in a dict
within attribute-name
- old-value
relation.
Parameter | Type | Description |
---|---|---|
data |
| Data received from Discord. |
Returns
old_attributes : dict
of (str
, object
) items
All item in the returned dict is optional.
Returned Data Structure
Keys | Values |
---|---|
avatar | Icon |
boosts_since | None , datetime |
flags | None , GuildProfileFlags |
nick | None , str |
pending | bool |
role_ids | None , tuple of int |
timed_out_until | None , datetime |
(data)
_set_joinedSets .joined_at
of the guild profile if it is not set yet.
Parameter | Type | Description |
---|---|---|
data |
| Received guild profile data. |
(data)
_update_attributesUpdates the guild profile with overwriting it's old attributes.
Parameter | Type | Description |
---|---|---|
data |
| Received guild profile data. |
()
__eq__Returns whether the two guild profiles are equal.
()
__hash__Returns the guild profile's hash value.
()
__repr__Returns the representation of the guild profile.