Miscellaneous
Graphics
Badge
- class coc.Badge
Represents a Clash Of Clans Badge.
- small
str- URL for a small sized badge (70x70).
- medium
str- URL for a medium sized badge (200x200).
- large
str- URL for a large sized badge (512x512).
- async save(filepath, size=None) int
Save this badge as a file-like object.
- Parameters:
filepath (
os.PathLike) – The filename to save the badge to.size (Optional[
str]) – Eithersmall,mediumorlarge. The default ismedium.
- Returns:
The number of bytes written
- Return type:
int- Raises:
HTTPException – Saving the badge failed.
NotFound – The URL was not found.
- property url: str
the default icon URL. Returns the medium-sized icon URL if available. Falls back to small and large (in that order) if not
- Type:
str
Icon
- class coc.Icon
Represents a Clash Of Clans Icon.
- tiny
str: URL for a tiny sized icon (32x32).
- small
str: URL for a small sized icon (72x72).
- medium
str: URL for a medium sized icon (288x288).
- async save(filepath: str, size: str | None = None) int
Save this icon as a file-like object.
- Parameters:
filepath (
os.PathLike) – The filename to save the badge to.size (Optional[
str]) – Eithertiny,smallormedium. The default issmall.
- Returns:
:class:`int`
- Return type:
The number of bytes written.
- Raises:
HTTPException – Saving the badge failed.
NotFound – The URL was not found.
- property url: str
the default icon URL. Returns the medium-sized icon URL if available. Falls back to small and tiny (in that order) if not
- Type:
str
Time
Timestamp
- class coc.Timestamp
Represents a Clash of Clans Timestamp
- raw_time
str: The raw timestamp string (ISO8601) as given by the API.
- property now: datetime
Returns the time of the timestamp as a datetime object in UTC.
- Type:
datetime
- property seconds_until: int
Returns the number of seconds until the timestamp. This may be negative.
- Type:
int
- property time: datetime
Returns the timestamp as a UTC datetime object.
- Type:
datetime
TimeDelta
- class coc.TimeDelta
Represents a Timedelta object corresponding to things that take time to do in the API.
Some examples include:
Upgrade times
Training times
Cooldown times
This object works in a very similar fashion to datetime’s timedelta object, but with a few more helpful attributes.
Note
You should not construct this yourself, instead use it from the attribute of an e.g.
Troopmodel.- days
The number of days in the timedelta.
- Type:
int
- hours
The number of hours in the timedelta. This does not include days. For example, if an upgrade took 36 hours, the
.daysattribute would be 1, and.hourswould be 12.- Type:
int
- minutes
The number of minutes in the timedelta. The same logic applies as with hours.
- Type:
int
- seconds
The number of seconds in the timedelta. The same logic applies as with hours.
- Type:
int
- total_seconds()
Returns the total number of seconds in the time object.
This is the addition of all days, hours, minutes, seconds.
- Returns:
The number of seconds
- Return type:
int
Location
- class coc.Location
Represents a Clash of Clans Location
- id
int- The location ID
- name
str- The location name
- is_country
bool- Indicates whether the location is a country
- country_code
str- The shorthand country code, if the location is a country
- localised_name
str- A localised name of the location. The extent of the use of this is unknown at present.
Season
- class coc.Season
Represents a Clash of Clans Player’s Season.
ChatLanguage
GoldPassSeason
TID
Translation
- class coc.Translation
Represents translations for multiple languages.
Supports multiple access patterns:
Attribute access:
translation.russian,translation.englishDictionary access (uppercase):
translation["RU"],translation["EN"]Dictionary access (lowercase):
translation["ru"],translation["en"]
- english
- Type:
str
- arabic
- Type:
str
- chinese
- Type:
str
- chinese_traditional
- Type:
str
- german
- Type:
str
- spanish
- Type:
str
- persian
- Type:
str
- finnish
- Type:
str
- french
- Type:
str
- indonesian
- Type:
str
- italian
- Type:
str
- japanese
- Type:
str
- korean
- Type:
str
- malay
- Type:
str
- dutch
- Type:
str
- norwegian
- Type:
str
- polish
- Type:
str
- portuguese
- Type:
str
- russian
- Type:
str
- thai
- Type:
str
- turkish
- Type:
str
- vietnamese
- Type:
str