Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions coc/clans.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@ class Clan(BaseClan):
type: :class:`str`
The clan's type for accepting members.
This could be ``open``, ``inviteOnly`` or ``closed``.
family_friendly: :class:`bool`
Indicates the clan's family friendly status. This can be True if family friendly, or False if not.
description: :class:`str`
The clan's public description.
location: :class:`Location`
Expand All @@ -110,8 +112,9 @@ class Clan(BaseClan):
The clan's trophy count. This is calculated according to
members' trophy counts.
versus_points: :class:`int`
The clan's versus trophy count. This is calculated according to
members' versus trophy counts.
The clan's versus trophy count. This is calculated according to members' versus trophy counts.
capital_points: :class:`int`
The clan's clan capital points. Unsure how this is calculated.
required_trophies: :class:`int`
The minimum trophies required to apply to this clan.
required_townhall: :class:`int`
Expand Down Expand Up @@ -145,14 +148,18 @@ class Clan(BaseClan):
this inherits from :class:`coc.CapitalDistrict`.
war_league: :class:`coc.WarLeague`
The clan's CWL league.
capital_league: :class:`coc.WarLeague`
The clan's Clan Capital league.
"""

__slots__ = (
"type",
"family_friendly",
"description",
"location",
"points",
"versus_points",
"capital_points",
"required_trophies",
"war_frequency",
"war_win_streak",
Expand All @@ -169,6 +176,7 @@ class Clan(BaseClan):
"member_cls",
"capital_district_cls",
"war_league",
"capital_league",
"chat_language",
"required_townhall",

Expand All @@ -194,11 +202,13 @@ def _from_data(self, data: dict) -> None:

self.points: int = data_get("clanPoints")
self.versus_points: int = data_get("clanVersusPoints")
self.capital_points: int = data_get("clanCapitalPoints")
self.member_count: int = data_get("members")
self.location = try_enum(Location, data=data_get("location"))

# only available via /clans/{clanTag} or /clans endpoint
self.type: str = data_get("type")
self.family_friendly = data_get("isFamilyFriendly")
self.required_trophies: int = data_get("requiredTrophies")
self.war_frequency: str = data_get("warFrequency")
self.war_win_streak: int = data_get("warWinStreak")
Expand All @@ -208,6 +218,7 @@ def _from_data(self, data: dict) -> None:
self.public_war_log: bool = data_get("isWarLogPublic")
self.description: str = data_get("description")
self.war_league = try_enum(WarLeague, data=data_get("warLeague"))
self.capital_league = try_enum(WarLeague, data=data_get("capitalLeague"))
self.chat_language = try_enum(ChatLanguage, data=data_get("chatLanguage"))
self.required_townhall = data_get("requiredTownhallLevel")

Expand Down