catto.js 1.1.5 → 1.1.7

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/GitHub.js +3 -2
  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/GitHub.js CHANGED
@@ -56,13 +56,14 @@ class GitHub {
56
56
  *
57
57
  * @param {string} file - Path to the file to be written.
58
58
  * @param {(string|object)} value - The data to be written to the file. If it is an object, it will be stringified as a JSON file.
59
+ * @param {boolean} [b64mode=false] - Whetever is data to be written is encoded in base64 or not.
59
60
  *
60
61
  * @returns {boolean} - Returns true if the write was successful.
61
62
  *
62
63
  * @async
63
64
  * @throws {Error} If there is a problem with the API request.
64
65
  */
65
- async write(file, value) {
66
+ async write(file, value, b64mode) {
66
67
  if (typeof value === "object") {
67
68
  value = JSON.stringify(value);
68
69
  }
@@ -74,7 +75,7 @@ class GitHub {
74
75
  "Content-Type": "application/json"
75
76
  },
76
77
  "body": JSON.stringify({
77
- "content": Base64.encode(value),
78
+ "content": (b64mode ? value : Base64.encode(value)),
78
79
  "message": this.options.message,
79
80
  "sha": this.shas[file]
80
81
  })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "catto.js",
3
- "version": "1.1.5",
3
+ "version": "1.1.7",
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
  }