catto.js 1.1.4 → 1.1.6

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 (3) hide show
  1. package/Bot.js +5 -1
  2. package/User.js +10 -3
  3. package/package.json +4 -4
package/Bot.js CHANGED
@@ -61,7 +61,7 @@ module.exports = class extends EventEmitter {
61
61
  if (this.options.debug) {
62
62
  this.client.on("debug", console.log);
63
63
  }
64
- this.client.on("ready", () => {
64
+ this.client.on("ready", async () => {
65
65
  var gcmds = [];
66
66
  var scmds = [];
67
67
  for (var cmd of this.slashCommands.values()) {
@@ -225,6 +225,10 @@ module.exports = class extends EventEmitter {
225
225
  }
226
226
  }
227
227
  if (this.options.slashListener) {
228
+ var entryPoint = (await this.client.rest.get(`/applications/${this.client.application.id}/commands`)).find(slash => slash.type == 4);
229
+ if (entryPoint) {
230
+ gcmds.unshift(entryPoint);
231
+ }
228
232
  this.client.rest.put(`/applications/${this.client.application.id}/commands`, {
229
233
  "body": gcmds
230
234
  });
package/User.js CHANGED
@@ -1,7 +1,10 @@
1
1
  var request = require("./request");
2
2
  var Application = require("./Application");
3
- module.exports = class {
3
+ class User {
4
4
  constructor(options, bot) {
5
+ if (options instanceof User) {
6
+ options = options.options;
7
+ }
5
8
  if (options.global_name) {
6
9
  options.globalName = options.global_name;
7
10
  }
@@ -69,8 +72,10 @@ module.exports = class {
69
72
  avataru = `https://cdn.discordapp.com/avatars/${this.id}/${avataru}.gif?size=4096`;
70
73
  } else if (avataru) {
71
74
  avataru = `https://cdn.discordapp.com/avatars/${this.id}/${avataru}.webp?size=4096`;
72
- } else {
75
+ } else if (this.discrim) {
73
76
  avataru = `https://cdn.discordapp.com/embed/avatars/${(parseInt(this.discrim) % 5).toString()}.png`;
77
+ } else {
78
+ avataru = `https://cdn.discordapp.com/embed/avatars/${(parseInt((BigInt(this.id) >> 22n).toString()) % 6).toString()}.png`;
74
79
  }
75
80
  return avataru;
76
81
  }
@@ -245,4 +250,6 @@ module.exports = class {
245
250
  })).body);
246
251
  }
247
252
  }
248
- };
253
+ }
254
+
255
+ module.exports = User;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "catto.js",
3
- "version": "1.1.4",
3
+ "version": "1.1.6",
4
4
  "description": "Universal module for everything.",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -38,9 +38,6 @@
38
38
  "url": "https://github.com/BoryaGames/catto.js/issues"
39
39
  },
40
40
  "homepage": "https://github.com/BoryaGames/catto.js#readme",
41
- "devDependencies": {
42
- "jest": "^29.7.0"
43
- },
44
41
  "dependencies": {
45
42
  "body-parser": "^1.20.2",
46
43
  "discord-hybrid-sharding": "^2.2.0",
@@ -53,5 +50,8 @@
53
50
  "session-file-store": "^1.5.0",
54
51
  "telegraf": "^4.16.3",
55
52
  "tweetnacl": "^1.0.3"
53
+ },
54
+ "devDependencies": {
55
+ "jest": "^29.7.0"
56
56
  }
57
57
  }