disgroove 3.0.0-dev.513aea4 → 3.0.0-dev.681c806
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/LICENSE +9 -9
- package/README.md +48 -48
- package/dist/lib/Client.d.ts +0 -3
- package/dist/lib/constants.d.ts +2 -1
- package/dist/lib/constants.js +1 -0
- package/dist/lib/gateway/Shard.js +18 -7
- package/dist/lib/rest/RequestManager.js +17 -7
- package/dist/lib/rest/index.js +17 -7
- package/dist/lib/transformers/Components.d.ts +3 -1
- package/dist/lib/transformers/Components.js +26 -0
- package/dist/lib/transformers/Interactions.js +30 -0
- package/dist/lib/types/components.d.ts +36 -4
- package/dist/lib/types/interaction.d.ts +3 -3
- package/dist/lib/utils/formatters.js +9 -10
- package/dist/lib/utils/index.d.ts +1 -0
- package/dist/lib/utils/index.js +18 -7
- package/dist/lib/utils/permissions.d.ts +2 -0
- package/dist/lib/utils/permissions.js +7 -0
- package/dist/package.json +1 -1
- package/package.json +2 -2
- package/dist/lib/types/message-components.d.ts +0 -450
- package/dist/lib/types/message-components.js +0 -2
package/LICENSE
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
The MIT License (MIT)
|
|
2
|
-
|
|
3
|
-
Copyright © 2024 XenKys
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
6
|
-
|
|
7
|
-
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
8
|
-
|
|
9
|
-
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright © 2024 XenKys
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
6
|
+
|
|
7
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
8
|
+
|
|
9
|
+
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,48 +1,48 @@
|
|
|
1
|
-
# disgroove
|
|
2
|
-
|
|
3
|
-
A module to interface with Discord
|
|
4
|
-
|
|
5
|
-
- Fast
|
|
6
|
-
- Lightweight
|
|
7
|
-
- Flexible
|
|
8
|
-
- 100% coverage of the [Official Discord API Documentation](https://discord.com/developers/docs/intro)
|
|
9
|
-
|
|
10
|
-
## Example
|
|
11
|
-
|
|
12
|
-
```js
|
|
13
|
-
const {
|
|
14
|
-
Client,
|
|
15
|
-
GatewayIntents,
|
|
16
|
-
InteractionType,
|
|
17
|
-
InteractionCallbackType,
|
|
18
|
-
MessageFlags,
|
|
19
|
-
} = require("disgroove");
|
|
20
|
-
const client = new Client("B0t.T0k3N");
|
|
21
|
-
|
|
22
|
-
client.once("ready", () => {
|
|
23
|
-
console.log("Logged in as", client.user.username);
|
|
24
|
-
|
|
25
|
-
client.createGlobalApplicationCommand(client.application.id, {
|
|
26
|
-
name: "ping",
|
|
27
|
-
description: "Pong!",
|
|
28
|
-
});
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
client.on("interactionCreate", async (interaction) => {
|
|
32
|
-
if (interaction.type !== InteractionType.ApplicationCommand) return;
|
|
33
|
-
|
|
34
|
-
if (interaction.data.name === "ping") {
|
|
35
|
-
client.createInteractionResponse(interaction.id, interaction.token, {
|
|
36
|
-
type: InteractionCallbackType.ChannelMessageWithSource,
|
|
37
|
-
data: {
|
|
38
|
-
content: "Pong! 🏓",
|
|
39
|
-
flags: MessageFlags.Ephemeral,
|
|
40
|
-
},
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
client.connect();
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
More examples on the [GitHub repository](https://github.com/sergiogotuzzo/disgroove/tree/main/examples)
|
|
1
|
+
# disgroove
|
|
2
|
+
|
|
3
|
+
A module to interface with Discord
|
|
4
|
+
|
|
5
|
+
- Fast
|
|
6
|
+
- Lightweight
|
|
7
|
+
- Flexible
|
|
8
|
+
- 100% coverage of the [Official Discord API Documentation](https://discord.com/developers/docs/intro)
|
|
9
|
+
|
|
10
|
+
## Example
|
|
11
|
+
|
|
12
|
+
```js
|
|
13
|
+
const {
|
|
14
|
+
Client,
|
|
15
|
+
GatewayIntents,
|
|
16
|
+
InteractionType,
|
|
17
|
+
InteractionCallbackType,
|
|
18
|
+
MessageFlags,
|
|
19
|
+
} = require("disgroove");
|
|
20
|
+
const client = new Client("B0t.T0k3N");
|
|
21
|
+
|
|
22
|
+
client.once("ready", () => {
|
|
23
|
+
console.log("Logged in as", client.user.username);
|
|
24
|
+
|
|
25
|
+
client.createGlobalApplicationCommand(client.application.id, {
|
|
26
|
+
name: "ping",
|
|
27
|
+
description: "Pong!",
|
|
28
|
+
});
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
client.on("interactionCreate", async (interaction) => {
|
|
32
|
+
if (interaction.type !== InteractionType.ApplicationCommand) return;
|
|
33
|
+
|
|
34
|
+
if (interaction.data.name === "ping") {
|
|
35
|
+
client.createInteractionResponse(interaction.id, interaction.token, {
|
|
36
|
+
type: InteractionCallbackType.ChannelMessageWithSource,
|
|
37
|
+
data: {
|
|
38
|
+
content: "Pong! 🏓",
|
|
39
|
+
flags: MessageFlags.Ephemeral,
|
|
40
|
+
},
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
client.connect();
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
More examples on the [GitHub repository](https://github.com/sergiogotuzzo/disgroove/tree/main/examples)
|
package/dist/lib/Client.d.ts
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
/// <reference types="node" />
|
|
3
|
-
/// <reference types="node" />
|
|
4
1
|
import { GatewayIntents, type OAuth2Scopes, type ActionTypes, type ImageWidgetStyleOptions, type ReactionTypes, type ApplicationCommandTypes, type EventTypes, type TriggerTypes, type ChannelTypes, type VideoQualityModes, type SortOrderTypes, type ForumLayoutTypes, type InviteTargetTypes, type VerificationLevel, type DefaultMessageNotificationLevel, type ExplicitContentFilterLevel, type SystemChannelFlags, type ApplicationFlags, type ApplicationIntegrationTypes, type ChannelFlags, type GuildFeatures, type GuildScheduledEventEntityTypes, type GuildScheduledEventPrivacyLevel, type GuildScheduledEventStatus, type MessageFlags, type OnboardingMode, type PrivacyLevel, type GuildMemberFlags, type InteractionContextTypes, type LobbyMemberFlags } from "./constants";
|
|
5
2
|
import { RequestManager, type FileData } from "./rest";
|
|
6
3
|
import EventEmitter from "node:events";
|
package/dist/lib/constants.d.ts
CHANGED
|
@@ -135,7 +135,8 @@ export declare enum ComponentTypes {
|
|
|
135
135
|
File = 13,
|
|
136
136
|
Separator = 14,
|
|
137
137
|
Container = 17,
|
|
138
|
-
Label = 18
|
|
138
|
+
Label = 18,
|
|
139
|
+
FileUpload = 19
|
|
139
140
|
}
|
|
140
141
|
/** https://discord.com/developers/docs/components/reference#button-button-styles */
|
|
141
142
|
export declare enum ButtonStyles {
|
package/dist/lib/constants.js
CHANGED
|
@@ -152,6 +152,7 @@ var ComponentTypes;
|
|
|
152
152
|
ComponentTypes[ComponentTypes["Separator"] = 14] = "Separator";
|
|
153
153
|
ComponentTypes[ComponentTypes["Container"] = 17] = "Container";
|
|
154
154
|
ComponentTypes[ComponentTypes["Label"] = 18] = "Label";
|
|
155
|
+
ComponentTypes[ComponentTypes["FileUpload"] = 19] = "FileUpload";
|
|
155
156
|
})(ComponentTypes || (exports.ComponentTypes = ComponentTypes = {}));
|
|
156
157
|
/** https://discord.com/developers/docs/components/reference#button-button-styles */
|
|
157
158
|
var ButtonStyles;
|
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
36
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
37
|
};
|
|
@@ -654,6 +664,7 @@ class Shard {
|
|
|
654
664
|
onWebSocketClose(code, reason) {
|
|
655
665
|
switch (code) {
|
|
656
666
|
case 1000:
|
|
667
|
+
this.disconnect();
|
|
657
668
|
break;
|
|
658
669
|
case constants_1.GatewayCloseEventCodes.UnknownError:
|
|
659
670
|
case constants_1.GatewayCloseEventCodes.UnknownOPCode:
|
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
36
|
exports.RequestManager = exports.RESTMethods = void 0;
|
|
27
37
|
const constants_1 = require("../constants");
|
package/dist/lib/rest/index.js
CHANGED
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
26
36
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
27
37
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ActionRow, Button, Container, RawActionRow, RawButton, RawContainer, RawFile, File, RawUnfurledMediaItem, UnfurledMediaItem, RawTextDisplay, TextDisplay, RawSeparator, Separator, RawSection, Section, Thumbnail, RawThumbnail, TextInput, RawTextInput, MediaGallery, RawMediaGallery, RawStringSelect, StringSelect, RawUserSelect, UserSelect, RawRoleSelect, RoleSelect, RawMentionableSelect, MentionableSelect, RawChannelSelect, ChannelSelect, RawLabel, Label } from "../types/components";
|
|
1
|
+
import { ActionRow, Button, Container, RawActionRow, RawButton, RawContainer, RawFile, File, RawUnfurledMediaItem, UnfurledMediaItem, RawTextDisplay, TextDisplay, RawSeparator, Separator, RawSection, Section, Thumbnail, RawThumbnail, TextInput, RawTextInput, MediaGallery, RawMediaGallery, RawStringSelect, StringSelect, RawUserSelect, UserSelect, RawRoleSelect, RoleSelect, RawMentionableSelect, MentionableSelect, RawChannelSelect, ChannelSelect, RawLabel, Label, RawFileUpload, FileUpload } from "../types/components";
|
|
2
2
|
export declare class Components {
|
|
3
3
|
static actionRowFromRaw(actionRow: RawActionRow): ActionRow;
|
|
4
4
|
static actionRowToRaw(actionRow: ActionRow): RawActionRow;
|
|
@@ -10,6 +10,8 @@ export declare class Components {
|
|
|
10
10
|
static containerToRaw(container: Container): RawContainer;
|
|
11
11
|
static fileFromRaw(file: RawFile): File;
|
|
12
12
|
static fileToRaw(file: File): RawFile;
|
|
13
|
+
static fileUploadFromRaw(fileUpload: RawFileUpload): FileUpload;
|
|
14
|
+
static fileUploadToRaw(fileUpload: FileUpload): RawFileUpload;
|
|
13
15
|
static labelFromRaw(label: RawLabel): Label;
|
|
14
16
|
static labelToRaw(label: Label): RawLabel;
|
|
15
17
|
static mediaGalleryFromRaw(mediaGallery: RawMediaGallery): MediaGallery;
|
|
@@ -183,6 +183,26 @@ class Components {
|
|
|
183
183
|
size: file.size,
|
|
184
184
|
};
|
|
185
185
|
}
|
|
186
|
+
static fileUploadFromRaw(fileUpload) {
|
|
187
|
+
return {
|
|
188
|
+
type: fileUpload.type,
|
|
189
|
+
id: fileUpload.id,
|
|
190
|
+
customId: fileUpload.custom_id,
|
|
191
|
+
minValues: fileUpload.min_values,
|
|
192
|
+
maxValues: fileUpload.max_values,
|
|
193
|
+
required: fileUpload.required,
|
|
194
|
+
};
|
|
195
|
+
}
|
|
196
|
+
static fileUploadToRaw(fileUpload) {
|
|
197
|
+
return {
|
|
198
|
+
type: fileUpload.type,
|
|
199
|
+
id: fileUpload.id,
|
|
200
|
+
custom_id: fileUpload.customId,
|
|
201
|
+
min_values: fileUpload.minValues,
|
|
202
|
+
max_values: fileUpload.maxValues,
|
|
203
|
+
required: fileUpload.required,
|
|
204
|
+
};
|
|
205
|
+
}
|
|
186
206
|
static labelFromRaw(label) {
|
|
187
207
|
let component;
|
|
188
208
|
switch (label.component.type) {
|
|
@@ -204,6 +224,9 @@ class Components {
|
|
|
204
224
|
case constants_1.ComponentTypes.ChannelSelect:
|
|
205
225
|
component = Components.channelSelectFromRaw(label.component);
|
|
206
226
|
break;
|
|
227
|
+
case constants_1.ComponentTypes.FileUpload:
|
|
228
|
+
component = Components.fileUploadFromRaw(label.component);
|
|
229
|
+
break;
|
|
207
230
|
}
|
|
208
231
|
return {
|
|
209
232
|
type: label.type,
|
|
@@ -234,6 +257,9 @@ class Components {
|
|
|
234
257
|
case constants_1.ComponentTypes.ChannelSelect:
|
|
235
258
|
component = Components.channelSelectToRaw(label.component);
|
|
236
259
|
break;
|
|
260
|
+
case constants_1.ComponentTypes.FileUpload:
|
|
261
|
+
component = Components.fileUploadToRaw(label.component);
|
|
262
|
+
break;
|
|
237
263
|
}
|
|
238
264
|
return {
|
|
239
265
|
type: label.type,
|
|
@@ -128,6 +128,13 @@ class Interactions {
|
|
|
128
128
|
resolved: this.resolvedDataFromRaw(c.resolved),
|
|
129
129
|
values: c.values,
|
|
130
130
|
};
|
|
131
|
+
case constants_1.ComponentTypes.FileUpload:
|
|
132
|
+
return {
|
|
133
|
+
type: c.type,
|
|
134
|
+
id: c.id,
|
|
135
|
+
customId: c.custom_id,
|
|
136
|
+
values: c.values,
|
|
137
|
+
};
|
|
131
138
|
}
|
|
132
139
|
}),
|
|
133
140
|
};
|
|
@@ -196,6 +203,14 @@ class Interactions {
|
|
|
196
203
|
values: component.component.values,
|
|
197
204
|
};
|
|
198
205
|
break;
|
|
206
|
+
case constants_1.ComponentTypes.FileUpload:
|
|
207
|
+
c = {
|
|
208
|
+
type: component.component.type,
|
|
209
|
+
id: component.component.id,
|
|
210
|
+
customId: component.component.custom_id,
|
|
211
|
+
values: component.component.values,
|
|
212
|
+
};
|
|
213
|
+
break;
|
|
199
214
|
}
|
|
200
215
|
return {
|
|
201
216
|
type: component.type,
|
|
@@ -351,6 +366,13 @@ class Interactions {
|
|
|
351
366
|
resolved: this.resolvedDataToRaw(c.resolved),
|
|
352
367
|
values: c.values,
|
|
353
368
|
};
|
|
369
|
+
case constants_1.ComponentTypes.FileUpload:
|
|
370
|
+
return {
|
|
371
|
+
type: c.type,
|
|
372
|
+
id: c.id,
|
|
373
|
+
custom_id: c.customId,
|
|
374
|
+
values: c.values,
|
|
375
|
+
};
|
|
354
376
|
}
|
|
355
377
|
}),
|
|
356
378
|
};
|
|
@@ -419,6 +441,14 @@ class Interactions {
|
|
|
419
441
|
values: component.component.values,
|
|
420
442
|
};
|
|
421
443
|
break;
|
|
444
|
+
case constants_1.ComponentTypes.FileUpload:
|
|
445
|
+
c = {
|
|
446
|
+
type: component.component.type,
|
|
447
|
+
id: component.component.id,
|
|
448
|
+
custom_id: component.component.customId,
|
|
449
|
+
values: component.component.values,
|
|
450
|
+
};
|
|
451
|
+
break;
|
|
422
452
|
}
|
|
423
453
|
return {
|
|
424
454
|
type: component.type,
|
|
@@ -222,13 +222,29 @@ export interface RawLabel {
|
|
|
222
222
|
id?: number;
|
|
223
223
|
label: string;
|
|
224
224
|
description?: string;
|
|
225
|
-
component: RawTextInput | RawStringSelect | RawUserSelect | RawRoleSelect | RawMentionableSelect | RawChannelSelect;
|
|
225
|
+
component: RawTextInput | RawStringSelect | RawUserSelect | RawRoleSelect | RawMentionableSelect | RawChannelSelect | RawFileUpload;
|
|
226
226
|
}
|
|
227
227
|
/** https://discord.com/developers/docs/components/reference#label-label-interaction-response-structure */
|
|
228
228
|
export interface RawLabelInteractionResponse {
|
|
229
229
|
type: ComponentTypes.Label;
|
|
230
230
|
id: number;
|
|
231
|
-
component: RawTextInputInteractionResponse | RawStringSelectInteractionResponse | RawUserSelectInteractionResponse | RawRoleSelectInteractionResponse | RawMentionableSelectInteractionResponse | RawChannelSelectInteractionResponse;
|
|
231
|
+
component: RawTextInputInteractionResponse | RawStringSelectInteractionResponse | RawUserSelectInteractionResponse | RawRoleSelectInteractionResponse | RawMentionableSelectInteractionResponse | RawChannelSelectInteractionResponse | RawFileUploadInteractionResponse;
|
|
232
|
+
}
|
|
233
|
+
/** https://discord.com/developers/docs/components/reference#file-upload-file-upload-structure */
|
|
234
|
+
export interface RawFileUpload {
|
|
235
|
+
type: ComponentTypes.FileUpload;
|
|
236
|
+
id?: number;
|
|
237
|
+
custom_id: string;
|
|
238
|
+
min_values?: number;
|
|
239
|
+
max_values?: number;
|
|
240
|
+
required?: boolean;
|
|
241
|
+
}
|
|
242
|
+
/** https://discord.com/developers/docs/components/reference#file-upload-file-upload-interaction-response-structure */
|
|
243
|
+
export interface RawFileUploadInteractionResponse {
|
|
244
|
+
type: ComponentTypes.FileUpload;
|
|
245
|
+
id: number;
|
|
246
|
+
custom_id: string;
|
|
247
|
+
values: Array<snowflake>;
|
|
232
248
|
}
|
|
233
249
|
/** https://discord.com/developers/docs/components/reference#unfurled-media-item-unfurled-media-item-structure */
|
|
234
250
|
export interface RawUnfurledMediaItem {
|
|
@@ -459,13 +475,29 @@ export interface Label {
|
|
|
459
475
|
id?: number;
|
|
460
476
|
label: string;
|
|
461
477
|
description?: string;
|
|
462
|
-
component: TextInput | StringSelect | UserSelect | RoleSelect | MentionableSelect | ChannelSelect;
|
|
478
|
+
component: TextInput | StringSelect | UserSelect | RoleSelect | MentionableSelect | ChannelSelect | FileUpload;
|
|
463
479
|
}
|
|
464
480
|
/** https://discord.com/developers/docs/components/reference#label-label-interaction-response-structure */
|
|
465
481
|
export interface LabelInteractionResponse {
|
|
466
482
|
type: ComponentTypes.Label;
|
|
467
483
|
id: number;
|
|
468
|
-
component: TextInputInteractionResponse | StringSelectInteractionResponse | UserSelectInteractionResponse | RoleSelectInteractionResponse | MentionableSelectInteractionResponse | ChannelSelectInteractionResponse;
|
|
484
|
+
component: TextInputInteractionResponse | StringSelectInteractionResponse | UserSelectInteractionResponse | RoleSelectInteractionResponse | MentionableSelectInteractionResponse | ChannelSelectInteractionResponse | FileUploadInteractionResponse;
|
|
485
|
+
}
|
|
486
|
+
/** https://discord.com/developers/docs/components/reference#file-upload-file-upload-structure */
|
|
487
|
+
export interface FileUpload {
|
|
488
|
+
type: ComponentTypes.FileUpload;
|
|
489
|
+
id?: number;
|
|
490
|
+
customId: string;
|
|
491
|
+
minValues?: number;
|
|
492
|
+
maxValues?: number;
|
|
493
|
+
required?: boolean;
|
|
494
|
+
}
|
|
495
|
+
/** https://discord.com/developers/docs/components/reference#file-upload-file-upload-interaction-response-structure */
|
|
496
|
+
export interface FileUploadInteractionResponse {
|
|
497
|
+
type: ComponentTypes.FileUpload;
|
|
498
|
+
id: number;
|
|
499
|
+
customId: string;
|
|
500
|
+
values: Array<snowflake>;
|
|
469
501
|
}
|
|
470
502
|
/** https://discord.com/developers/docs/components/reference#unfurled-media-item-unfurled-media-item-structure */
|
|
471
503
|
export interface UnfurledMediaItem {
|
|
@@ -6,7 +6,7 @@ import type { snowflake } from "./common";
|
|
|
6
6
|
import type { RawEntitlement, Entitlement } from "./entitlements";
|
|
7
7
|
import type { RawGuildMember, GuildMember, Guild, RawGuild } from "./guild";
|
|
8
8
|
import type { RawMessage, RawAttachment, RawEmbed, RawAllowedMentions, Message, Attachment, Embed, AllowedMentions } from "./message";
|
|
9
|
-
import type { ActionRow, ChannelSelectInteractionResponse, Container, File, Label, LabelInteractionResponse, MediaGallery, MentionableSelectInteractionResponse, RawActionRow, RawChannelSelectInteractionResponse, RawContainer, RawFile, RawLabel, RawLabelInteractionResponse, RawMediaGallery, RawMentionableSelectInteractionResponse, RawRoleSelectInteractionResponse, RawSection, RawSeparator, RawStringSelectInteractionResponse, RawTextDisplay, RawTextDisplayInteractionResponse, RawTextInputInteractionResponse, RawUserSelectInteractionResponse, RoleSelectInteractionResponse, Section, Separator, StringSelectInteractionResponse, TextDisplay, TextDisplayInteractionResponse, TextInputInteractionResponse, UserSelectInteractionResponse } from "./components";
|
|
9
|
+
import type { ActionRow, ChannelSelectInteractionResponse, Container, File, FileUploadInteractionResponse, Label, LabelInteractionResponse, MediaGallery, MentionableSelectInteractionResponse, RawActionRow, RawChannelSelectInteractionResponse, RawContainer, RawFile, RawFileUploadInteractionResponse, RawLabel, RawLabelInteractionResponse, RawMediaGallery, RawMentionableSelectInteractionResponse, RawRoleSelectInteractionResponse, RawSection, RawSeparator, RawStringSelectInteractionResponse, RawTextDisplay, RawTextDisplayInteractionResponse, RawTextInputInteractionResponse, RawUserSelectInteractionResponse, RoleSelectInteractionResponse, Section, Separator, StringSelectInteractionResponse, TextDisplay, TextDisplayInteractionResponse, TextInputInteractionResponse, UserSelectInteractionResponse } from "./components";
|
|
10
10
|
import type { RawPollCreateParams, PollCreateParams } from "./poll";
|
|
11
11
|
import type { RawRole, Role } from "./role";
|
|
12
12
|
import type { RawUser, User } from "./user";
|
|
@@ -57,7 +57,7 @@ export interface RawModalSubmitData {
|
|
|
57
57
|
custom_id: string;
|
|
58
58
|
components: Array<{
|
|
59
59
|
type: ComponentTypes.ActionRow;
|
|
60
|
-
components: Array<RawTextInputInteractionResponse | RawStringSelectInteractionResponse | RawUserSelectInteractionResponse | RawRoleSelectInteractionResponse | RawMentionableSelectInteractionResponse | RawChannelSelectInteractionResponse>;
|
|
60
|
+
components: Array<RawTextInputInteractionResponse | RawStringSelectInteractionResponse | RawUserSelectInteractionResponse | RawRoleSelectInteractionResponse | RawMentionableSelectInteractionResponse | RawChannelSelectInteractionResponse | RawFileUploadInteractionResponse>;
|
|
61
61
|
} | RawTextDisplayInteractionResponse | RawLabelInteractionResponse>;
|
|
62
62
|
resolved?: RawResolvedData;
|
|
63
63
|
}
|
|
@@ -177,7 +177,7 @@ export interface ModalSubmitData {
|
|
|
177
177
|
customId: string;
|
|
178
178
|
components: Array<{
|
|
179
179
|
type: ComponentTypes.ActionRow;
|
|
180
|
-
components: Array<TextInputInteractionResponse | StringSelectInteractionResponse | UserSelectInteractionResponse | RoleSelectInteractionResponse | MentionableSelectInteractionResponse | ChannelSelectInteractionResponse>;
|
|
180
|
+
components: Array<TextInputInteractionResponse | StringSelectInteractionResponse | UserSelectInteractionResponse | RoleSelectInteractionResponse | MentionableSelectInteractionResponse | ChannelSelectInteractionResponse | FileUploadInteractionResponse>;
|
|
181
181
|
} | TextDisplayInteractionResponse | LabelInteractionResponse>;
|
|
182
182
|
resolved?: ResolvedData;
|
|
183
183
|
}
|
|
@@ -1,22 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.userMention = userMention;
|
|
4
|
+
exports.channelMention = channelMention;
|
|
5
|
+
exports.roleMention = roleMention;
|
|
6
|
+
exports.slashCommandMention = slashCommandMention;
|
|
7
|
+
exports.customEmoji = customEmoji;
|
|
8
|
+
exports.unixTimestamp = unixTimestamp;
|
|
9
|
+
exports.guildNavigation = guildNavigation;
|
|
10
|
+
exports.email = email;
|
|
11
|
+
exports.phoneNumber = phoneNumber;
|
|
4
12
|
const constants_1 = require("../constants");
|
|
5
13
|
/** https://discord.com/developers/docs/reference#message-formatting-formats */
|
|
6
14
|
function userMention(userId) {
|
|
7
15
|
return `<@${userId}>`;
|
|
8
16
|
}
|
|
9
|
-
exports.userMention = userMention;
|
|
10
17
|
/** https://discord.com/developers/docs/reference#message-formatting-formats */
|
|
11
18
|
function channelMention(channelId) {
|
|
12
19
|
return `<#${channelId}>`;
|
|
13
20
|
}
|
|
14
|
-
exports.channelMention = channelMention;
|
|
15
21
|
/** https://discord.com/developers/docs/reference#message-formatting-formats */
|
|
16
22
|
function roleMention(roleId) {
|
|
17
23
|
return `<@&${roleId}>`;
|
|
18
24
|
}
|
|
19
|
-
exports.roleMention = roleMention;
|
|
20
25
|
/** https://discord.com/developers/docs/reference#message-formatting-formats */
|
|
21
26
|
function slashCommandMention(commandName, commandId, subCommandName, subCommandGroupName) {
|
|
22
27
|
return subCommandName
|
|
@@ -25,33 +30,27 @@ function slashCommandMention(commandName, commandId, subCommandName, subCommandG
|
|
|
25
30
|
: `</${commandName} ${subCommandName}:${commandId}>`
|
|
26
31
|
: `</${commandName}:${commandId}>`;
|
|
27
32
|
}
|
|
28
|
-
exports.slashCommandMention = slashCommandMention;
|
|
29
33
|
/** https://discord.com/developers/docs/reference#message-formatting-formats */
|
|
30
34
|
function customEmoji(emojiName, emojiId, animated) {
|
|
31
35
|
return animated
|
|
32
36
|
? `<a:${emojiName}:${emojiId}>`
|
|
33
37
|
: `<:${emojiName}:${emojiId}>`;
|
|
34
38
|
}
|
|
35
|
-
exports.customEmoji = customEmoji;
|
|
36
39
|
/** https://discord.com/developers/docs/reference#message-formatting-formats */
|
|
37
40
|
function unixTimestamp(time, style) {
|
|
38
41
|
return style ? `<t:${time}:${style}>` : `<t:${time}>`;
|
|
39
42
|
}
|
|
40
|
-
exports.unixTimestamp = unixTimestamp;
|
|
41
43
|
/** https://discord.com/developers/docs/reference#message-formatting-formats */
|
|
42
44
|
function guildNavigation(guildId, type, roleId) {
|
|
43
45
|
return roleId && type === constants_1.GuildNavigationTypes.LinkedRoles
|
|
44
46
|
? `<${guildId}:${type}:${roleId}>`
|
|
45
47
|
: `<${guildId}:${type}>`;
|
|
46
48
|
}
|
|
47
|
-
exports.guildNavigation = guildNavigation;
|
|
48
49
|
/** https://discord.com/developers/docs/reference#message-formatting-formats */
|
|
49
50
|
function email(username, domain) {
|
|
50
51
|
return `<${username}@${domain}>`;
|
|
51
52
|
}
|
|
52
|
-
exports.email = email;
|
|
53
53
|
/** https://discord.com/developers/docs/reference#message-formatting-formats */
|
|
54
54
|
function phoneNumber(number) {
|
|
55
55
|
return `<+${number}>`;
|
|
56
56
|
}
|
|
57
|
-
exports.phoneNumber = phoneNumber;
|
package/dist/lib/utils/index.js
CHANGED
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
26
36
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
27
37
|
};
|
|
@@ -30,3 +40,4 @@ exports.CDN = void 0;
|
|
|
30
40
|
exports.CDN = __importStar(require("./CDN"));
|
|
31
41
|
__exportStar(require("./errors"), exports);
|
|
32
42
|
__exportStar(require("./formatters"), exports);
|
|
43
|
+
__exportStar(require("./permissions"), exports);
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.hasPermission = hasPermission;
|
|
4
|
+
/** https://discord.com/developers/docs/topics/permissions */
|
|
5
|
+
function hasPermission(userPermissions, permission) {
|
|
6
|
+
return (BigInt(userPermissions) & permission) === permission;
|
|
7
|
+
}
|
package/dist/package.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "disgroove",
|
|
3
|
-
"version": "3.0.0-dev.
|
|
3
|
+
"version": "3.0.0-dev.681c806",
|
|
4
4
|
"description": "A module to interface with Discord",
|
|
5
5
|
"main": "./dist/lib/index.js",
|
|
6
6
|
"types": "./dist/lib/index.d.ts",
|
|
@@ -33,4 +33,4 @@
|
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"ws": "^8.18.3"
|
|
35
35
|
}
|
|
36
|
-
}
|
|
36
|
+
}
|
|
@@ -1,450 +0,0 @@
|
|
|
1
|
-
import type { ButtonStyles, ChannelTypes, ComponentTypes, SeparatorSpacing, TextInputStyles } from "../constants";
|
|
2
|
-
import type { snowflake } from "./common";
|
|
3
|
-
import type { RawEmoji, Emoji } from "./emoji";
|
|
4
|
-
import type { RawResolvedData, ResolvedData } from "./interaction";
|
|
5
|
-
/** https://discord.com/developers/docs/components/reference#action-row-action-row-structure */
|
|
6
|
-
export interface RawActionRow {
|
|
7
|
-
type: ComponentTypes.ActionRow;
|
|
8
|
-
components: Array<RawButton | RawStringSelect | RawTextInput | RawUserSelect | RawRoleSelect | RawMentionableSelect | RawChannelSelect>;
|
|
9
|
-
id?: number;
|
|
10
|
-
}
|
|
11
|
-
/** https://discord.com/developers/docs/components/reference#button-button-structure */
|
|
12
|
-
export interface RawButton {
|
|
13
|
-
type: ComponentTypes.Button;
|
|
14
|
-
id?: number;
|
|
15
|
-
style: ButtonStyles;
|
|
16
|
-
label?: string;
|
|
17
|
-
emoji?: Pick<RawEmoji, "name" | "id" | "animated">;
|
|
18
|
-
custom_id: string;
|
|
19
|
-
sku_id?: snowflake;
|
|
20
|
-
url?: string;
|
|
21
|
-
disabled?: boolean;
|
|
22
|
-
}
|
|
23
|
-
/** https://discord.com/developers/docs/components/reference#string-select-string-select-structure */
|
|
24
|
-
export interface RawStringSelect {
|
|
25
|
-
type: ComponentTypes.StringSelect;
|
|
26
|
-
id?: number;
|
|
27
|
-
custom_id: string;
|
|
28
|
-
options: Array<RawSelectOption>;
|
|
29
|
-
placeholder?: string;
|
|
30
|
-
min_values?: number;
|
|
31
|
-
max_values?: number;
|
|
32
|
-
required?: boolean;
|
|
33
|
-
disabled?: boolean;
|
|
34
|
-
}
|
|
35
|
-
/** https://discord.com/developers/docs/components/reference#string-select-string-select-interaction-response-structure */
|
|
36
|
-
export interface RawStringSelectInteractionResponse {
|
|
37
|
-
type: ComponentTypes.StringSelect;
|
|
38
|
-
component_type: ComponentTypes.StringSelect;
|
|
39
|
-
id: number;
|
|
40
|
-
custom_id: string;
|
|
41
|
-
values: Array<string>;
|
|
42
|
-
}
|
|
43
|
-
/** https://discord.com/developers/docs/components/reference#string-select-select-option-structure */
|
|
44
|
-
export interface RawSelectOption {
|
|
45
|
-
label: string;
|
|
46
|
-
value: string;
|
|
47
|
-
description?: string;
|
|
48
|
-
emoji?: Pick<RawEmoji, "name" | "id" | "animated">;
|
|
49
|
-
default?: boolean;
|
|
50
|
-
}
|
|
51
|
-
/** https://discord.com/developers/docs/components/reference#text-input-text-input-structure */
|
|
52
|
-
export interface RawTextInput {
|
|
53
|
-
type: ComponentTypes.TextInput;
|
|
54
|
-
id?: number;
|
|
55
|
-
custom_id: string;
|
|
56
|
-
style: TextInputStyles;
|
|
57
|
-
min_length?: number;
|
|
58
|
-
max_length?: number;
|
|
59
|
-
required?: boolean;
|
|
60
|
-
value?: string;
|
|
61
|
-
placeholder?: string;
|
|
62
|
-
label: string;
|
|
63
|
-
}
|
|
64
|
-
/** https://discord.com/developers/docs/components/reference#text-input-text-input-interaction-response-structure */
|
|
65
|
-
export interface RawTextInputInteractionResponse {
|
|
66
|
-
type: ComponentTypes.TextInput;
|
|
67
|
-
id: number;
|
|
68
|
-
custom_id: string;
|
|
69
|
-
value: string;
|
|
70
|
-
}
|
|
71
|
-
/** https://discord.com/developers/docs/components/reference#user-select-user-select-structure */
|
|
72
|
-
export interface RawUserSelect {
|
|
73
|
-
type: ComponentTypes.UserSelect;
|
|
74
|
-
id?: number;
|
|
75
|
-
custom_id: string;
|
|
76
|
-
placeholder?: string;
|
|
77
|
-
default_values?: Array<RawDefaultValue>;
|
|
78
|
-
min_values?: number;
|
|
79
|
-
max_values?: number;
|
|
80
|
-
disabled?: boolean;
|
|
81
|
-
}
|
|
82
|
-
/** https://discord.com/developers/docs/components/reference#user-select-user-select-interaction-response-structure */
|
|
83
|
-
export interface RawUserSelectInteractionResponse {
|
|
84
|
-
type: ComponentTypes.UserSelect;
|
|
85
|
-
component_type: ComponentTypes.UserSelect;
|
|
86
|
-
id: number;
|
|
87
|
-
custom_id: string;
|
|
88
|
-
resolved: RawResolvedData;
|
|
89
|
-
values: Array<snowflake>;
|
|
90
|
-
}
|
|
91
|
-
/** https://discord.com/developers/docs/components/reference#user-select-select-default-value-structure */
|
|
92
|
-
export interface RawDefaultValue {
|
|
93
|
-
id: snowflake;
|
|
94
|
-
type: "user" | "role" | "channel";
|
|
95
|
-
}
|
|
96
|
-
/** https://discord.com/developers/docs/components/reference#role-select-role-select-structure */
|
|
97
|
-
export interface RawRoleSelect {
|
|
98
|
-
type: ComponentTypes.RoleSelect;
|
|
99
|
-
id?: number;
|
|
100
|
-
custom_id: string;
|
|
101
|
-
placeholder?: string;
|
|
102
|
-
default_values?: Array<RawDefaultValue>;
|
|
103
|
-
min_values?: number;
|
|
104
|
-
max_values?: number;
|
|
105
|
-
disabled?: boolean;
|
|
106
|
-
}
|
|
107
|
-
/** https://discord.com/developers/docs/components/reference#role-select-role-select-interaction-response-structure */
|
|
108
|
-
export interface RawRoleSelectInteractionResponse {
|
|
109
|
-
type: ComponentTypes.RoleSelect;
|
|
110
|
-
component_type: ComponentTypes.RoleSelect;
|
|
111
|
-
id: number;
|
|
112
|
-
custom_id: string;
|
|
113
|
-
resolved: RawResolvedData;
|
|
114
|
-
values: Array<snowflake>;
|
|
115
|
-
}
|
|
116
|
-
/** https://discord.com/developers/docs/components/reference#mentionable-select-mentionable-select-structure */
|
|
117
|
-
export interface RawMentionableSelect {
|
|
118
|
-
type: ComponentTypes.MentionableSelect;
|
|
119
|
-
id?: number;
|
|
120
|
-
custom_id: string;
|
|
121
|
-
placeholder?: string;
|
|
122
|
-
default_values?: Array<RawDefaultValue>;
|
|
123
|
-
min_values?: number;
|
|
124
|
-
max_values?: number;
|
|
125
|
-
disabled?: boolean;
|
|
126
|
-
}
|
|
127
|
-
/** https://discord.com/developers/docs/components/reference#mentionable-select-mentionable-select-interaction-response-structure */
|
|
128
|
-
export interface RawMentionableSelectInteractionResponse {
|
|
129
|
-
type: ComponentTypes.MentionableSelect;
|
|
130
|
-
component_type: ComponentTypes.MentionableSelect;
|
|
131
|
-
id: number;
|
|
132
|
-
custom_id: string;
|
|
133
|
-
resolved: RawResolvedData;
|
|
134
|
-
values: Array<snowflake>;
|
|
135
|
-
}
|
|
136
|
-
/** https://discord.com/developers/docs/components/reference#channel-select-channel-select-structure */
|
|
137
|
-
export interface RawChannelSelect {
|
|
138
|
-
type: ComponentTypes.ChannelSelect;
|
|
139
|
-
id?: number;
|
|
140
|
-
custom_id: string;
|
|
141
|
-
channel_types?: Array<ChannelTypes>;
|
|
142
|
-
placeholder?: string;
|
|
143
|
-
default_values?: Array<RawDefaultValue>;
|
|
144
|
-
min_values?: number;
|
|
145
|
-
max_values?: number;
|
|
146
|
-
disabled?: boolean;
|
|
147
|
-
}
|
|
148
|
-
/** https://discord.com/developers/docs/components/reference#channel-select-channel-select-interaction-response-structure */
|
|
149
|
-
export interface RawChannelSelectInteractionResponse {
|
|
150
|
-
type: ComponentTypes.ChannelSelect;
|
|
151
|
-
component_type: ComponentTypes.ChannelSelect;
|
|
152
|
-
id: number;
|
|
153
|
-
custom_id: string;
|
|
154
|
-
resolved: RawResolvedData;
|
|
155
|
-
values: Array<snowflake>;
|
|
156
|
-
}
|
|
157
|
-
/** https://discord.com/developers/docs/components/reference#section-section-structure */
|
|
158
|
-
export interface RawSection {
|
|
159
|
-
type: ComponentTypes.Section;
|
|
160
|
-
id?: number;
|
|
161
|
-
components: Array<RawTextDisplay>;
|
|
162
|
-
accessory: RawButton | RawThumbnail;
|
|
163
|
-
}
|
|
164
|
-
/** https://discord.com/developers/docs/components/reference#text-display-text-display-structure */
|
|
165
|
-
export interface RawTextDisplay {
|
|
166
|
-
type: ComponentTypes.TextDisplay;
|
|
167
|
-
id?: number;
|
|
168
|
-
content: string;
|
|
169
|
-
}
|
|
170
|
-
/** https://discord.com/developers/docs/components/reference#text-display-text-display-interaction-response-structure */
|
|
171
|
-
export interface RawTextDisplayInteractionResponse {
|
|
172
|
-
type: ComponentTypes.TextDisplay;
|
|
173
|
-
id: number;
|
|
174
|
-
}
|
|
175
|
-
/** https://discord.com/developers/docs/components/reference#thumbnail-thumbnail-structure */
|
|
176
|
-
export interface RawThumbnail {
|
|
177
|
-
type: ComponentTypes.Thumbnail;
|
|
178
|
-
id?: number;
|
|
179
|
-
media: RawUnfurledMediaItem;
|
|
180
|
-
description?: string;
|
|
181
|
-
spoiler?: boolean;
|
|
182
|
-
}
|
|
183
|
-
/** https://discord.com/developers/docs/components/reference#media-gallery-media-gallery-structure */
|
|
184
|
-
export interface RawMediaGallery {
|
|
185
|
-
type: ComponentTypes.MediaGallery;
|
|
186
|
-
id?: number;
|
|
187
|
-
items: Array<RawMediaGalleryItem>;
|
|
188
|
-
}
|
|
189
|
-
/** https://discord.com/developers/docs/components/reference#media-gallery-media-gallery-item-structure */
|
|
190
|
-
export interface RawMediaGalleryItem {
|
|
191
|
-
media: RawUnfurledMediaItem;
|
|
192
|
-
description?: string;
|
|
193
|
-
spoiler?: boolean;
|
|
194
|
-
}
|
|
195
|
-
/** https://discord.com/developers/docs/components/reference#file-file-structure */
|
|
196
|
-
export interface RawFile {
|
|
197
|
-
type: ComponentTypes.File;
|
|
198
|
-
id?: number;
|
|
199
|
-
file: RawUnfurledMediaItem;
|
|
200
|
-
spoiler?: boolean;
|
|
201
|
-
name: string;
|
|
202
|
-
size: number;
|
|
203
|
-
}
|
|
204
|
-
/** https://discord.com/developers/docs/components/reference#separator-separator-structure */
|
|
205
|
-
export interface RawSeparator {
|
|
206
|
-
type: ComponentTypes.Separator;
|
|
207
|
-
id?: number;
|
|
208
|
-
divider?: boolean;
|
|
209
|
-
spacing?: SeparatorSpacing;
|
|
210
|
-
}
|
|
211
|
-
/** https://discord.com/developers/docs/components/reference#container-container-structure */
|
|
212
|
-
export interface RawContainer {
|
|
213
|
-
type: ComponentTypes.Container;
|
|
214
|
-
id?: number;
|
|
215
|
-
components: Array<RawActionRow | RawTextDisplay | RawSection | RawMediaGallery | RawSeparator | RawFile>;
|
|
216
|
-
accent_color?: number | null;
|
|
217
|
-
spoiler?: boolean;
|
|
218
|
-
}
|
|
219
|
-
/** https://discord.com/developers/docs/components/reference#label-label-structure */
|
|
220
|
-
export interface RawLabel {
|
|
221
|
-
type: ComponentTypes.Label;
|
|
222
|
-
id?: number;
|
|
223
|
-
label: string;
|
|
224
|
-
description?: string;
|
|
225
|
-
component: RawTextInput | RawStringSelect | RawUserSelect | RawRoleSelect | RawMentionableSelect | RawChannelSelect;
|
|
226
|
-
}
|
|
227
|
-
/** https://discord.com/developers/docs/components/reference#label-label-interaction-response-structure */
|
|
228
|
-
export interface RawLabelInteractionResponse {
|
|
229
|
-
type: ComponentTypes.Label;
|
|
230
|
-
id: number;
|
|
231
|
-
component: RawTextInputInteractionResponse | RawStringSelectInteractionResponse | RawUserSelectInteractionResponse | RawRoleSelectInteractionResponse | RawMentionableSelectInteractionResponse | RawChannelSelectInteractionResponse;
|
|
232
|
-
}
|
|
233
|
-
/** https://discord.com/developers/docs/components/reference#unfurled-media-item-unfurled-media-item-structure */
|
|
234
|
-
export interface RawUnfurledMediaItem {
|
|
235
|
-
url: string;
|
|
236
|
-
proxy_url?: string;
|
|
237
|
-
height?: number | null;
|
|
238
|
-
width?: number | null;
|
|
239
|
-
content_type?: string;
|
|
240
|
-
attachment_id?: snowflake;
|
|
241
|
-
}
|
|
242
|
-
export interface ActionRow {
|
|
243
|
-
type: ComponentTypes.ActionRow;
|
|
244
|
-
components: Array<Button | StringSelect | TextInput | UserSelect | RoleSelect | MentionableSelect | ChannelSelect>;
|
|
245
|
-
id?: number;
|
|
246
|
-
}
|
|
247
|
-
export interface Button {
|
|
248
|
-
type: ComponentTypes.Button;
|
|
249
|
-
id?: number;
|
|
250
|
-
style: ButtonStyles;
|
|
251
|
-
label?: string;
|
|
252
|
-
emoji?: Pick<Emoji, "name" | "id" | "animated">;
|
|
253
|
-
customID: string;
|
|
254
|
-
skuID?: snowflake;
|
|
255
|
-
url?: string;
|
|
256
|
-
disabled?: boolean;
|
|
257
|
-
}
|
|
258
|
-
export interface StringSelect {
|
|
259
|
-
type: ComponentTypes.StringSelect;
|
|
260
|
-
id?: number;
|
|
261
|
-
customID: string;
|
|
262
|
-
options: Array<SelectOption>;
|
|
263
|
-
placeholder?: string;
|
|
264
|
-
minValues?: number;
|
|
265
|
-
maxValues?: number;
|
|
266
|
-
required?: boolean;
|
|
267
|
-
disabled?: boolean;
|
|
268
|
-
}
|
|
269
|
-
export interface StringSelectInteractionResponse {
|
|
270
|
-
type: ComponentTypes.StringSelect;
|
|
271
|
-
componentType: ComponentTypes.StringSelect;
|
|
272
|
-
id: number;
|
|
273
|
-
customID: string;
|
|
274
|
-
values: Array<string>;
|
|
275
|
-
}
|
|
276
|
-
export interface SelectOption {
|
|
277
|
-
label: string;
|
|
278
|
-
value: string;
|
|
279
|
-
description?: string;
|
|
280
|
-
emoji?: Pick<Emoji, "name" | "id" | "animated">;
|
|
281
|
-
default?: boolean;
|
|
282
|
-
}
|
|
283
|
-
export interface TextInput {
|
|
284
|
-
type: ComponentTypes.TextInput;
|
|
285
|
-
id?: number;
|
|
286
|
-
customID: string;
|
|
287
|
-
style: TextInputStyles;
|
|
288
|
-
minLength?: number;
|
|
289
|
-
maxLength?: number;
|
|
290
|
-
required?: boolean;
|
|
291
|
-
value?: string;
|
|
292
|
-
placeholder?: string;
|
|
293
|
-
label: string;
|
|
294
|
-
}
|
|
295
|
-
export interface TextInputInteractionResponse {
|
|
296
|
-
type: ComponentTypes.TextInput;
|
|
297
|
-
id: number;
|
|
298
|
-
customID: string;
|
|
299
|
-
value: string;
|
|
300
|
-
}
|
|
301
|
-
export interface UserSelect {
|
|
302
|
-
type: ComponentTypes.UserSelect;
|
|
303
|
-
id?: number;
|
|
304
|
-
customID: string;
|
|
305
|
-
placeholder?: string;
|
|
306
|
-
defaultValues?: Array<DefaultValue>;
|
|
307
|
-
minValues?: number;
|
|
308
|
-
maxValues?: number;
|
|
309
|
-
disabled?: boolean;
|
|
310
|
-
}
|
|
311
|
-
export interface UserSelectInteractionResponse {
|
|
312
|
-
type: ComponentTypes.UserSelect;
|
|
313
|
-
componentType: ComponentTypes.UserSelect;
|
|
314
|
-
id: number;
|
|
315
|
-
customID: string;
|
|
316
|
-
resolved: ResolvedData;
|
|
317
|
-
values: Array<snowflake>;
|
|
318
|
-
}
|
|
319
|
-
export interface DefaultValue {
|
|
320
|
-
id: snowflake;
|
|
321
|
-
type: "user" | "role" | "channel";
|
|
322
|
-
}
|
|
323
|
-
export interface RoleSelect {
|
|
324
|
-
type: ComponentTypes.RoleSelect;
|
|
325
|
-
id?: number;
|
|
326
|
-
customID: string;
|
|
327
|
-
placeholder?: string;
|
|
328
|
-
defaultValues?: Array<DefaultValue>;
|
|
329
|
-
minValues?: number;
|
|
330
|
-
maxValues?: number;
|
|
331
|
-
disabled?: boolean;
|
|
332
|
-
}
|
|
333
|
-
export interface RoleSelectInteractionResponse {
|
|
334
|
-
type: ComponentTypes.RoleSelect;
|
|
335
|
-
componentType: ComponentTypes.RoleSelect;
|
|
336
|
-
id: number;
|
|
337
|
-
customID: string;
|
|
338
|
-
resolved: ResolvedData;
|
|
339
|
-
values: Array<snowflake>;
|
|
340
|
-
}
|
|
341
|
-
export interface MentionableSelect {
|
|
342
|
-
type: ComponentTypes.MentionableSelect;
|
|
343
|
-
id?: number;
|
|
344
|
-
customID: string;
|
|
345
|
-
placeholder?: string;
|
|
346
|
-
defaultValues?: Array<DefaultValue>;
|
|
347
|
-
minValues?: number;
|
|
348
|
-
maxValues?: number;
|
|
349
|
-
disabled?: boolean;
|
|
350
|
-
}
|
|
351
|
-
export interface MentionableSelectInteractionResponse {
|
|
352
|
-
type: ComponentTypes.MentionableSelect;
|
|
353
|
-
componentType: ComponentTypes.MentionableSelect;
|
|
354
|
-
id: number;
|
|
355
|
-
customID: string;
|
|
356
|
-
resolved: ResolvedData;
|
|
357
|
-
values: Array<snowflake>;
|
|
358
|
-
}
|
|
359
|
-
export interface ChannelSelect {
|
|
360
|
-
type: ComponentTypes.ChannelSelect;
|
|
361
|
-
id?: number;
|
|
362
|
-
customID: string;
|
|
363
|
-
channelTypes?: Array<ChannelTypes>;
|
|
364
|
-
placeholder?: string;
|
|
365
|
-
defaultValues?: Array<DefaultValue>;
|
|
366
|
-
minValues?: number;
|
|
367
|
-
maxValues?: number;
|
|
368
|
-
disabled?: boolean;
|
|
369
|
-
}
|
|
370
|
-
export interface ChannelSelectInteractionResponse {
|
|
371
|
-
type: ComponentTypes.ChannelSelect;
|
|
372
|
-
componentType: ComponentTypes.ChannelSelect;
|
|
373
|
-
id: number;
|
|
374
|
-
customID: string;
|
|
375
|
-
resolved: ResolvedData;
|
|
376
|
-
values: Array<snowflake>;
|
|
377
|
-
}
|
|
378
|
-
export interface Section {
|
|
379
|
-
type: ComponentTypes.Section;
|
|
380
|
-
id?: number;
|
|
381
|
-
components: Array<TextDisplay>;
|
|
382
|
-
accessory: Button | Thumbnail;
|
|
383
|
-
}
|
|
384
|
-
export interface TextDisplay {
|
|
385
|
-
type: ComponentTypes.TextDisplay;
|
|
386
|
-
id?: number;
|
|
387
|
-
content: string;
|
|
388
|
-
}
|
|
389
|
-
export interface TextDisplayInteractionResponse {
|
|
390
|
-
type: ComponentTypes.TextDisplay;
|
|
391
|
-
id: number;
|
|
392
|
-
}
|
|
393
|
-
export interface Thumbnail {
|
|
394
|
-
type: ComponentTypes.Thumbnail;
|
|
395
|
-
id?: number;
|
|
396
|
-
media: UnfurledMediaItem;
|
|
397
|
-
description?: string;
|
|
398
|
-
spoiler?: boolean;
|
|
399
|
-
}
|
|
400
|
-
export interface MediaGallery {
|
|
401
|
-
type: ComponentTypes.MediaGallery;
|
|
402
|
-
id?: number;
|
|
403
|
-
items: Array<MediaGalleryItem>;
|
|
404
|
-
}
|
|
405
|
-
export interface MediaGalleryItem {
|
|
406
|
-
media: UnfurledMediaItem;
|
|
407
|
-
description?: string;
|
|
408
|
-
spoiler?: boolean;
|
|
409
|
-
}
|
|
410
|
-
export interface File {
|
|
411
|
-
type: ComponentTypes.File;
|
|
412
|
-
id?: number;
|
|
413
|
-
file: UnfurledMediaItem;
|
|
414
|
-
spoiler?: boolean;
|
|
415
|
-
name: string;
|
|
416
|
-
size: number;
|
|
417
|
-
}
|
|
418
|
-
export interface Separator {
|
|
419
|
-
type: ComponentTypes.Separator;
|
|
420
|
-
id?: number;
|
|
421
|
-
divider?: boolean;
|
|
422
|
-
spacing?: SeparatorSpacing;
|
|
423
|
-
}
|
|
424
|
-
export interface Container {
|
|
425
|
-
type: ComponentTypes.Container;
|
|
426
|
-
id?: number;
|
|
427
|
-
components: Array<ActionRow | TextDisplay | Section | MediaGallery | Separator | File>;
|
|
428
|
-
accentColor?: number | null;
|
|
429
|
-
spoiler?: boolean;
|
|
430
|
-
}
|
|
431
|
-
export interface Label {
|
|
432
|
-
type: ComponentTypes.Label;
|
|
433
|
-
id?: number;
|
|
434
|
-
label: string;
|
|
435
|
-
description?: string;
|
|
436
|
-
component: TextInput | StringSelect | UserSelect | RoleSelect | MentionableSelect | ChannelSelect;
|
|
437
|
-
}
|
|
438
|
-
export interface LabelInteractionResponse {
|
|
439
|
-
type: ComponentTypes.Label;
|
|
440
|
-
id: number;
|
|
441
|
-
component: TextInputInteractionResponse | StringSelectInteractionResponse | UserSelectInteractionResponse | RoleSelectInteractionResponse | MentionableSelectInteractionResponse | ChannelSelectInteractionResponse;
|
|
442
|
-
}
|
|
443
|
-
export interface UnfurledMediaItem {
|
|
444
|
-
url: string;
|
|
445
|
-
proxyURL?: string;
|
|
446
|
-
height?: number | null;
|
|
447
|
-
width?: number | null;
|
|
448
|
-
contentType?: string;
|
|
449
|
-
attachmentID?: snowflake;
|
|
450
|
-
}
|