Skip to main content

Class: ClanWar

Represents a Clan War in Clash of Clans.

caution

It's recommended to see if ClanWar#state is notInWar available before performing operations or reading data from it. You can check this with data.ok property.

Constructors​

constructor​

• new ClanWar(client, data, extra)

Parameters​

NameType
clientClient
dataAPIClanWar
extraObject
extra.clanTag?string
extra.warTag?string

Defined in​

struct/ClanWar.ts:281

Properties​

state​

• state: "notInWar" | "preparation" | "inWar" | "warEnded"

The clan's current war state.

⚠️ Other properties won't be available if the state is notInWar.

Defined in​

struct/ClanWar.ts:252


teamSize​

• teamSize: number

The number of players on each side.

Defined in​

struct/ClanWar.ts:255


attacksPerMember​

• attacksPerMember: number

The number of attacks each member has.

Defined in​

struct/ClanWar.ts:258


preparationStartTime​

• preparationStartTime: Date

The Date that preparation day started at.

Defined in​

struct/ClanWar.ts:261


startTime​

• startTime: Date

The Date that battle day starts at.

Defined in​

struct/ClanWar.ts:264


endTime​

• endTime: Date

The Date that battle day ends at.

Defined in​

struct/ClanWar.ts:267


clan​

• clan: WarClan

The home clan.

Defined in​

struct/ClanWar.ts:270


opponent​

• opponent: WarClan

The opposition clan.

Defined in​

struct/ClanWar.ts:273


warTag​

• warTag: null | string

The war's unique tag. This is null unless this is a CWL.

Defined in​

struct/ClanWar.ts:276

Accessors​

isNotInWar​

• get isNotInWar(): boolean

Whether the clan is not in war.

Returns​

boolean

Defined in​

struct/ClanWar.ts:325


isBattleDay​

• get isBattleDay(): boolean

Whether this is a Battle Day.

Returns​

boolean

Defined in​

struct/ClanWar.ts:330


isPreparationDay​

• get isPreparationDay(): boolean

Whether this is a Preparation Day.

Returns​

boolean

Defined in​

struct/ClanWar.ts:335


isWarEnded​

• get isWarEnded(): boolean

Whether this War has Ended.

Returns​

boolean

Defined in​

struct/ClanWar.ts:340


type​

• get type(): "friendly" | "cwl" | "normal"

Returns either friendly, cwl or normal.

Returns​

"friendly" | "cwl" | "normal"

Defined in​

struct/ClanWar.ts:345


isFriendly​

• get isFriendly(): boolean

Whether this is a friendly war.

Returns​

boolean

Defined in​

struct/ClanWar.ts:352


isCWL​

• get isCWL(): boolean

Whether this is a CWL.

Returns​

boolean

Defined in​

struct/ClanWar.ts:358


isNormal​

• get isNormal(): boolean

Whether this is a normal war.

Returns​

boolean

Defined in​

struct/ClanWar.ts:363


status​

• get status(): "win" | "lose" | "tie" | "pending"

Returns the war status, based off the home clan.

Returns​

"win" | "lose" | "tie" | "pending"

Defined in​

struct/ClanWar.ts:368

Methods​

getMember​

▸ getMember(tag): null | ClanWarMember

Return a ClanWarMember with the tag provided.

Parameters​

NameType
tagstring

Returns​

null | ClanWarMember

Defined in​

struct/ClanWar.ts:304


getAttack​

▸ getAttack(attackerTag, defenderTag): null | ClanWarAttack

Return a list of ClanWarAttack for the attackerTag and defenderTag provided.

Parameters​

NameType
attackerTagstring
defenderTagstring

Returns​

null | ClanWarAttack

Defined in​

struct/ClanWar.ts:309


getDefenses​

▸ getDefenses(defenderTag): ClanWarAttack[]

Return a list of ClanWarAttack for the defenderTag provided.

Parameters​

NameType
defenderTagstring

Returns​

ClanWarAttack[]

Defined in​

struct/ClanWar.ts:316


getClanWarLeagueGroup​

▸ getClanWarLeagueGroup(): null | Promise<ClanWarLeagueGroup>

Returns the Clan War League Group.

Returns​

null | Promise<ClanWarLeagueGroup>

Defined in​

struct/ClanWar.ts:383