GuildWidget

Represents a Guild 's widget.

Attributes

approximate_online_count : int

Estimated count of the online users in the respective guild.

channels : None, tuple of GuildWidgetChannel

Voice channels received with the guild widget.

id : int

The unique identifier number of the guild widget's guild.

invite_url : None, str

The guild widget's invite url if applicable.

name : str

The name of the guild widget's guild.

users : None, tuple of GuildWidgetUser

Online users received with the guild widget.

Properties

created_at

When the entity was created.

Returns

created_at : datetime

guild

Returns the parent guild of the widget. If it is not in cache creates a new one.

Returns

guild : Guild

json_url

Returns an url to request a Guild 's widget data.

This function is a shared property of Guild, GuildWidget.

Returns

url : str

Methods

__new__(...)

Creates a new guild widget from the given fields.

ParameterTypeOptionalKeyword onlyDescription
approximate_online_count

int

Estimated count of the online users in the respective guild.

channels

None, iterable of GuildWidgetChannel

Voice channels received with the guild widget.

id

int

The unique identifier number of the guild widget's guild.

invite_url

None, str

The guild widget's invite url if applicable.

name

str

The name of the guild widget's guild.

users

None, iterable of GuildWidgetUser

Online users received with the guild widget.

Raises

TypeError

  • If a parameter's type is incorrect.

ValueError

  • If a parameter's value is incorrect.

copy()

Copies the guild widget.

Returns

new : instance<type<self>>

copy_with(...)

Copies the guild widget from the given parameters.

ParameterTypeOptionalKeyword onlyDescription
approximate_online_count

int

Estimated count of the online users in the respective guild.

channels

None, iterable of GuildWidgetChannel

Voice channels received with the guild widget.

id

int

The unique identifier number of the guild widget's guild.

invite_url

None, str

The guild widget's invite url if applicable.

name

str

The name of the guild widget's guild.

users

None, iterable of GuildWidgetUser

Online users received with the guild widget.

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 new guild widget from the given data.

ParameterTypeDescription
data

dict of (str, object) items

The requested guild widget data.

Returns

self : instance<cls>

iter_channels()

Iterates over the widget channels.

This method is an iterable generator.

Yields

channel : GuildWidgetChannel

iter_users()

Iterates over the widget users.

This method is an iterable generator.

Yields

user : GuildWidgetUser

to_data(defaults)

Serializes the guild widget.

ParameterTypeDescription
defaults

bool

Whether fields of their default value should be included as well.

Returns

data : dict of (str, object) items

_is_equal_same_type(other)

Returns whether the two types are equal.

Helper method for .__eq__

ParameterTypeDescription
other

instance<type<self>>

The other instance. Must be from the same type.

Returns

is_equal : bool

__eq__()

Returns whether the two guild widget 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 has value of the guild widget.

__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 guild widget are not equal.

__repr__()

Returns the representation of the guild widget.