clashofclans.js 2.8.2 → 3.0.0-dev.29c3270

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.
@@ -1,79 +1,85 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.EventManager = void 0;
3
+ exports.PollingClient = void 0;
4
4
  const HTTPError_1 = require("../rest/HTTPError");
5
5
  const Constants_1 = require("../util/Constants");
6
- const Util_1 = require("../util/Util");
7
- /** Represents Event Manager of the {@link Client}. */
8
- class EventManager {
9
- constructor(client) {
10
- this.client = client;
6
+ const Client_1 = require("./Client");
7
+ /**
8
+ * Represents Clash of Clans Polling Event Client.
9
+ * ```js
10
+ * const { PollingClient } = require('clashofclans.js');
11
+ * const client = new PollingClient({ keys: ['***'] });
12
+ * ```
13
+ */
14
+ class PollingClient extends Client_1.Client {
15
+ constructor(options) {
16
+ super(options);
11
17
  this._clanTags = new Set();
12
18
  this._playerTags = new Set();
13
19
  this._warTags = new Set();
14
20
  this._clans = new Map();
15
21
  this._players = new Map();
16
22
  this._wars = new Map();
17
- this._events = {
23
+ this._pollingEvents = {
18
24
  clans: [],
19
25
  wars: [],
20
26
  players: []
21
27
  };
22
- this._inMaintenance = Boolean(false);
28
+ this.inMaintenance = Boolean(false);
23
29
  this._maintenanceStartTime = null;
24
30
  }
25
- /** Initialize the Event Manager to start pulling. */
31
+ /** Initialize the PollingEvent Manager to start pulling the data by polling api. */
26
32
  async init() {
27
33
  this.seasonEndHandler();
28
34
  this.maintenanceHandler();
29
35
  this.clanUpdateHandler();
30
36
  this.playerUpdateHandler();
31
37
  this.warUpdateHandler();
32
- return Promise.resolve(this.client.eventNames());
38
+ return Promise.resolve(this.eventNames());
33
39
  }
34
- /** Add clan tags to clan events. */
40
+ /** Add clan tags to clan polling events. */
35
41
  addClans(tags) {
36
42
  for (const tag of Array.isArray(tags) ? tags : [tags]) {
37
- this._clanTags.add(this.client.util.formatTag(tag));
43
+ this._clanTags.add(this.util.formatTag(tag));
38
44
  }
39
45
  return this;
40
46
  }
41
- /** Delete clan tags from clan events. */
47
+ /** Delete clan tags from clan polling events. */
42
48
  deleteClans(tags) {
43
49
  for (const tag of Array.isArray(tags) ? tags : [tags]) {
44
- const key = this.client.util.formatTag(tag);
50
+ const key = this.util.formatTag(tag);
45
51
  this._clans.delete(key);
46
52
  this._clanTags.delete(key);
47
53
  }
48
54
  return this;
49
55
  }
50
- /** Add player tags for player events. */
56
+ /** Add player tags for player polling events. */
51
57
  addPlayers(tags) {
52
58
  for (const tag of Array.isArray(tags) ? tags : [tags]) {
53
- this._playerTags.add(this.client.util.formatTag(tag));
59
+ this._playerTags.add(this.util.formatTag(tag));
54
60
  }
55
61
  return this;
56
62
  }
57
- /** Delete player tags from player events. */
63
+ /** Delete player tags from player polling events. */
58
64
  deletePlayers(tags) {
59
65
  for (const tag of Array.isArray(tags) ? tags : [tags]) {
60
- const key = this.client.util.formatTag(tag);
66
+ const key = this.util.formatTag(tag);
61
67
  this._players.delete(key);
62
68
  this._playerTags.delete(key);
63
69
  }
64
70
  return this;
65
71
  }
66
- /** Add clan tags for war events. */
72
+ /** Add clan tags for war polling events. */
67
73
  addWars(tags) {
68
74
  for (const tag of Array.isArray(tags) ? tags : [tags]) {
69
- this._warTags.add(this.client.util.formatTag(tag));
75
+ this._warTags.add(this.util.formatTag(tag));
70
76
  }
71
77
  return this;
72
78
  }
73
- /** Delete clan tags from war events. */
79
+ /** Delete clan tags from war polling events. */
74
80
  deleteWars(tags) {
75
81
  for (const tag of Array.isArray(tags) ? tags : [tags]) {
76
- const key = this.client.util.formatTag(tag);
82
+ const key = this.util.formatTag(tag);
77
83
  this._wars.delete(`${key}:${1}`);
78
84
  this._wars.delete(`${key}:${2}`);
79
85
  this._warTags.delete(key);
@@ -81,15 +87,15 @@ class EventManager {
81
87
  return this;
82
88
  }
83
89
  /**
84
- * Set your own custom clan event.
90
+ * Set your own custom clan polling event.
85
91
  *
86
- * In order to emit the custom event, you must have this filter function that returns a boolean.
92
+ * In order to emit the custom polling event, you must have this filter function that returns a boolean.
87
93
  *
88
94
  * @example
89
95
  * ```js
90
- * client.events.addClans(['#2PP', '#8QU8J9LP']);
96
+ * client.addClans(['#2PP', '#8QU8J9LP']);
91
97
  *
92
- * client.events.setClanEvent({
98
+ * client.setClanEvent({
93
99
  * name: 'clanMemberUpdate',
94
100
  * filter: (oldClan, newClan) => {
95
101
  * return oldClan.memberCount !== newClan.memberCount;
@@ -101,7 +107,7 @@ class EventManager {
101
107
  * });
102
108
  *
103
109
  * (async function () {
104
- * await client.events.init();
110
+ * await client.init();
105
111
  * })();
106
112
  * ```
107
113
  * @returns
@@ -111,7 +117,7 @@ class EventManager {
111
117
  throw new Error('Event name is required.');
112
118
  if (typeof event.filter !== 'function')
113
119
  throw new Error('Filter function is required.');
114
- this._events.clans.push(event);
120
+ this._pollingEvents.clans.push(event);
115
121
  return this;
116
122
  }
117
123
  /**
@@ -124,7 +130,7 @@ class EventManager {
124
130
  throw new Error('Event name is required.');
125
131
  if (typeof event.filter !== 'function')
126
132
  throw new Error('Filter function is required.');
127
- this._events.wars.push(event);
133
+ this._pollingEvents.wars.push(event);
128
134
  return this;
129
135
  }
130
136
  /**
@@ -137,107 +143,107 @@ class EventManager {
137
143
  throw new Error('Event name is required.');
138
144
  if (typeof event.filter !== 'function')
139
145
  throw new Error('Filter function is required.');
140
- this._events.players.push(event);
146
+ this._pollingEvents.players.push(event);
141
147
  return this;
142
148
  }
143
149
  async maintenanceHandler() {
144
150
  setTimeout(this.maintenanceHandler.bind(this), 10000).unref();
145
151
  try {
146
- const res = await this.client.rest.getClans({ maxMembers: Math.floor(Math.random() * 40) + 10, limit: 1 });
147
- if (res.status === 200 && this._inMaintenance) {
148
- this._inMaintenance = Boolean(false);
152
+ const res = await this.rest.getClans({ maxMembers: Math.floor(Math.random() * 40) + 10, limit: 1 });
153
+ if (res.status === 200 && this.inMaintenance) {
154
+ this.inMaintenance = Boolean(false);
149
155
  const duration = Date.now() - this._maintenanceStartTime.getTime();
150
156
  this._maintenanceStartTime = null;
151
- this.client.emit(Constants_1.EVENTS.MAINTENANCE_END, duration);
157
+ this.emit(Constants_1.PollingEvents.MaintenanceEnd, duration);
152
158
  }
153
159
  }
154
160
  catch (error) {
155
- if (error instanceof HTTPError_1.HTTPError && error.status === 503 && !this._inMaintenance) {
156
- this._inMaintenance = Boolean(true);
161
+ if (error instanceof HTTPError_1.HTTPError && error.status === 503 && !this.inMaintenance) {
162
+ this.inMaintenance = Boolean(true);
157
163
  this._maintenanceStartTime = new Date();
158
- this.client.emit(Constants_1.EVENTS.MAINTENANCE_START);
164
+ this.emit(Constants_1.PollingEvents.MaintenanceStart);
159
165
  }
160
166
  }
161
167
  }
162
168
  seasonEndHandler() {
163
- const end = Util_1.Util.getSeasonEndTime().getTime() - Date.now();
169
+ const end = this.util.getSeasonEndTime().getTime() - Date.now();
164
170
  // Why this? setTimeout can be up to 24.8 days or 2147483647ms [(2^31 - 1) Max 32bit Integer]
165
171
  if (end > 24 * 60 * 60 * 1000) {
166
172
  setTimeout(this.seasonEndHandler.bind(this), 60 * 60 * 1000);
167
173
  }
168
174
  else if (end > 0) {
169
175
  setTimeout(() => {
170
- this.client.emit(Constants_1.EVENTS.NEW_SEASON_START, Util_1.Util.getSeasonId());
176
+ this.emit(Constants_1.PollingEvents.NewSeasonStart, this.util.getSeasonId());
171
177
  }, end + 100).unref();
172
178
  }
173
179
  }
174
180
  async clanUpdateHandler() {
175
- this.client.emit(Constants_1.EVENTS.CLAN_LOOP_START);
181
+ this.emit(Constants_1.PollingEvents.ClanLoopStart);
176
182
  for (const tag of this._clanTags)
177
183
  await this.runClanUpdate(tag);
178
- this.client.emit(Constants_1.EVENTS.CLAN_LOOP_END);
184
+ this.emit(Constants_1.PollingEvents.ClanLoopEnd);
179
185
  setTimeout(this.clanUpdateHandler.bind(this), 10000);
180
186
  }
181
187
  async playerUpdateHandler() {
182
- this.client.emit(Constants_1.EVENTS.PLAYER_LOOP_START);
188
+ this.emit(Constants_1.PollingEvents.PlayerLoopStart);
183
189
  for (const tag of this._playerTags)
184
190
  await this.runPlayerUpdate(tag);
185
- this.client.emit(Constants_1.EVENTS.PLAYER_LOOP_END);
191
+ this.emit(Constants_1.PollingEvents.PlayerLoopEnd);
186
192
  setTimeout(this.playerUpdateHandler.bind(this), 10000);
187
193
  }
188
194
  async warUpdateHandler() {
189
- this.client.emit(Constants_1.EVENTS.WAR_LOOP_START);
195
+ this.emit(Constants_1.PollingEvents.WarLoopStart);
190
196
  for (const tag of this._warTags)
191
197
  await this.runWarUpdate(tag);
192
- this.client.emit(Constants_1.EVENTS.WAR_LOOP_END);
198
+ this.emit(Constants_1.PollingEvents.WarLoopEnd);
193
199
  setTimeout(this.warUpdateHandler.bind(this), 10000);
194
200
  }
195
201
  async runClanUpdate(tag) {
196
- if (this._inMaintenance)
202
+ if (this.inMaintenance)
197
203
  return null;
198
- const clan = await this.client.getClan(tag).catch(() => null);
204
+ const clan = await this.getClan(tag).catch(() => null);
199
205
  if (!clan)
200
206
  return null;
201
207
  const cached = this._clans.get(clan.tag);
202
208
  if (!cached)
203
209
  return this._clans.set(clan.tag, clan);
204
- for (const { name, filter } of this._events.clans) {
210
+ for (const { name, filter } of this._pollingEvents.clans) {
205
211
  try {
206
212
  if (!(await filter(cached, clan)))
207
213
  continue;
208
- this.client.emit(name, cached, clan);
214
+ this.emit(name, cached, clan);
209
215
  }
210
216
  catch (error) {
211
- this.client.emit(Constants_1.EVENTS.ERROR, error);
217
+ this.emit(Constants_1.PollingEvents.Error, error);
212
218
  }
213
219
  }
214
220
  return this._clans.set(clan.tag, clan);
215
221
  }
216
222
  async runPlayerUpdate(tag) {
217
- if (this._inMaintenance)
223
+ if (this.inMaintenance)
218
224
  return null;
219
- const player = await this.client.getPlayer(tag).catch(() => null);
225
+ const player = await this.getPlayer(tag).catch(() => null);
220
226
  if (!player)
221
227
  return null;
222
228
  const cached = this._players.get(player.tag);
223
229
  if (!cached)
224
230
  return this._players.set(player.tag, player);
225
- for (const { name, filter } of this._events.players) {
231
+ for (const { name, filter } of this._pollingEvents.players) {
226
232
  try {
227
233
  if (!(await filter(cached, player)))
228
234
  continue;
229
- this.client.emit(name, cached, player);
235
+ this.emit(name, cached, player);
230
236
  }
231
237
  catch (error) {
232
- this.client.emit(Constants_1.EVENTS.ERROR, error);
238
+ this.emit(Constants_1.PollingEvents.Error, error);
233
239
  }
234
240
  }
235
241
  return this._players.set(player.tag, player);
236
242
  }
237
243
  async runWarUpdate(tag) {
238
- if (this._inMaintenance)
244
+ if (this.inMaintenance)
239
245
  return null;
240
- const clanWars = await this.client.getWars(tag).catch(() => null);
246
+ const clanWars = await this.getWars(tag).catch(() => null);
241
247
  if (!clanWars?.length)
242
248
  return null;
243
249
  clanWars.forEach(async (war, index) => {
@@ -245,28 +251,28 @@ class EventManager {
245
251
  const cached = this._wars.get(key);
246
252
  if (!cached)
247
253
  return this._wars.set(key, war);
248
- for (const { name, filter } of this._events.wars) {
254
+ for (const { name, filter } of this._pollingEvents.wars) {
249
255
  try {
250
256
  if (!(await filter(cached, war)))
251
257
  continue;
252
- this.client.emit(name, cached, war);
258
+ this.emit(name, cached, war);
253
259
  }
254
260
  catch (error) {
255
- this.client.emit(Constants_1.EVENTS.ERROR, error);
261
+ this.emit(Constants_1.PollingEvents.Error, error);
256
262
  }
257
263
  }
258
264
  // check for war end
259
265
  if (index === 1 && cached.warTag !== war.warTag) {
260
- const data = await this.client.getLeagueWar({ clanTag: tag, round: 'PREVIOUS_ROUND' }).catch(() => null);
266
+ const data = await this.getLeagueWar({ clanTag: tag, round: 'PreviousRound' }).catch(() => null);
261
267
  if (data && data.warTag === cached.warTag) {
262
- for (const { name, filter } of this._events.wars) {
268
+ for (const { name, filter } of this._pollingEvents.wars) {
263
269
  try {
264
270
  if (!(await filter(cached, data)))
265
271
  continue;
266
- this.client.emit(name, cached, data);
272
+ this.emit(name, cached, data);
267
273
  }
268
274
  catch (error) {
269
- this.client.emit(Constants_1.EVENTS.ERROR, error);
275
+ this.emit(Constants_1.PollingEvents.Error, error);
270
276
  }
271
277
  }
272
278
  }
@@ -275,4 +281,4 @@ class EventManager {
275
281
  });
276
282
  }
277
283
  }
278
- exports.EventManager = EventManager;
284
+ exports.PollingClient = PollingClient;
package/dist/index.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  export * from './client/Client';
2
+ export * from './client/PollingClient';
2
3
  export * from './rest/RESTManager';
3
4
  export * from './rest/RequestHandler';
4
5
  export * from './rest/HTTPError';
5
- export * from './client/EventManager';
6
6
  export * from './rest/Throttler';
7
7
  export * from './util/Util';
8
8
  export * from './struct';
package/dist/index.js CHANGED
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
@@ -11,10 +15,10 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
11
15
  };
12
16
  Object.defineProperty(exports, "__esModule", { value: true });
13
17
  __exportStar(require("./client/Client"), exports);
18
+ __exportStar(require("./client/PollingClient"), exports);
14
19
  __exportStar(require("./rest/RESTManager"), exports);
15
20
  __exportStar(require("./rest/RequestHandler"), exports);
16
21
  __exportStar(require("./rest/HTTPError"), exports);
17
- __exportStar(require("./client/EventManager"), exports);
18
22
  __exportStar(require("./rest/Throttler"), exports);
19
23
  __exportStar(require("./util/Util"), exports);
20
24
  __exportStar(require("./struct"), exports);
package/dist/index.mjs CHANGED
@@ -1,12 +1,12 @@
1
1
  import mod from "./index.js";
2
2
 
3
3
  export default mod;
4
- export const API_BASE_URL = mod.API_BASE_URL;
4
+ export const APIBaseURL = mod.APIBaseURL;
5
5
  export const Achievement = mod.Achievement;
6
- export const BUILDER_TROOPS = mod.BUILDER_TROOPS;
7
6
  export const Badge = mod.Badge;
8
7
  export const BatchThrottler = mod.BatchThrottler;
9
- export const CWL_ROUNDS = mod.CWL_ROUNDS;
8
+ export const BuilderTroops = mod.BuilderTroops;
9
+ export const CWLRounds = mod.CWLRounds;
10
10
  export const CacheStore = mod.CacheStore;
11
11
  export const ChatLanguage = mod.ChatLanguage;
12
12
  export const Clan = mod.Clan;
@@ -20,48 +20,50 @@ export const ClanWarLeagueRound = mod.ClanWarLeagueRound;
20
20
  export const ClanWarLog = mod.ClanWarLog;
21
21
  export const ClanWarMember = mod.ClanWarMember;
22
22
  export const Client = mod.Client;
23
- export const DARK_ELIXIR_SPELLS = mod.DARK_ELIXIR_SPELLS;
24
- export const DARK_ELIXIR_TROOPS = mod.DARK_ELIXIR_TROOPS;
25
- export const DEV_SITE_API_BASE_URL = mod.DEV_SITE_API_BASE_URL;
26
- export const ELIXIR_SPELLS = mod.ELIXIR_SPELLS;
27
- export const ELIXIR_TROOPS = mod.ELIXIR_TROOPS;
28
- export const EVENTS = mod.EVENTS;
29
- export const EventManager = mod.EventManager;
30
- export const FRIENDLY_WAR_PREPARATION_TIMES = mod.FRIENDLY_WAR_PREPARATION_TIMES;
23
+ export const ClientEvents = mod.ClientEvents;
24
+ export const DarkElixirSpells = mod.DarkElixirSpells;
25
+ export const DarkElixirTroops = mod.DarkElixirTroops;
26
+ export const DevSiteAPIBaseURL = mod.DevSiteAPIBaseURL;
27
+ export const ElixirSpells = mod.ElixirSpells;
28
+ export const ElixirTroops = mod.ElixirTroops;
29
+ export const FriendlyWarPreparationTimes = mod.FriendlyWarPreparationTimes;
31
30
  export const GoldPassSeason = mod.GoldPassSeason;
32
- export const HEROES = mod.HEROES;
33
- export const HERO_PETS = mod.HERO_PETS;
34
- export const HOME_TROOPS = mod.HOME_TROOPS;
35
31
  export const HTTPError = mod.HTTPError;
36
32
  export const Hero = mod.Hero;
33
+ export const HeroPets = mod.HeroPets;
34
+ export const Heroes = mod.Heroes;
35
+ export const HomeTroops = mod.HomeTroops;
37
36
  export const Icon = mod.Icon;
38
- export const LEAGUES = mod.LEAGUES;
39
- export const LEGEND_LEAGUE_ID = mod.LEGEND_LEAGUE_ID;
40
37
  export const Label = mod.Label;
41
38
  export const League = mod.League;
39
+ export const Leagues = mod.Leagues;
40
+ export const LegendLeagueId = mod.LegendLeagueId;
42
41
  export const LegendStatistics = mod.LegendStatistics;
43
42
  export const Location = mod.Location;
44
43
  export const NotInWarError = mod.NotInWarError;
45
44
  export const Player = mod.Player;
46
45
  export const PlayerClan = mod.PlayerClan;
46
+ export const PollingClient = mod.PollingClient;
47
+ export const PollingEvents = mod.PollingEvents;
47
48
  export const PrivateWarLogError = mod.PrivateWarLogError;
48
49
  export const QueueThrottler = mod.QueueThrottler;
49
- export const RAW_DATA = mod.RAW_DATA;
50
50
  export const RESTManager = mod.RESTManager;
51
51
  export const RankedClan = mod.RankedClan;
52
52
  export const RankedPlayer = mod.RankedPlayer;
53
+ export const RawData = mod.RawData;
53
54
  export const RequestHandler = mod.RequestHandler;
54
- export const SIEGE_MACHINES = mod.SIEGE_MACHINES;
55
- export const SPELLS = mod.SPELLS;
56
- export const SUPER_TROOPS = mod.SUPER_TROOPS;
55
+ export const RestEvents = mod.RestEvents;
57
56
  export const Season = mod.Season;
58
57
  export const SeasonRankedPlayer = mod.SeasonRankedPlayer;
58
+ export const SiegeMachines = mod.SiegeMachines;
59
59
  export const Spell = mod.Spell;
60
+ export const Spells = mod.Spells;
61
+ export const SuperTroops = mod.SuperTroops;
60
62
  export const Troop = mod.Troop;
61
- export const UNRANKED_LEAGUE_DATA = mod.UNRANKED_LEAGUE_DATA;
62
63
  export const Unit = mod.Unit;
64
+ export const UnrankedLeagueData = mod.UnrankedLeagueData;
63
65
  export const Util = mod.Util;
64
- export const WAR_LEAGUES = mod.WAR_LEAGUES;
65
66
  export const WarClan = mod.WarClan;
66
67
  export const WarLeague = mod.WarLeague;
68
+ export const WarLeagues = mod.WarLeagues;
67
69
  export const WarLogClan = mod.WarLogClan;
@@ -1,10 +1,43 @@
1
- import { RequestHandler } from './RequestHandler';
1
+ /// <reference types="node" />
2
+ import { EventEmitter } from 'node:events';
2
3
  import { Util } from '../util/Util';
3
4
  import { APIClan, APIClanList, APIClanMemberList, APIClanRankingList, APIClanVersusRankingList, APIClanWar, APIClanWarLeagueGroup, APIClanWarLog, APIGoldPassSeason, APILabelList, APILeague, APILeagueList, APILeagueSeasonList, APILocation, APILocationList, APIPlayer, APIPlayerRankingList, APIPlayerSeasonRankingList, APIPlayerVersusRankingList, APIVerifyToken, APIWarLeague, APIWarLeagueList, SearchOptions, ClanSearchOptions, RESTOptions, OverrideOptions, LoginOptions } from '../types';
5
+ import { RestEvents } from '../util/Constants';
6
+ import { RequestHandler } from './RequestHandler';
7
+ export interface IRestEvents {
8
+ [RestEvents.Error]: [error: unknown];
9
+ [RestEvents.Debug]: [path: string, status: number, message: string];
10
+ [RestEvents.RateLimited]: [path: string, status: number, message: string];
11
+ }
12
+ export interface RESTManager {
13
+ emit: (<K extends keyof IRestEvents>(event: K, ...args: IRestEvents[K]) => boolean) & (<S extends string | symbol>(event: Exclude<S, keyof IRestEvents>, ...args: any[]) => boolean);
14
+ off: (<K extends keyof IRestEvents>(event: K, listener: (...args: IRestEvents[K]) => void) => this) & (<S extends string | symbol>(event: Exclude<S, keyof IRestEvents>, listener: (...args: any[]) => void) => this);
15
+ on: (<K extends keyof IRestEvents>(event: K, listener: (...args: IRestEvents[K]) => void) => this) & (<S extends string | symbol>(event: Exclude<S, keyof IRestEvents>, listener: (...args: any[]) => void) => this);
16
+ once: (<K extends keyof IRestEvents>(event: K, listener: (...args: IRestEvents[K]) => void) => this) & (<S extends string | symbol>(event: Exclude<S, keyof IRestEvents>, listener: (...args: any[]) => void) => this);
17
+ removeAllListeners: (<K extends keyof IRestEvents>(event?: K) => this) & (<S extends string | symbol>(event?: Exclude<S, keyof IRestEvents>) => this);
18
+ /**
19
+ * Emitted for general debugging information.
20
+ * @public
21
+ * @event
22
+ */
23
+ debug: string;
24
+ /**
25
+ * Emitted when the client encounters an error.
26
+ * @public
27
+ * @event
28
+ */
29
+ error: string;
30
+ /**
31
+ * Emitted when the client is rate limited.
32
+ * @public
33
+ * @event
34
+ */
35
+ rateLimited: string;
36
+ }
4
37
  /** Represents a REST Manager of the client. */
5
- export declare class RESTManager {
38
+ export declare class RESTManager extends EventEmitter {
6
39
  /** Request Handler for the RESTManager. */
7
- handler: RequestHandler;
40
+ requestHandler: RequestHandler;
8
41
  constructor(options?: RESTOptions);
9
42
  /** Contains various general-purpose utility methods. */
10
43
  get util(): typeof Util;