Team
Represents a Team on the Discord developer portal.
Attributes
int
The team's icon's hash as uint128
. Defaults to 0
.
IconType
The team's icon's type.
int
The unique identifier number of the team.
tuple
of TeamMember
The members of the team. Includes invited members as well.
str
The teams name.
int
The team's owner's id.
Notes
Team objects support weakreferencing.
Properties
accepted
created_at
When the entity was created.
Returns
created_at : datetime
icon
icon_url
Returns the team's icon's url. If the team has no icon, then returns None
.
This function is a shared property of Team
-s.
Returns
url : None
, str
invited
owner
partial
Returns whether the team is partial.
Returns
partial : bool
Methods
(...)
__new__Creates a partial team instance.
Parameter | Type | Optional | Keyword only | Description |
---|---|---|---|---|
icon |
| The team's icon. | ||
members |
| The members of the team. | ||
name |
| The team's name. | ||
owner_id |
| The team's owner's identifier. |
Returns
self : instance<cls>
Raises
TypeError
- If a parameter's type is incorrect.
ValueError
- If a parameter's value is incorrect.
()
copyCopies the team.
Returns
new : instance<type<self>>
(...)
copy_withCopies the team with the defined fields.
Parameter | Type | Optional | Keyword only | Description |
---|---|---|---|---|
icon |
| The team's icon. | ||
members |
| The members of the team. | ||
name |
| The team's name. | ||
owner_id |
| The team's owner's identifier. |
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 new team from the given data.
Parameter | Type | Description |
---|---|---|
data |
| Team data. |
Returns
team : Team
(...)
icon_url_asReturns the team's icon's url. If the team has no icon, then returns None
.
This function is a shared method of Team
-s.
Parameter | Type | Optional | Default | Description |
---|---|---|---|---|
ext |
|
| The extension of the icon's url. Can be any of: | |
size |
|
| The preferred minimal size of the icon's url. |
Returns
url : None
, str
Raises
ValueError
If ext
, size
was not passed as any of the expected values.
()
iter_membersIterates over the team members of team.
This method is an iterable generator.
Yields
team_member : TeamMember
(team_id, ...)
precreateCreates a cached team instance.
Parameter | Type | Optional | Keyword only | Description |
---|---|---|---|---|
team_id |
| The team's identifier. | ||
**keyword_parameters | Keyword parameters | Additional keyword parameters. | ||
icon |
| The team's icon. | ||
members |
| The members of the team. | ||
name |
| The team's name. | ||
owner_id |
| The team's owner's identifier. |
Returns
self : instance<cls>
Raises
TypeError
- If a parameter's type is incorrect.
ValueError
- If a parameter's value is incorrect.
(...)
to_dataConverts the team into a json serializable object.
Parameter | Type | Optional | Keyword only | Default | Description |
---|---|---|---|---|---|
defaults |
|
| Whether default field values should be included. | ||
include_internals |
|
| Whether internal fields should be included. |
Returns
data : dict
of (str
, object
) items
()
to_data_userConverts the team into a json serializable object as it would be a user.
Returns
data : dict
of (str
, object
) items
(team_id)
_create_emptyCreates a new team instance with it's attribute set to their default values.
Parameter | Type | Description |
---|---|---|
team_id |
| The team's identifier. |
Returns
self : instance<cls>
()
_get_hash_partialCalculates the team's hash based on their fields.
This method is called by .__hash__
if the team has no .id
set.
Returns
hash_value : int
(other)
_is_equal_same_typeReturns whether self is equal to other. Other must be same type as self.
Parameter | Type | Description |
---|---|---|
other |
| The other instance. |
Returns
is_equal : bool
(data)
_set_attributesSets the team's attributes from the given data (except .id
).
Parameter | Type | Description |
---|---|---|
data |
| Team dat. |
()
__eq__Returns whether the two teams 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 team's hash value.
()
__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 teams are not equal.
()
__repr__Returns the team's representation.