catto.js 0.7.2 → 0.7.4

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.
Files changed (2) hide show
  1. package/Bot.js +5 -7
  2. package/package.json +2 -2
package/Bot.js CHANGED
@@ -43,7 +43,7 @@ module.exports = class extends EventEmitter {
43
43
  }
44
44
  this.client = new Discord.Client(opts);
45
45
  if (this.options.sharded) {
46
- this.cluster = new ClusterClient(this.client);
46
+ this.client.cluster = new ClusterClient(this.client);
47
47
  }
48
48
  }
49
49
  this.currentStatus = void 0;
@@ -175,16 +175,11 @@ module.exports = class extends EventEmitter {
175
175
  });
176
176
  }
177
177
  this.emit("running", { Discord });
178
- });
179
- this.cluster.on("ready", () => {
180
178
  if (this.cluster.id == (this.cluster.count - 1)) {
181
179
  this.cluster.broadcastEval(client => client.emit("_runningFull"));
182
180
  this.emit("runningFullLast", { Discord });
183
181
  }
184
182
  });
185
- this.client.on("_runningFull", () => {
186
- this.emit("runningFull", { Discord });
187
- });
188
183
  this.client.on("interactionCreate", this.handleInteractionCreate.bind(this));
189
184
  this.client.on("messageCreate", message => {
190
185
  message.author = new User(message.author, this);
@@ -226,12 +221,15 @@ module.exports = class extends EventEmitter {
226
221
  this.emit("botDelete", guild);
227
222
  });
228
223
  }
224
+ get cluster() {
225
+ return this.client.cluster;
226
+ }
229
227
  get servers() {
230
228
  var r = Array.from(this.client.guilds.cache.values());
231
229
  r.count = r.length;
232
230
  if (this.options.sharded) {
233
231
  return new Promise(async res => {
234
- r.count = (await this.client.cluster.broadcastEval("this.guilds.cache.size")).reduce((a, b) => a + b, 0);
232
+ r.count = (await this.cluster.broadcastEval("this.guilds.cache.size")).reduce((a, b) => a + b, 0);
235
233
  res(r);
236
234
  });
237
235
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "catto.js",
3
- "version": "0.7.2",
3
+ "version": "0.7.4",
4
4
  "description": "Universal module for everything.",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -62,4 +62,4 @@
62
62
  },
63
63
  "tough-cookie": "next"
64
64
  }
65
- }
65
+ }