clashofclans.js 2.7.0-dev.d6e4abf → 2.8.0-dev.73631cc
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,11 +2,19 @@
|
|
|
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.8.0 (2022-07-22)
|
|
6
|
+
|
|
7
|
+
### Features
|
|
8
|
+
|
|
9
|
+
- Better Throttler with JS generator function. ([#111](https://github.com/clashperk/clashofclans.js/pull/111))
|
|
10
|
+
- Updated raw data from game files. ([#111](https://github.com/clashperk/clashofclans.js/pull/111))
|
|
11
|
+
- New method Util#parseArmyLink has been added. ([#110](https://github.com/clashperk/clashofclans.js/pull/110))
|
|
12
|
+
|
|
5
13
|
## 2.7.0 (2022-05-22)
|
|
6
14
|
|
|
7
15
|
### Features
|
|
8
16
|
|
|
9
|
-
-
|
|
17
|
+
- Some useful QOL methods have been added. ([#106](https://github.com/clashperk/clashofclans.js/pull/106))
|
|
10
18
|
|
|
11
19
|
## 2.6.1 (2022-02-03)
|
|
12
20
|
|
package/dist/client/Client.d.ts
CHANGED
|
@@ -74,8 +74,10 @@ export declare class Client extends EventEmitter {
|
|
|
74
74
|
clanTag: string;
|
|
75
75
|
round?: keyof typeof CWL_ROUNDS;
|
|
76
76
|
}, options?: OverrideOptions): Promise<ClanWar | null>;
|
|
77
|
-
|
|
78
|
-
|
|
77
|
+
/** Returns active wars (last 2) of the CWL group. */
|
|
78
|
+
getLeagueWars(clanTag: string, options?: OverrideOptions): Promise<ClanWar[]>;
|
|
79
|
+
/** Returns active wars (last 2 for CWL) of the clan. */
|
|
80
|
+
getWars(clanTag: string, options?: OverrideOptions): Promise<ClanWar[]>;
|
|
79
81
|
/** Get info about clan war league. */
|
|
80
82
|
getClanWarLeagueGroup(clanTag: string, options?: OverrideOptions): Promise<ClanWarLeagueGroup>;
|
|
81
83
|
/** Get info about a CWL round by WarTag. */
|
package/dist/client/Client.js
CHANGED
|
@@ -133,18 +133,19 @@ class Client extends events_1.EventEmitter {
|
|
|
133
133
|
}
|
|
134
134
|
return wars.find((war) => war.clan.tag === args.clanTag && war.state === state) ?? wars.at(0) ?? null;
|
|
135
135
|
}
|
|
136
|
-
|
|
136
|
+
/** Returns active wars (last 2) of the CWL group. */
|
|
137
|
+
async getLeagueWars(clanTag, options) {
|
|
137
138
|
const data = await this.getClanWarLeagueGroup(clanTag, options);
|
|
138
|
-
|
|
139
|
-
return data._getCurrentWars(clanTag, options);
|
|
139
|
+
return data.getCurrentWars(clanTag, options);
|
|
140
140
|
}
|
|
141
|
-
|
|
141
|
+
/** Returns active wars (last 2 for CWL) of the clan. */
|
|
142
|
+
async getWars(clanTag, options) {
|
|
142
143
|
const date = new Date().getUTCDate();
|
|
143
144
|
if (!(date >= 1 && date <= 10)) {
|
|
144
145
|
return [await this.getClanWar(clanTag, options)];
|
|
145
146
|
}
|
|
146
147
|
try {
|
|
147
|
-
return this.
|
|
148
|
+
return this.getLeagueWars(clanTag, options);
|
|
148
149
|
}
|
|
149
150
|
catch (e) {
|
|
150
151
|
if (e instanceof HTTPError_1.HTTPError && [404].includes(e.status)) {
|
|
@@ -237,8 +237,7 @@ class EventManager {
|
|
|
237
237
|
async runWarUpdate(tag) {
|
|
238
238
|
if (this._inMaintenance)
|
|
239
239
|
return null;
|
|
240
|
-
|
|
241
|
-
const clanWars = await this.client._getClanWars(tag).catch(() => null);
|
|
240
|
+
const clanWars = await this.client.getWars(tag).catch(() => null);
|
|
242
241
|
if (!clanWars?.length)
|
|
243
242
|
return null;
|
|
244
243
|
clanWars.forEach(async (war, index) => {
|
|
@@ -62,7 +62,8 @@ export declare class ClanWarLeagueGroup {
|
|
|
62
62
|
* @param options Override options for the request.
|
|
63
63
|
*/
|
|
64
64
|
getWars(clanTag?: string, options?: OverrideOptions): Promise<ClanWar[]>;
|
|
65
|
-
|
|
65
|
+
/** Returns active wars (last 2) of the CWL group. */
|
|
66
|
+
getCurrentWars(clanTag: string, options?: OverrideOptions): Promise<ClanWar[]>;
|
|
66
67
|
/** Returns the index of the round for this specified warTag. */
|
|
67
68
|
getRoundIndex(warTag: string): number | null;
|
|
68
69
|
}
|
|
@@ -75,7 +75,8 @@ class ClanWarLeagueGroup {
|
|
|
75
75
|
.map((res) => res.value)
|
|
76
76
|
.filter((war) => (clanTag ? war.clan.tag === clanTag : true));
|
|
77
77
|
}
|
|
78
|
-
|
|
78
|
+
/** Returns active wars (last 2) of the CWL group. */
|
|
79
|
+
async getCurrentWars(clanTag, options) {
|
|
79
80
|
const rounds = this.rounds.filter((round) => !round.warTags.includes('#0'));
|
|
80
81
|
if (!rounds.length)
|
|
81
82
|
return [];
|
package/package.json
CHANGED