disgroove 2.0.0-dev.825fc77 → 2.0.1
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/README.md +9 -9
- package/dist/lib/Client.d.ts +10 -10
- package/dist/lib/Client.js +189 -189
- package/dist/lib/Client.js.map +1 -1
- package/dist/lib/constants.d.ts +3 -3
- package/dist/lib/constants.js +207 -207
- package/dist/lib/rest/Endpoints.d.ts +1 -1
- package/dist/lib/rest/Endpoints.js +3 -3
- package/dist/lib/rest/Endpoints.js.map +1 -1
- package/dist/lib/rest/RequestManager.d.ts +2 -2
- package/dist/lib/rest/RequestManager.js +17 -17
- package/dist/lib/types/application-command.d.ts +5 -5
- package/dist/lib/types/guild.d.ts +4 -4
- package/dist/lib/types/interaction.d.ts +6 -6
- package/dist/lib/utils/errors.d.ts +1 -1
- package/dist/lib/utils/errors.js +4 -4
- package/dist/package.json +9 -7
- package/package.json +9 -7
@@ -23,18 +23,18 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
23
23
|
return result;
|
24
24
|
};
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
26
|
-
exports.RequestManager = exports.
|
26
|
+
exports.RequestManager = exports.RESTMethods = void 0;
|
27
27
|
const constants_1 = require("../constants");
|
28
28
|
const utils_1 = require("../utils");
|
29
29
|
const pkg = __importStar(require("../../package.json"));
|
30
|
-
var
|
31
|
-
(function (
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
})(
|
30
|
+
var RESTMethods;
|
31
|
+
(function (RESTMethods) {
|
32
|
+
RESTMethods["Get"] = "GET";
|
33
|
+
RESTMethods["Post"] = "POST";
|
34
|
+
RESTMethods["Delete"] = "DELETE";
|
35
|
+
RESTMethods["Patch"] = "PATCH";
|
36
|
+
RESTMethods["Put"] = "PUT";
|
37
|
+
})(RESTMethods || (exports.RESTMethods = RESTMethods = {}));
|
38
38
|
class RequestManager {
|
39
39
|
token;
|
40
40
|
auth;
|
@@ -59,7 +59,7 @@ class RequestManager {
|
|
59
59
|
let body;
|
60
60
|
if (data?.authorization === false)
|
61
61
|
delete headers["Authorization"];
|
62
|
-
if (method !==
|
62
|
+
if (method !== RESTMethods.Get) {
|
63
63
|
if (data?.form || (data?.files && data?.files?.length !== 0)) {
|
64
64
|
const formData = data.form ?? new FormData();
|
65
65
|
if (data?.files && data?.files?.length !== 0) {
|
@@ -103,13 +103,13 @@ class RequestManager {
|
|
103
103
|
.catch(reject), 5 * 1000);
|
104
104
|
}
|
105
105
|
else {
|
106
|
-
const
|
107
|
-
reject(
|
108
|
-
typeof
|
109
|
-
"code" in
|
110
|
-
"message" in
|
111
|
-
|
112
|
-
? new utils_1.
|
106
|
+
const responseJSON = await response.json();
|
107
|
+
reject(responseJSON &&
|
108
|
+
typeof responseJSON === "object" &&
|
109
|
+
"code" in responseJSON &&
|
110
|
+
"message" in responseJSON &&
|
111
|
+
responseJSON.code !== 0
|
112
|
+
? new utils_1.RESTError(`[${responseJSON.code}] ${responseJSON.message}`)
|
113
113
|
: new utils_1.HTTPError(`[${response.status}] ${response.statusText}`));
|
114
114
|
}
|
115
115
|
}
|
@@ -124,7 +124,7 @@ export interface EditGlobalApplicationCommandParams {
|
|
124
124
|
dmPermission?: boolean;
|
125
125
|
nsfw?: boolean;
|
126
126
|
}
|
127
|
-
export
|
127
|
+
export type BulkEditGlobalApplicationCommandsParams = Array<{
|
128
128
|
id?: string;
|
129
129
|
name: string;
|
130
130
|
nameLocalizations?: LocaleMap | null;
|
@@ -136,7 +136,7 @@ export interface BulkEditGlobalApplicationCommandParams {
|
|
136
136
|
defaultPermission?: boolean | null;
|
137
137
|
type?: ApplicationCommandTypes;
|
138
138
|
nsfw?: boolean;
|
139
|
-
}
|
139
|
+
}>;
|
140
140
|
export interface CreateGuildApplicationCommandParams {
|
141
141
|
name: string;
|
142
142
|
nameLocalizations?: LocaleMap | null;
|
@@ -158,7 +158,7 @@ export interface EditGuildApplicationCommandParams {
|
|
158
158
|
defaultPermission?: boolean | null;
|
159
159
|
nsfw?: boolean;
|
160
160
|
}
|
161
|
-
export
|
161
|
+
export type BulkEditGuildApplicationCommandsParams = Array<{
|
162
162
|
id?: string;
|
163
163
|
name: string;
|
164
164
|
nameLocalizations?: LocaleMap | null;
|
@@ -170,7 +170,7 @@ export interface BulkEditGuildApplicationCommandsParams {
|
|
170
170
|
defaultPermission?: boolean | null;
|
171
171
|
type: ApplicationCommandTypes;
|
172
172
|
nsfw?: boolean;
|
173
|
-
}
|
174
|
-
export interface
|
173
|
+
}>;
|
174
|
+
export interface EditApplicationCommandPermissionsParams {
|
175
175
|
permissions: Array<GuildApplicationCommandPermissions>;
|
176
176
|
}
|
@@ -401,12 +401,12 @@ export interface CreateGuildChannelParams {
|
|
401
401
|
defaultForumLayout?: ForumLayoutTypes;
|
402
402
|
defaultThreadRateLimitPerUser?: number;
|
403
403
|
}
|
404
|
-
export
|
404
|
+
export type EditGuildChannelPositionsParams = Array<{
|
405
405
|
id: string;
|
406
406
|
position?: number | null;
|
407
407
|
lockPermissions?: boolean | null;
|
408
408
|
parentId?: string | null;
|
409
|
-
}
|
409
|
+
}>;
|
410
410
|
export interface AddGuildMemberParams {
|
411
411
|
accessToken: string;
|
412
412
|
nick?: string;
|
@@ -442,10 +442,10 @@ export interface CreateGuildRoleParams {
|
|
442
442
|
unicodeEmoji?: string | null;
|
443
443
|
mentionable?: boolean;
|
444
444
|
}
|
445
|
-
export
|
445
|
+
export type EditGuildRolePositionsParams = Array<{
|
446
446
|
id: string;
|
447
447
|
position?: number | null;
|
448
|
-
}
|
448
|
+
}>;
|
449
449
|
export interface EditGuildRoleParams {
|
450
450
|
name?: string | null;
|
451
451
|
permissions?: string | null;
|
@@ -130,12 +130,12 @@ export interface ModalSubmitData {
|
|
130
130
|
}>;
|
131
131
|
}
|
132
132
|
export interface ResolvedData {
|
133
|
-
users?:
|
134
|
-
members?:
|
135
|
-
roles?:
|
136
|
-
channels?:
|
137
|
-
messages?:
|
138
|
-
attachments?:
|
133
|
+
users?: Record<string, User>;
|
134
|
+
members?: Record<string, GuildMember>;
|
135
|
+
roles?: Record<string, Role>;
|
136
|
+
channels?: Record<string, Channel>;
|
137
|
+
messages?: Record<string, Message>;
|
138
|
+
attachments?: Record<string, Attachment>;
|
139
139
|
}
|
140
140
|
export interface ApplicationCommandInteractionDataOption {
|
141
141
|
name: string;
|
package/dist/lib/utils/errors.js
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.GatewayError = exports.HTTPError = exports.
|
4
|
-
class
|
5
|
-
name = "
|
3
|
+
exports.GatewayError = exports.HTTPError = exports.RESTError = void 0;
|
4
|
+
class RESTError extends Error {
|
5
|
+
name = "RESTError";
|
6
6
|
constructor(message) {
|
7
7
|
super(message);
|
8
8
|
}
|
9
9
|
}
|
10
|
-
exports.
|
10
|
+
exports.RESTError = RESTError;
|
11
11
|
class HTTPError extends Error {
|
12
12
|
name = "HTTPError";
|
13
13
|
constructor(message) {
|
package/dist/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "disgroove",
|
3
|
-
"version": "2.0.
|
3
|
+
"version": "2.0.1",
|
4
4
|
"description": "A module to interface with Discord",
|
5
5
|
"main": "./dist/lib/index.js",
|
6
6
|
"types": "./dist/lib/index.d.ts",
|
@@ -9,11 +9,11 @@
|
|
9
9
|
"url": "git+https://github.com/XenKys/disgroove.git"
|
10
10
|
},
|
11
11
|
"keywords": [
|
12
|
-
"discord",
|
13
12
|
"api",
|
13
|
+
"bot",
|
14
|
+
"discord",
|
14
15
|
"gateway",
|
15
|
-
"wrapper"
|
16
|
-
"bot"
|
16
|
+
"wrapper"
|
17
17
|
],
|
18
18
|
"author": "XenKys",
|
19
19
|
"license": "MIT",
|
@@ -21,10 +21,12 @@
|
|
21
21
|
"url": "https://github.com/XenKys/disgroove/issues"
|
22
22
|
},
|
23
23
|
"homepage": "https://github.com/XenKys/disgroove#readme",
|
24
|
-
"
|
25
|
-
"@types/node": "^20.11.
|
24
|
+
"devDependencies": {
|
25
|
+
"@types/node": "^20.11.25",
|
26
26
|
"@types/ws": "^8.5.10",
|
27
|
-
"node": "^21.
|
27
|
+
"node": "^21.7.1"
|
28
|
+
},
|
29
|
+
"dependencies": {
|
28
30
|
"ws": "^8.16.0"
|
29
31
|
}
|
30
32
|
}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "disgroove",
|
3
|
-
"version": "2.0.
|
3
|
+
"version": "2.0.1",
|
4
4
|
"description": "A module to interface with Discord",
|
5
5
|
"main": "./dist/lib/index.js",
|
6
6
|
"types": "./dist/lib/index.d.ts",
|
@@ -9,11 +9,11 @@
|
|
9
9
|
"url": "git+https://github.com/XenKys/disgroove.git"
|
10
10
|
},
|
11
11
|
"keywords": [
|
12
|
-
"discord",
|
13
12
|
"api",
|
13
|
+
"bot",
|
14
|
+
"discord",
|
14
15
|
"gateway",
|
15
|
-
"wrapper"
|
16
|
-
"bot"
|
16
|
+
"wrapper"
|
17
17
|
],
|
18
18
|
"author": "XenKys",
|
19
19
|
"license": "MIT",
|
@@ -21,10 +21,12 @@
|
|
21
21
|
"url": "https://github.com/XenKys/disgroove/issues"
|
22
22
|
},
|
23
23
|
"homepage": "https://github.com/XenKys/disgroove#readme",
|
24
|
-
"
|
25
|
-
"@types/node": "^20.11.
|
24
|
+
"devDependencies": {
|
25
|
+
"@types/node": "^20.11.25",
|
26
26
|
"@types/ws": "^8.5.10",
|
27
|
-
"node": "^21.
|
27
|
+
"node": "^21.7.1"
|
28
|
+
},
|
29
|
+
"dependencies": {
|
28
30
|
"ws": "^8.16.0"
|
29
31
|
}
|
30
32
|
}
|