clashofclans.js 2.7.0-dev.31f642e → 2.7.0-dev.a33ae73

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -2,9 +2,15 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
- # 2.6.1 (2022-02-03)
5
+ ## 2.7.0 (2022-05-22)
6
6
 
7
- Bug Fixes
7
+ ### Features
8
+
9
+ - Some useful QOL methods have been added. ([#106](https://github.com/clashperk/clashofclans.js/pull/106))
10
+
11
+ ## 2.6.1 (2022-02-03)
12
+
13
+ ### Bug Fixes
8
14
 
9
15
  - New value and typings `notInWar` added for `ClanWarLeagueGroup#state` ([#101](https://github.com/clashperk/clashofclans.js/pull/101))
10
16
  - Throw error if `Util.formatTag` / `Util.parseTag` is called with invalid argument ([#102](https://github.com/clashperk/clashofclans.js/pull/101))
@@ -26,9 +26,13 @@ export declare class ClanMember {
26
26
  /** The member's donation received count for this season. */
27
27
  received: number;
28
28
  constructor(client: Client, data: APIClanMember);
29
+ /** Whether this clan member is in the clan. */
29
30
  get isMember(): boolean;
31
+ /** Whether this clan member is an Elder. */
30
32
  get isElder(): boolean;
33
+ /** Whether this clan member is a Co-Leader. */
31
34
  get isCoLeader(): boolean;
35
+ /** Whether this clan member is a Leader. */
32
36
  get isLeader(): boolean;
33
37
  /** Fetch detailed clan info for the member's clan. */
34
38
  fetch(options?: OverrideOptions): Promise<import("./Player").Player>;
@@ -20,15 +20,19 @@ class ClanMember {
20
20
  this.donations = data.donations;
21
21
  this.received = data.donationsReceived;
22
22
  }
23
+ /** Whether this clan member is in the clan. */
23
24
  get isMember() {
24
25
  return this.role === 'member';
25
26
  }
27
+ /** Whether this clan member is an Elder. */
26
28
  get isElder() {
27
29
  return this.role === 'elder';
28
30
  }
31
+ /** Whether this clan member is a Co-Leader. */
29
32
  get isCoLeader() {
30
33
  return this.role === 'coLeader';
31
34
  }
35
+ /** Whether this clan member is a Leader. */
32
36
  get isLeader() {
33
37
  return this.role === 'leader';
34
38
  }
@@ -135,8 +135,11 @@ export declare class ClanWar {
135
135
  getAttack(attackerTag: string, defenderTag: string): ClanWarAttack | null;
136
136
  /** Return a list of {@link ClanWarAttack} for the defenderTag provided. */
137
137
  getDefenses(defenderTag: string): ClanWarAttack[];
138
+ /** Whether this is a Battle Day. */
138
139
  get isBattleDay(): boolean;
140
+ /** Whether this is a Preparation Day. */
139
141
  get isPreparationDay(): boolean;
142
+ /** Whether this War has Ended. */
140
143
  get isWarEnded(): boolean;
141
144
  /** Returns either `friendly`, `cwl` or `normal`. */
142
145
  get type(): "friendly" | "cwl" | "normal";
@@ -178,12 +178,15 @@ class ClanWar {
178
178
  }
179
179
  return this.opponent.attacks.filter((atk) => atk.defenderTag === defenderTag);
180
180
  }
181
+ /** Whether this is a Battle Day. */
181
182
  get isBattleDay() {
182
183
  return this.state === 'inWar';
183
184
  }
185
+ /** Whether this is a Preparation Day. */
184
186
  get isPreparationDay() {
185
187
  return this.state === 'preparation';
186
188
  }
189
+ /** Whether this War has Ended. */
187
190
  get isWarEnded() {
188
191
  return this.state === 'warEnded';
189
192
  }
@@ -54,6 +54,7 @@ export declare class ClanWarLeagueGroup {
54
54
  /** An array containing all war tags for each round. */
55
55
  rounds: ClanWarLeagueRound[];
56
56
  constructor(client: Client, data: APIClanWarLeagueGroup);
57
+ /** Total number of rounds for this CWL. */
57
58
  get totalRounds(): number;
58
59
  /**
59
60
  * This returns an array of {@link ClanWar} which fetches all wars in parallel.
@@ -55,6 +55,7 @@ class ClanWarLeagueGroup {
55
55
  this.clans = data.clans.map((clan) => new ClanWarLeagueClan(client, clan));
56
56
  this.rounds = data.rounds.map((round, i) => new ClanWarLeagueRound(round, i));
57
57
  }
58
+ /** Total number of rounds for this CWL. */
58
59
  get totalRounds() {
59
60
  return this.clans.length - 1;
60
61
  }
@@ -51,7 +51,10 @@ export declare class ClanWarLog {
51
51
  constructor(client: Client, data: APIClanWarLogEntry);
52
52
  /** Returns either `friendly`, `cwl` or `normal`. */
53
53
  get type(): "friendly" | "cwl" | "normal";
54
+ /** Whether this is a friendly war. */
54
55
  get isFriendly(): boolean;
56
+ /** Whether this is a CWL. */
55
57
  get isCWL(): boolean;
58
+ /** Whether this is a normal war. */
56
59
  get isNormal(): boolean;
57
60
  }
@@ -44,12 +44,15 @@ class ClanWarLog {
44
44
  return 'cwl';
45
45
  return 'normal';
46
46
  }
47
+ /** Whether this is a friendly war. */
47
48
  get isFriendly() {
48
49
  return this.type === 'friendly';
49
50
  }
51
+ /** Whether this is a CWL. */
50
52
  get isCWL() {
51
53
  return this.type === 'cwl';
52
54
  }
55
+ /** Whether this is a normal war. */
53
56
  get isNormal() {
54
57
  return this.type === 'normal';
55
58
  }
@@ -62,10 +62,15 @@ export declare class Player {
62
62
  /** An array of player's heroes (both home base and build base). */
63
63
  heroes: Hero[];
64
64
  constructor(client: Client, data: APIPlayer);
65
+ /** Whether this clan member is in the clan. */
65
66
  get inClan(): boolean;
67
+ /** Whether this clan member is in the clan. */
66
68
  get isMember(): boolean | null;
69
+ /** Whether this clan member is a Leader. */
67
70
  get isLeader(): boolean | null;
71
+ /** Whether this clan member is a Co-Leader. */
68
72
  get isCoLeader(): boolean | null;
73
+ /** Whether this clan member is an Elder. */
69
74
  get isElder(): boolean | null;
70
75
  /** Fetch detailed clan info for the player's clan. */
71
76
  fetchClan(options?: OverrideOptions): Promise<import("./Clan").Clan | null>;
@@ -40,18 +40,23 @@ class Player {
40
40
  this.spells = data.spells.map((unit) => new Unit_1.Spell(data, unit));
41
41
  this.heroes = data.heroes.map((unit) => new Unit_1.Hero(data, unit));
42
42
  }
43
+ /** Whether this clan member is in the clan. */
43
44
  get inClan() {
44
45
  return this.clan !== null;
45
46
  }
47
+ /** Whether this clan member is in the clan. */
46
48
  get isMember() {
47
49
  return this.clan ? this.role === 'member' : null;
48
50
  }
51
+ /** Whether this clan member is a Leader. */
49
52
  get isLeader() {
50
53
  return this.clan ? this.role === 'leader' : null;
51
54
  }
55
+ /** Whether this clan member is a Co-Leader. */
52
56
  get isCoLeader() {
53
57
  return this.clan ? this.role === 'coLeader' : null;
54
58
  }
59
+ /** Whether this clan member is an Elder. */
55
60
  get isElder() {
56
61
  return this.clan ? this.role === 'elder' : null;
57
62
  }
@@ -1,4 +1,3 @@
1
- import { Clan, ClanMember } from '../struct';
2
1
  import { ClanSearchOptions, SearchOptions } from '../types';
3
2
  /** Contains various general-purpose utility methods. */
4
3
  export declare class Util extends null {
@@ -40,6 +39,4 @@ export declare class Util extends null {
40
39
  static getSeasonEndTime(timestamp?: Date): Date;
41
40
  static allSettled<T>(values: Promise<T>[]): Promise<T[]>;
42
41
  static delay(ms: number): Promise<unknown>;
43
- static joinedMembers(oldClan: Clan, newClan: Clan): ClanMember[];
44
- static leftMembers(oldClan: Clan, newClan: Clan): ClanMember[];
45
42
  }
package/dist/util/Util.js CHANGED
@@ -111,17 +111,5 @@ class Util extends null {
111
111
  static async delay(ms) {
112
112
  return new Promise((res) => setTimeout(res, ms));
113
113
  }
114
- static joinedMembers(oldClan, newClan) {
115
- const oldMembers = oldClan.members.map((member) => member.tag);
116
- return newClan.members.filter((member) => {
117
- return !oldMembers.includes(member.tag);
118
- });
119
- }
120
- static leftMembers(oldClan, newClan) {
121
- const newMembers = newClan.members.map((member) => member.tag);
122
- return oldClan.members.filter((member) => {
123
- return !newMembers.includes(member.tag);
124
- });
125
- }
126
114
  }
127
115
  exports.Util = Util;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clashofclans.js",
3
- "version": "2.7.0-dev.31f642e",
3
+ "version": "2.7.0-dev.a33ae73",
4
4
  "description": "JavaScript library for interacting with the Clash of Clans API",
5
5
  "author": "SUVAJIT <suvajit.me@gmail.com>",
6
6
  "license": "MIT",