@jnode/discord 1.0.2 → 1.0.3
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.
- package/package.json +1 -1
- package/src/client.js +4 -4
- package/src/gateway.js +3 -3
package/package.json
CHANGED
package/src/client.js
CHANGED
|
@@ -61,12 +61,12 @@ class DiscordClient {
|
|
|
61
61
|
}, (body !== undefined) ? JSON.stringify(body) : undefined); //make an request
|
|
62
62
|
|
|
63
63
|
if ((res.code === 429) && this.apiAutoRetry) { //retry if recieved 429
|
|
64
|
-
await delay(res.json.retry_after);
|
|
64
|
+
await delay(res.json().retry_after);
|
|
65
65
|
return this.apiRequest(method, path, body);
|
|
66
66
|
}
|
|
67
67
|
|
|
68
68
|
if (((res.code > 299) || (res.code < 200)) && this.apiThrowError) { //throw error if not 2xx
|
|
69
|
-
throw new DiscordAPIError(res.code, res.json ?? res.
|
|
69
|
+
throw new DiscordAPIError(res.code, res.json() ?? res.text(), res.headers);
|
|
70
70
|
}
|
|
71
71
|
|
|
72
72
|
return res;
|
|
@@ -97,12 +97,12 @@ class DiscordClient {
|
|
|
97
97
|
}, request.generateMultipartBody(parts)); //make an request
|
|
98
98
|
|
|
99
99
|
if ((res.code === 429) && this.apiAutoRetry) { //retry if recieved 429
|
|
100
|
-
await delay(res.json.retry_after);
|
|
100
|
+
await delay(res.json().retry_after);
|
|
101
101
|
return this.apiRequest(method, path, body, multipart, true);
|
|
102
102
|
}
|
|
103
103
|
|
|
104
104
|
if (((res.code > 299) || (res.code < 200)) && this.apiThrowError) { //throw error if not 2xx
|
|
105
|
-
throw new DiscordAPIError(res.code, res.json ?? res.
|
|
105
|
+
throw new DiscordAPIError(res.code, res.json() ?? res.text(), res.headers);
|
|
106
106
|
}
|
|
107
107
|
|
|
108
108
|
return res;
|
package/src/gateway.js
CHANGED
|
@@ -28,9 +28,9 @@ class DiscordGateway extends EventEmitter {
|
|
|
28
28
|
//get gateway url from api
|
|
29
29
|
async getGatewayUrl() {
|
|
30
30
|
const res = await this.client.apiRequest('GET', '/gateway/bot'); //make an api request
|
|
31
|
-
this.client.gatewayUrl = res.json.url;
|
|
32
|
-
this.client.gatewayOriginalUrl = res.json.url;
|
|
33
|
-
return res.json.url;
|
|
31
|
+
this.client.gatewayUrl = res.json().url;
|
|
32
|
+
this.client.gatewayOriginalUrl = res.json().url;
|
|
33
|
+
return res.json().url;
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
//connect to gateway
|