@jnode/discord 1.0.13 → 1.0.15

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/package.json +1 -1
  2. package/src/client.js +7 -7
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jnode/discord",
3
- "version": "1.0.13",
3
+ "version": "1.0.15",
4
4
  "description": "Simple Discord API package for Node.js.",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
package/src/client.js CHANGED
@@ -36,7 +36,7 @@ class DiscordClient {
36
36
  this.apiThrowError = options.apiThrowError ?? true; //throw error while api status code is not 2xx
37
37
 
38
38
  //client gateway options
39
- this.gatewayIntents = options.gatewayIntents ?? 0b11111111111111111000110011;
39
+ this.gatewayIntents = options.gatewayIntents ?? 0b11001100011111111111111111;
40
40
  this.gatewayUrl = options.gatewayUrl ?? 'wss://gateway.discord.gg';
41
41
  this.gatewayOriginalUrl = this.gatewayUrl;
42
42
  this.gatewayReconnectDelay = options.gatewayReconnectDelay ?? 5000; //less than 0 to disable auto reconnect
@@ -60,13 +60,13 @@ class DiscordClient {
60
60
  'Content-Type': (body !== undefined) ? 'application/json' : null
61
61
  }, (body !== undefined) ? JSON.stringify(body) : undefined); //make an request
62
62
 
63
- if ((res.code === 429) && this.apiAutoRetry) { //retry if recieved 429
63
+ if ((res.statusCode === 429) && this.apiAutoRetry) { //retry if recieved 429
64
64
  await delay(res.json().retry_after);
65
65
  return this.apiRequest(method, path, body);
66
66
  }
67
67
 
68
- if (((res.code > 299) || (res.code < 200)) && this.apiThrowError) { //throw error if not 2xx
69
- throw new DiscordAPIError(res.code, res.json() ?? res.text(), res.headers);
68
+ if (((res.statusCode > 299) || (res.statusCode < 200)) && this.apiThrowError) { //throw error if not 2xx
69
+ throw new DiscordAPIError(res.statusCode, res.json() ?? res.text(), res.headers);
70
70
  }
71
71
 
72
72
  return res;
@@ -97,13 +97,13 @@ class DiscordClient {
97
97
  'User-Agent': 'DiscordBot'
98
98
  }, parts); //make an request
99
99
 
100
- if ((res.code === 429) && this.apiAutoRetry) { //retry if recieved 429
100
+ if ((res.statusCode === 429) && this.apiAutoRetry) { //retry if recieved 429
101
101
  await delay(res.json().retry_after);
102
102
  return this.apiRequest(method, path, body, multipart, true);
103
103
  }
104
104
 
105
- if (((res.code > 299) || (res.code < 200)) && this.apiThrowError) { //throw error if not 2xx
106
- throw new DiscordAPIError(res.code, res.json() ?? res.text(), res.headers);
105
+ if (((res.statusCode > 299) || (res.statusCode < 200)) && this.apiThrowError) { //throw error if not 2xx
106
+ throw new DiscordAPIError(res.statusCode, res.json() ?? res.text(), res.headers);
107
107
  }
108
108
 
109
109
  return res;