catto.js 0.9.5 → 0.9.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 +8 -5
  2. package/package.json +1 -1
  3. package/request.js +2 -1
package/Bot.js CHANGED
@@ -1,6 +1,7 @@
1
1
  var nacl = require("tweetnacl");
2
2
  var events = require("events");
3
3
  var Discord = require("discord.js");
4
+ var djsws = require("@discordjs/ws");
4
5
  var { ClusterManager, ClusterClient, getInfo, ReClusterManager } = require("discord-hybrid-sharding");
5
6
  var path = require("path");
6
7
  var User = require("./User");
@@ -20,21 +21,23 @@ module.exports = class extends EventEmitter {
20
21
  "buttonListener": !0,
21
22
  "publicKey": "",
22
23
  "debug": !1,
24
+ "mobile": !1,
23
25
  "sharded": !1
24
26
  }, options || {});
25
27
  if (client) {
26
28
  this.client = client;
27
29
  } else {
30
+ djsws.DefaultWebSocketManagerOptions.identifyProperties.device = "catto.js";
31
+ if (this.options.mobile) {
32
+ djsws.DefaultWebSocketManagerOptions.identifyProperties.browser = "Discord Android";
33
+ } else {
34
+ djsws.DefaultWebSocketManagerOptions.identifyProperties.browser = "catto.js";
35
+ }
28
36
  var opts = {
29
37
  "intents": new Discord.IntentsBitField(this.options.intents),
30
38
  "partials": [Discord.Partials.Channel, Discord.Partials.GuildMember, Discord.Partials.GuildScheduledEvent, Discord.Partials.Message, Discord.Partials.Reaction, Discord.Partials.ThreadMember, Discord.Partials.User],
31
39
  "rest": {
32
40
  "version": this.options.apiv
33
- },
34
- "ws": {
35
- "properties": (this.options.mobile ? {
36
- "browser": "Discord Android"
37
- } : {})
38
41
  }
39
42
  };
40
43
  if (this.options.sharded) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "catto.js",
3
- "version": "0.9.5",
3
+ "version": "0.9.7",
4
4
  "description": "Universal module for everything.",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/request.js CHANGED
@@ -12,8 +12,9 @@ function wrap(method, options) {
12
12
  var options2 = Object.assign({}, options);
13
13
  var url = options2.url;
14
14
  delete options2.url;
15
+ options2.method = method;
15
16
  return new Promise((res, rej) => {
16
- request[method](url, options2).then(response => {
17
+ fetch(url, options2).then(response => {
17
18
  response.text().then(body => {
18
19
  try {
19
20
  body = JSON.parse(body);