Class: ClanWar
Represents a Clan War in Clash of Clans.
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
Name | Type |
---|---|
client | Client |
data | APIClanWar |
extra | Object |
extra.clanTag? | string |
extra.warTag? | string |
Defined in
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
teamSize
• teamSize: number
The number of players on each side.
Defined in
attacksPerMember
• attacksPerMember: number
The number of attacks each member has.
Defined in
preparationStartTime
• preparationStartTime: Date
The Date that preparation day started at.
Defined in
startTime
• startTime: Date
The Date that battle day starts at.
Defined in
endTime
• endTime: Date
The Date that battle day ends at.
Defined in
clan
• clan: WarClan
The home clan.
Defined in
opponent
• opponent: WarClan
The opposition clan.
Defined in
warTag
• warTag: null
| string
The war's unique tag. This is null
unless this is a CWL.
Defined in
Accessors
isNotInWar
• get
isNotInWar(): boolean
Whether the clan is not in war.
Returns
boolean
Defined in
isBattleDay
• get
isBattleDay(): boolean
Whether this is a Battle Day.
Returns
boolean
Defined in
isPreparationDay
• get
isPreparationDay(): boolean
Whether this is a Preparation Day.
Returns
boolean
Defined in
isWarEnded
• get
isWarEnded(): boolean
Whether this War has Ended.
Returns
boolean
Defined in
type
• get
type(): "friendly"
| "cwl"
| "normal"
Returns either friendly
, cwl
or normal
.
Returns
"friendly"
| "cwl"
| "normal"
Defined in
isFriendly
• get
isFriendly(): boolean
Whether this is a friendly war.
Returns
boolean
Defined in
isCWL
• get
isCWL(): boolean
Whether this is a CWL.
Returns
boolean
Defined in
isNormal
• get
isNormal(): boolean
Whether this is a normal war.
Returns
boolean
Defined in
status
• get
status(): "win"
| "lose"
| "tie"
| "pending"
Returns the war status, based off the home clan.
Returns
"win"
| "lose"
| "tie"
| "pending"
Defined in
Methods
getMember
▸ getMember(tag
): null
| ClanWarMember
Return a ClanWarMember with the tag provided.
Parameters
Name | Type |
---|---|
tag | string |
Returns
null
| ClanWarMember
Defined in
getAttack
▸ getAttack(attackerTag
, defenderTag
): null
| ClanWarAttack
Return a list of ClanWarAttack for the attackerTag and defenderTag provided.
Parameters
Name | Type |
---|---|
attackerTag | string |
defenderTag | string |
Returns
null
| ClanWarAttack
Defined in
getDefenses
▸ getDefenses(defenderTag
): ClanWarAttack
[]
Return a list of ClanWarAttack for the defenderTag provided.
Parameters
Name | Type |
---|---|
defenderTag | string |
Returns
Defined in
getClanWarLeagueGroup
▸ getClanWarLeagueGroup(): null
| Promise
<ClanWarLeagueGroup
>
Returns the Clan War League Group.
Returns
null
| Promise
<ClanWarLeagueGroup
>