Skip to main content

Class: Player

Represents a Clash of Clans Player.

Constructors

constructor

new Player(client, data)

Parameters

NameType
clientClient
dataAPIPlayer

Defined in

struct/Player.ts:101

Properties

name

name: string

The player's name.

Defined in

struct/Player.ts:15


tag

tag: string

The player's tag.

Defined in

struct/Player.ts:18


townHallLevel

townHallLevel: number

The player's Town Hall level..

Defined in

struct/Player.ts:21


townHallWeaponLevel

townHallWeaponLevel: null | number

The player's Town Hall weapon level.

Defined in

struct/Player.ts:24


expLevel

expLevel: number

The player's experience level.

Defined in

struct/Player.ts:27


trophies

trophies: number

The player's trophy count.

Defined in

struct/Player.ts:30


bestTrophies

bestTrophies: number

The player's best trophies.

Defined in

struct/Player.ts:33


warStars

warStars: number

The player's war stars.

Defined in

struct/Player.ts:36


attackWins

attackWins: number

The number of attacks the player has won this season.

Defined in

struct/Player.ts:39


defenseWins

defenseWins: number

The number of defenses the player has won this season.

Defined in

struct/Player.ts:42


builderHallLevel

builderHallLevel: null | number

The player's builder hall level, or 0 if it hasn't been unlocked.

Defined in

struct/Player.ts:45


builderBaseTrophies

builderBaseTrophies: null | number

The player's builder base trophy count.

Defined in

struct/Player.ts:48


bestBuilderBaseTrophies

bestBuilderBaseTrophies: null | number

The player's best builder base trophies.

Defined in

struct/Player.ts:51


donations

donations: number

The player's donation count for this season.

Defined in

struct/Player.ts:54


received

received: number

The player's donation received count for this season.

Defined in

struct/Player.ts:57


clanCapitalContributions

clanCapitalContributions: number

The player's total Clan Capital contribution

Defined in

struct/Player.ts:60


role

role: null | "member" | "coLeader" | "leader" | "elder"

The player's role in the clan or null if not in a clan.

Defined in

struct/Player.ts:63


warOptedIn

warOptedIn: null | boolean

Whether the player has selected that they are opted in. This will be null if the player is not in a clan.

Defined in

struct/Player.ts:66


clan

clan: null | PlayerClan

The player's clan.

Defined in

struct/Player.ts:69


league

league: League

The player's current League.

Defined in

struct/Player.ts:72


legendStatistics

legendStatistics: null | LegendStatistics

The player's legend statistics, or null if they have never been in the legend league.

Defined in

struct/Player.ts:75


achievements

achievements: Achievement[]

An array of the player's achievements.

Defined in

struct/Player.ts:78


labels

labels: Label[]

An array of player's labels.

Defined in

struct/Player.ts:81


troops

troops: Troop[]

An array of player's troops (including pets and seige machines).

Defined in

struct/Player.ts:84


spells

spells: Spell[]

An array of player's spells.

Defined in

struct/Player.ts:87


heroes

heroes: Hero[]

An array of player's heroes (both home base and build base).

Defined in

struct/Player.ts:90


heroEquipment

heroEquipment: Equipment[]

An array of player's hero equipment.

Defined in

struct/Player.ts:93


playerHouse

Optional playerHouse: null | APIPlayerHouse

The player's clan capital house details.

Defined in

struct/Player.ts:96

Accessors

inClan

get inClan(): boolean

Whether this clan member is in the clan.

Returns

boolean

Defined in

struct/Player.ts:137


isMember

get isMember(): null | boolean

Whether this clan member is in the clan.

Returns

null | boolean

Defined in

struct/Player.ts:142


isLeader

get isLeader(): null | boolean

Whether this clan member is a Leader.

Returns

null | boolean

Defined in

struct/Player.ts:147


isCoLeader

get isCoLeader(): null | boolean

Whether this clan member is a Co-Leader.

Returns

null | boolean

Defined in

struct/Player.ts:152


isElder

get isElder(): null | boolean

Whether this clan member is an Elder.

Returns

null | boolean

Defined in

struct/Player.ts:157


homeTroops

get homeTroops(): Troop[]

An array of the player's home base troops.

Returns

Troop[]

Defined in

struct/Player.ts:168


builderTroops

get builderTroops(): Troop[]

An array of the player's builder base troops.

Returns

Troop[]

Defined in

struct/Player.ts:175


superTroops

get superTroops(): Troop[]

An array of the player's super troops.

Returns

Troop[]

Defined in

struct/Player.ts:182


heroPets

get heroPets(): Troop[]

An array of the player's hero pets.

Returns

Troop[]

Defined in

struct/Player.ts:189


siegeMachines

get siegeMachines(): Troop[]

An array of the player's siege machines.

Returns

Troop[]

Defined in

struct/Player.ts:196


get shareLink(): string

Get player's formatted link to open player in-game.

Returns

string

Defined in

struct/Player.ts:203

Methods

fetchClan

fetchClan(options?): Promise<null | Clan>

Fetch detailed clan info for the player's clan.

Parameters

NameType
options?OverrideOptions

Returns

Promise<null | Clan>

Defined in

struct/Player.ts:162