GuildProfile

Represents a user's profile at a guild.

Attributes

avatar_hash : int

The respective user's avatar hash at the guild in uint128.

avatar_type : IconType

The respective user's avatar type at the guild.

boosts_since : 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.

joined_at : 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.

nick : None, str

The user's nick at the guild if it has.

pending : bool

Whether the user has not yet passed the guild's membership screening requirements. Defaults to False.

role_ids : None, tuple of int

The user's roles at the guild.

timed_out_until : None, datetime

Till when the user is timed out, and cannot interact with the guild.

Properties

avatar

Returns the respective icon.

Returns

icon : Icon

color

Returns the color of the respective user at the respective guild.

Returns

color : Color

created_at

Returns .joined_at if set, else the Discord epoch.

Returns

created_at : datetime

roles

Returns the roles of the guild profile in sorted form.

Returns

roles : None, list of Role

Methods

__new__(...)

Creates a new guild profile instance from the given parameters.

ParameterTypeOptionalKeyword onlyDescription
avatar

None, Icon, str

The guild profile's avatar.

boosts_since

None, datetime

Since when the user uses it's Nitro to boost the respective guild.

flags

int, GuildProfileFlag

The guild profile's flags.

joined_at

None, datetime

The date, since the user is the member of the guild.

nick

None, str

The user's nick at the guild if it has.

pending

bool

Whether the user has not yet passed the guild's membership screening requirements.

role_ids

None, iterable of (int, Role)

The user's roles at the guild.

timed_out_until

None, datetime

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.

copy()

Copies the guild profile.

Returns

new : instance<type<self>>

copy_with(...)

Copies the guild profile and modifies the defined the defined fields of it.

ParameterTypeOptionalKeyword onlyDescription
avatar

None, Icon, str

The guild profile's avatar.

boosts_since

None, datetime

Since when the user uses it's Nitro to boost the respective guild.

flags

int, GuildProfileFlag

The guild profile's flags.

joined_at

None, datetime

The date, since the user is the member of the guild.

nick

None, str

The user's nick at the guild if it has.

pending

bool

Whether the user has not yet passed the guild's membership screening requirements.

role_ids

None, iterable of (int, Role)

The user's roles at the guild.

timed_out_until

None, datetime

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.

from_data(data)

Creates a guild profile from the given data.

ParameterTypeDescription
data

dict of (str, object) items

Received guild profile data.

Returns

self : instance<cls>

get_top_role(...)

Returns the top role of the guild profile. If the profile has no roles, then returns the default 's value.

ParameterTypeOptionalDefaultDescription
default

object

None

Default value to return if the respective user has no roles at the respective guild. Defaults to None.

Returns

top_role : Role, default

iter_role_ids()

Iterates over the role-ids of the guild profile.

This method is an iterable generator.

Yields

role_id : int

iter_roles()

Iterates 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_data(...)

Converts the guild profile to a json serializable object.

ParameterTypeOptionalKeyword onlyDefaultDescription
defaults

bool

False

Whether default values should be included as well.

include_internals

bool

False

Whether internal fields should be included as well.

Returns

data : dict of (str, object) items

_create_empty()

Creates a new guild profile with it's default attributes set.

Returns

self instance<cls>

_difference_update_attributes(data)

Updates the guild profile and returns it's changed attributes in a dict within attribute-name- old-value relation.

ParameterTypeDescription
data

dict of (str, object) items

Data received from Discord.

Returns

old_attributes : dict of (str, object) items

All item in the returned dict is optional.

Returned Data Structure

KeysValues
avatarIcon
boosts_sinceNone, datetime
flagsNone, GuildProfileFlags
nickNone, str
pendingbool
role_idsNone, tuple of int
timed_out_untilNone, datetime

_set_joined(data)

Sets .joined_at of the guild profile if it is not set yet.

ParameterTypeDescription
data

dict of (str, object) items

Received guild profile data.

_update_attributes(data)

Updates the guild profile with overwriting it's old attributes.

ParameterTypeDescription
data

dict of (str, object) items

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.