disgroove 3.0.1-dev.24a02ed → 3.0.1-dev.6e60c8d
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 +38 -8
- package/dist/lib/constants.d.ts +4 -1
- package/dist/lib/constants.js +3 -0
- package/dist/lib/transformers/Components.d.ts +7 -1
- package/dist/lib/transformers/Components.js +72 -0
- package/dist/lib/transformers/Interactions.js +46 -0
- package/dist/lib/transformers/Invites.d.ts +3 -0
- package/dist/lib/transformers/Invites.js +32 -0
- package/dist/lib/types/components.d.ts +124 -4
- package/dist/lib/types/invite.d.ts +2 -2
- package/dist/package.json +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,14 +1,42 @@
|
|
|
1
1
|
# disgroove
|
|
2
2
|
|
|
3
|
-
A
|
|
3
|
+
> A lightweight (≈ **791 KB** unpacked) and low-level Node.js dependency for interfacing with Discord, focused on accuracy and flexibility.
|
|
4
|
+
> It is designed for developers who want full control over the Discord API without heavy abstractions and want as little RAM and CPU usage as possible.
|
|
4
5
|
|
|
5
|
-
|
|
6
|
-
- Lightweight
|
|
7
|
-
- Flexible
|
|
8
|
-
- 100% coverage of the [Official Discord API Documentation](https://discord.com/developers/docs/intro)
|
|
6
|
+
> **disgroove** is intended for developers already familiar with the Discord API and gateway model.
|
|
9
7
|
|
|
10
|
-
##
|
|
8
|
+
## Why disgroove?
|
|
9
|
+
|
|
10
|
+
### ✅ Accurate with the official Discord API
|
|
11
|
+
|
|
12
|
+
All commits (since __July 3, 2024__), types, REST requests, and utilities strictly follow the [official Discord API documentation repository](https://github.com/discord/discord-api-docs) and are referenced to the [Discord API developer docs](https://docs.discord.com/developers/intro).
|
|
13
|
+
|
|
14
|
+
Development releases are mainly published when breaking changes are introduced in the Discord API.
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
### 🧠 Minimal caching
|
|
19
|
+
|
|
20
|
+
**disgroove** only caches guilds.
|
|
21
|
+
|
|
22
|
+
Guilds are mapped from the `READY` gateway event and kept in sync through
|
|
23
|
+
`GUILD_CREATE`, `GUILD_UPDATE` and `GUILD_DELETE` gateway events.
|
|
24
|
+
|
|
25
|
+
This design significantly decreases RAM and CPU usage and keeps the library lightweight.
|
|
11
26
|
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
### 🔧 Highly flexible and low-level
|
|
30
|
+
|
|
31
|
+
**disgroove** doesn't hide Discord features behind abstractions.
|
|
32
|
+
|
|
33
|
+
Every REST request is built directly on top of the [Discord API developer docs](https://docs.discord.com/developers/intro), with no changes.
|
|
34
|
+
|
|
35
|
+
You can listen to any gateway event directly using `Shard.ws.on(...)` and perform raw REST requests using `Client.rest.request(...)`
|
|
36
|
+
|
|
37
|
+
This allows you to use new Discord features immediately, even before a dedicated **disgroove** update is released.
|
|
38
|
+
|
|
39
|
+
## Example
|
|
12
40
|
```js
|
|
13
41
|
const {
|
|
14
42
|
Client,
|
|
@@ -17,7 +45,7 @@ const {
|
|
|
17
45
|
InteractionCallbackType,
|
|
18
46
|
MessageFlags,
|
|
19
47
|
} = require("disgroove");
|
|
20
|
-
const client = new Client(
|
|
48
|
+
const client = new Client(process.env.TOKEN);
|
|
21
49
|
|
|
22
50
|
client.once("ready", () => {
|
|
23
51
|
console.log("Logged in as", client.user.username);
|
|
@@ -28,7 +56,7 @@ client.once("ready", () => {
|
|
|
28
56
|
});
|
|
29
57
|
});
|
|
30
58
|
|
|
31
|
-
client.on("interactionCreate",
|
|
59
|
+
client.on("interactionCreate", (interaction) => {
|
|
32
60
|
if (interaction.type !== InteractionType.ApplicationCommand) return;
|
|
33
61
|
|
|
34
62
|
if (interaction.data.name === "ping") {
|
|
@@ -46,3 +74,5 @@ client.connect();
|
|
|
46
74
|
```
|
|
47
75
|
|
|
48
76
|
More examples on the [GitHub repository](https://github.com/sergiogotuzzo/disgroove/tree/main/examples)
|
|
77
|
+
|
|
78
|
+
> Enjoy **disgroove**? Leave a ⭐ to this repository!
|
package/dist/lib/constants.d.ts
CHANGED
|
@@ -138,7 +138,10 @@ export declare enum ComponentTypes {
|
|
|
138
138
|
Separator = 14,
|
|
139
139
|
Container = 17,
|
|
140
140
|
Label = 18,
|
|
141
|
-
FileUpload = 19
|
|
141
|
+
FileUpload = 19,
|
|
142
|
+
RadioGroup = 21,
|
|
143
|
+
CheckboxGroup = 22,
|
|
144
|
+
Checkbox = 23
|
|
142
145
|
}
|
|
143
146
|
/** https://discord.com/developers/docs/components/reference#button-button-styles */
|
|
144
147
|
export declare enum ButtonStyles {
|
package/dist/lib/constants.js
CHANGED
|
@@ -155,6 +155,9 @@ var ComponentTypes;
|
|
|
155
155
|
ComponentTypes[ComponentTypes["Container"] = 17] = "Container";
|
|
156
156
|
ComponentTypes[ComponentTypes["Label"] = 18] = "Label";
|
|
157
157
|
ComponentTypes[ComponentTypes["FileUpload"] = 19] = "FileUpload";
|
|
158
|
+
ComponentTypes[ComponentTypes["RadioGroup"] = 21] = "RadioGroup";
|
|
159
|
+
ComponentTypes[ComponentTypes["CheckboxGroup"] = 22] = "CheckboxGroup";
|
|
160
|
+
ComponentTypes[ComponentTypes["Checkbox"] = 23] = "Checkbox";
|
|
158
161
|
})(ComponentTypes || (exports.ComponentTypes = ComponentTypes = {}));
|
|
159
162
|
/** https://discord.com/developers/docs/components/reference#button-button-styles */
|
|
160
163
|
var ButtonStyles;
|
|
@@ -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, RawFileUpload, FileUpload } 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, RawRadioGroup, RadioGroup, RawCheckbox, Checkbox, RawCheckboxGroup, CheckboxGroup } from "../types/components";
|
|
2
2
|
export declare class Components {
|
|
3
3
|
static actionRowFromRaw(actionRow: RawActionRow): ActionRow;
|
|
4
4
|
static actionRowToRaw(actionRow: ActionRow): RawActionRow;
|
|
@@ -6,6 +6,10 @@ export declare class Components {
|
|
|
6
6
|
static buttonToRaw(button: Button): RawButton;
|
|
7
7
|
static channelSelectFromRaw(channelSelect: RawChannelSelect): ChannelSelect;
|
|
8
8
|
static channelSelectToRaw(channelSelect: ChannelSelect): RawChannelSelect;
|
|
9
|
+
static checkboxFromRaw(checkbox: RawCheckbox): Checkbox;
|
|
10
|
+
static checkboxToRaw(checkbox: Checkbox): RawCheckbox;
|
|
11
|
+
static checkboxGroupFromRaw(checkboxGroup: RawCheckboxGroup): CheckboxGroup;
|
|
12
|
+
static checkboxGroupToRaw(checkboxGroup: CheckboxGroup): RawCheckboxGroup;
|
|
9
13
|
static containerFromRaw(container: RawContainer): Container;
|
|
10
14
|
static containerToRaw(container: Container): RawContainer;
|
|
11
15
|
static fileFromRaw(file: RawFile): File;
|
|
@@ -18,6 +22,8 @@ export declare class Components {
|
|
|
18
22
|
static mediaGalleryToRaw(mediaGallery: MediaGallery): RawMediaGallery;
|
|
19
23
|
static mentionableSelectFromRaw(mentionableSelect: RawMentionableSelect): MentionableSelect;
|
|
20
24
|
static mentionableSelectToRaw(mentionableSelect: MentionableSelect): RawMentionableSelect;
|
|
25
|
+
static radioGroupFromRaw(radioGroup: RawRadioGroup): RadioGroup;
|
|
26
|
+
static radioGroupToRaw(radioGroup: RadioGroup): RawRadioGroup;
|
|
21
27
|
static roleSelectFromRaw(roleSelect: RawRoleSelect): RoleSelect;
|
|
22
28
|
static roleSelectToRaw(roleSelect: RoleSelect): RawRoleSelect;
|
|
23
29
|
static sectionFromRaw(section: RawSection): Section;
|
|
@@ -103,6 +103,44 @@ class Components {
|
|
|
103
103
|
disabled: channelSelect.disabled,
|
|
104
104
|
};
|
|
105
105
|
}
|
|
106
|
+
static checkboxFromRaw(checkbox) {
|
|
107
|
+
return {
|
|
108
|
+
type: checkbox.type,
|
|
109
|
+
id: checkbox.id,
|
|
110
|
+
customId: checkbox.custom_id,
|
|
111
|
+
default: checkbox.default,
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
static checkboxToRaw(checkbox) {
|
|
115
|
+
return {
|
|
116
|
+
type: checkbox.type,
|
|
117
|
+
id: checkbox.id,
|
|
118
|
+
custom_id: checkbox.customId,
|
|
119
|
+
default: checkbox.default,
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
static checkboxGroupFromRaw(checkboxGroup) {
|
|
123
|
+
return {
|
|
124
|
+
type: checkboxGroup.type,
|
|
125
|
+
id: checkboxGroup.id,
|
|
126
|
+
customId: checkboxGroup.custom_id,
|
|
127
|
+
options: checkboxGroup.options,
|
|
128
|
+
minValues: checkboxGroup.min_values,
|
|
129
|
+
maxValues: checkboxGroup.max_values,
|
|
130
|
+
required: checkboxGroup.required,
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
static checkboxGroupToRaw(checkboxGroup) {
|
|
134
|
+
return {
|
|
135
|
+
type: checkboxGroup.type,
|
|
136
|
+
id: checkboxGroup.id,
|
|
137
|
+
custom_id: checkboxGroup.customId,
|
|
138
|
+
options: checkboxGroup.options,
|
|
139
|
+
min_values: checkboxGroup.minValues,
|
|
140
|
+
max_values: checkboxGroup.maxValues,
|
|
141
|
+
required: checkboxGroup.required,
|
|
142
|
+
};
|
|
143
|
+
}
|
|
106
144
|
static containerFromRaw(container) {
|
|
107
145
|
return {
|
|
108
146
|
type: container.type,
|
|
@@ -227,6 +265,14 @@ class Components {
|
|
|
227
265
|
case constants_1.ComponentTypes.FileUpload:
|
|
228
266
|
component = Components.fileUploadFromRaw(label.component);
|
|
229
267
|
break;
|
|
268
|
+
case constants_1.ComponentTypes.RadioGroup:
|
|
269
|
+
component = Components.radioGroupFromRaw(label.component);
|
|
270
|
+
break;
|
|
271
|
+
case constants_1.ComponentTypes.CheckboxGroup:
|
|
272
|
+
component = Components.checkboxGroupFromRaw(label.component);
|
|
273
|
+
break;
|
|
274
|
+
case constants_1.ComponentTypes.Checkbox:
|
|
275
|
+
component = Components.checkboxFromRaw(label.component);
|
|
230
276
|
}
|
|
231
277
|
return {
|
|
232
278
|
type: label.type,
|
|
@@ -260,6 +306,14 @@ class Components {
|
|
|
260
306
|
case constants_1.ComponentTypes.FileUpload:
|
|
261
307
|
component = Components.fileUploadToRaw(label.component);
|
|
262
308
|
break;
|
|
309
|
+
case constants_1.ComponentTypes.RadioGroup:
|
|
310
|
+
component = Components.radioGroupToRaw(label.component);
|
|
311
|
+
break;
|
|
312
|
+
case constants_1.ComponentTypes.CheckboxGroup:
|
|
313
|
+
component = Components.checkboxGroupToRaw(label.component);
|
|
314
|
+
break;
|
|
315
|
+
case constants_1.ComponentTypes.Checkbox:
|
|
316
|
+
component = Components.checkboxToRaw(label.component);
|
|
263
317
|
}
|
|
264
318
|
return {
|
|
265
319
|
type: label.type,
|
|
@@ -315,6 +369,24 @@ class Components {
|
|
|
315
369
|
disabled: mentionableSelect.disabled,
|
|
316
370
|
};
|
|
317
371
|
}
|
|
372
|
+
static radioGroupFromRaw(radioGroup) {
|
|
373
|
+
return {
|
|
374
|
+
type: radioGroup.type,
|
|
375
|
+
id: radioGroup.id,
|
|
376
|
+
customId: radioGroup.custom_id,
|
|
377
|
+
options: radioGroup.options,
|
|
378
|
+
required: radioGroup.required,
|
|
379
|
+
};
|
|
380
|
+
}
|
|
381
|
+
static radioGroupToRaw(radioGroup) {
|
|
382
|
+
return {
|
|
383
|
+
type: radioGroup.type,
|
|
384
|
+
id: radioGroup.id,
|
|
385
|
+
custom_id: radioGroup.customId,
|
|
386
|
+
options: radioGroup.options,
|
|
387
|
+
required: radioGroup.required,
|
|
388
|
+
};
|
|
389
|
+
}
|
|
318
390
|
static roleSelectFromRaw(roleSelect) {
|
|
319
391
|
return {
|
|
320
392
|
type: roleSelect.type,
|
|
@@ -211,6 +211,29 @@ class Interactions {
|
|
|
211
211
|
values: component.component.values,
|
|
212
212
|
};
|
|
213
213
|
break;
|
|
214
|
+
case constants_1.ComponentTypes.RadioGroup:
|
|
215
|
+
c = {
|
|
216
|
+
type: component.component.type,
|
|
217
|
+
id: component.component.id,
|
|
218
|
+
customId: component.component.custom_id,
|
|
219
|
+
value: component.component.value
|
|
220
|
+
};
|
|
221
|
+
break;
|
|
222
|
+
case constants_1.ComponentTypes.CheckboxGroup:
|
|
223
|
+
c = {
|
|
224
|
+
type: component.component.type,
|
|
225
|
+
id: component.component.id,
|
|
226
|
+
customId: component.component.custom_id,
|
|
227
|
+
values: component.component.values,
|
|
228
|
+
};
|
|
229
|
+
break;
|
|
230
|
+
case constants_1.ComponentTypes.Checkbox:
|
|
231
|
+
c = {
|
|
232
|
+
type: component.component.type,
|
|
233
|
+
id: component.component.id,
|
|
234
|
+
customId: component.component.custom_id,
|
|
235
|
+
value: component.component.value
|
|
236
|
+
};
|
|
214
237
|
}
|
|
215
238
|
return {
|
|
216
239
|
type: component.type,
|
|
@@ -449,6 +472,29 @@ class Interactions {
|
|
|
449
472
|
values: component.component.values,
|
|
450
473
|
};
|
|
451
474
|
break;
|
|
475
|
+
case constants_1.ComponentTypes.RadioGroup:
|
|
476
|
+
c = {
|
|
477
|
+
type: component.component.type,
|
|
478
|
+
id: component.component.id,
|
|
479
|
+
custom_id: component.component.customId,
|
|
480
|
+
value: component.component.value
|
|
481
|
+
};
|
|
482
|
+
break;
|
|
483
|
+
case constants_1.ComponentTypes.CheckboxGroup:
|
|
484
|
+
c = {
|
|
485
|
+
type: component.component.type,
|
|
486
|
+
id: component.component.id,
|
|
487
|
+
custom_id: component.component.customId,
|
|
488
|
+
values: component.component.values,
|
|
489
|
+
};
|
|
490
|
+
break;
|
|
491
|
+
case constants_1.ComponentTypes.Checkbox:
|
|
492
|
+
c = {
|
|
493
|
+
type: component.component.type,
|
|
494
|
+
id: component.component.id,
|
|
495
|
+
custom_id: component.component.customId,
|
|
496
|
+
value: component.component.value
|
|
497
|
+
};
|
|
452
498
|
}
|
|
453
499
|
return {
|
|
454
500
|
type: component.type,
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import type { RawInvite, Invite } from "../types/invite";
|
|
2
|
+
import { RawRole, Role } from "../types/role";
|
|
2
3
|
export declare class Invites {
|
|
3
4
|
static inviteFromRaw(invite: RawInvite): Invite;
|
|
4
5
|
static inviteToRaw(invite: Invite): RawInvite;
|
|
6
|
+
static partialRoleFromRaw(role: Pick<RawRole, "id" | "name" | "position" | "color" | "colors" | "icon" | "unicode_emoji">): Pick<Role, "id" | "name" | "position" | "color" | "colors" | "icon" | "unicodeEmoji">;
|
|
7
|
+
static partialRoleToRaw(role: Pick<Role, "id" | "name" | "position" | "color" | "colors" | "icon" | "unicodeEmoji">): Pick<RawRole, "id" | "name" | "position" | "color" | "colors" | "icon" | "unicode_emoji">;
|
|
5
8
|
}
|
|
@@ -40,6 +40,7 @@ class Invites {
|
|
|
40
40
|
? GuildScheduledEvents_1.GuildScheduledEvents.guildScheduledEventFromRaw(invite.guild_scheduled_event)
|
|
41
41
|
: undefined,
|
|
42
42
|
flags: invite.flags,
|
|
43
|
+
roles: invite.roles?.map((role) => Invites.partialRoleFromRaw(role))
|
|
43
44
|
};
|
|
44
45
|
}
|
|
45
46
|
static inviteToRaw(invite) {
|
|
@@ -75,6 +76,37 @@ class Invites {
|
|
|
75
76
|
? GuildScheduledEvents_1.GuildScheduledEvents.guildScheduledEventToRaw(invite.guildScheduledEvent)
|
|
76
77
|
: undefined,
|
|
77
78
|
flags: invite.flags,
|
|
79
|
+
roles: invite.roles?.map((role) => Invites.partialRoleToRaw(role))
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
static partialRoleFromRaw(role) {
|
|
83
|
+
return {
|
|
84
|
+
id: role.id,
|
|
85
|
+
name: role.name,
|
|
86
|
+
position: role.position,
|
|
87
|
+
color: role.color,
|
|
88
|
+
colors: {
|
|
89
|
+
primaryColor: role.colors.primary_color,
|
|
90
|
+
secondaryColor: role.colors.secondary_color,
|
|
91
|
+
tertiaryColor: role.colors.tertiary_color
|
|
92
|
+
},
|
|
93
|
+
icon: role.icon,
|
|
94
|
+
unicodeEmoji: role.unicode_emoji
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
static partialRoleToRaw(role) {
|
|
98
|
+
return {
|
|
99
|
+
id: role.id,
|
|
100
|
+
name: role.name,
|
|
101
|
+
position: role.position,
|
|
102
|
+
color: role.color,
|
|
103
|
+
colors: {
|
|
104
|
+
primary_color: role.colors.primaryColor,
|
|
105
|
+
secondary_color: role.colors.secondaryColor,
|
|
106
|
+
tertiary_color: role.colors.tertiaryColor
|
|
107
|
+
},
|
|
108
|
+
icon: role.icon,
|
|
109
|
+
unicode_emoji: role.unicodeEmoji
|
|
78
110
|
};
|
|
79
111
|
}
|
|
80
112
|
}
|
|
@@ -222,13 +222,13 @@ export interface RawLabel {
|
|
|
222
222
|
id?: number;
|
|
223
223
|
label: string;
|
|
224
224
|
description?: string;
|
|
225
|
-
component: RawTextInput | RawStringSelect | RawUserSelect | RawRoleSelect | RawMentionableSelect | RawChannelSelect | RawFileUpload;
|
|
225
|
+
component: RawTextInput | RawStringSelect | RawUserSelect | RawRoleSelect | RawMentionableSelect | RawChannelSelect | RawFileUpload | RawRadioGroup | RawCheckboxGroup | RawCheckbox;
|
|
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 | RawFileUploadInteractionResponse;
|
|
231
|
+
component: RawTextInputInteractionResponse | RawStringSelectInteractionResponse | RawUserSelectInteractionResponse | RawRoleSelectInteractionResponse | RawMentionableSelectInteractionResponse | RawChannelSelectInteractionResponse | RawFileUploadInteractionResponse | RawRadioGroupInteractionResponse | RawCheckboxGroupInteractionResponse | RawCheckboxInteractionResponse;
|
|
232
232
|
}
|
|
233
233
|
/** https://discord.com/developers/docs/components/reference#file-upload-file-upload-structure */
|
|
234
234
|
export interface RawFileUpload {
|
|
@@ -255,6 +255,66 @@ export interface RawUnfurledMediaItem {
|
|
|
255
255
|
content_type?: string;
|
|
256
256
|
attachment_id?: snowflake;
|
|
257
257
|
}
|
|
258
|
+
/** https://docs.discord.com/developers/components/reference#radio-group-structure */
|
|
259
|
+
export interface RawRadioGroup {
|
|
260
|
+
type: ComponentTypes.RadioGroup;
|
|
261
|
+
id?: number;
|
|
262
|
+
custom_id: string;
|
|
263
|
+
options: Array<RawRadioGroupOptions>;
|
|
264
|
+
required?: boolean;
|
|
265
|
+
}
|
|
266
|
+
/** https://docs.discord.com/developers/components/reference#radio-group-option-structure */
|
|
267
|
+
export interface RawRadioGroupOptions {
|
|
268
|
+
value: string;
|
|
269
|
+
label: string;
|
|
270
|
+
description?: string;
|
|
271
|
+
default?: boolean;
|
|
272
|
+
}
|
|
273
|
+
/** https://docs.discord.com/developers/components/reference#radio-group-interaction-response-structure */
|
|
274
|
+
export interface RawRadioGroupInteractionResponse {
|
|
275
|
+
type: ComponentTypes.RadioGroup;
|
|
276
|
+
id: number;
|
|
277
|
+
custom_id: string;
|
|
278
|
+
value: string | null;
|
|
279
|
+
}
|
|
280
|
+
/** https://docs.discord.com/developers/components/reference#checkbox-group-structure */
|
|
281
|
+
export interface RawCheckboxGroup {
|
|
282
|
+
type: ComponentTypes.CheckboxGroup;
|
|
283
|
+
id?: number;
|
|
284
|
+
custom_id: string;
|
|
285
|
+
options: Array<RawCheckboxGroupOptions>;
|
|
286
|
+
min_values?: number;
|
|
287
|
+
max_values?: number;
|
|
288
|
+
required?: boolean;
|
|
289
|
+
}
|
|
290
|
+
/** https://docs.discord.com/developers/components/reference#checkbox-group-option-structure */
|
|
291
|
+
export interface RawCheckboxGroupOptions {
|
|
292
|
+
value: string;
|
|
293
|
+
label: string;
|
|
294
|
+
description?: string;
|
|
295
|
+
default?: boolean;
|
|
296
|
+
}
|
|
297
|
+
/** https://docs.discord.com/developers/components/reference#checkbox-group-interaction-response-structure */
|
|
298
|
+
export interface RawCheckboxGroupInteractionResponse {
|
|
299
|
+
type: ComponentTypes.CheckboxGroup;
|
|
300
|
+
id: number;
|
|
301
|
+
custom_id: string;
|
|
302
|
+
values: Array<string>;
|
|
303
|
+
}
|
|
304
|
+
/** https://docs.discord.com/developers/components/reference#checkbox-structure */
|
|
305
|
+
export interface RawCheckbox {
|
|
306
|
+
type: ComponentTypes.Checkbox;
|
|
307
|
+
id?: number;
|
|
308
|
+
custom_id: string;
|
|
309
|
+
default?: boolean;
|
|
310
|
+
}
|
|
311
|
+
/** https://docs.discord.com/developers/components/reference#checkbox-interaction-response-structure */
|
|
312
|
+
export interface RawCheckboxInteractionResponse {
|
|
313
|
+
type: ComponentTypes.Checkbox;
|
|
314
|
+
id: number;
|
|
315
|
+
custom_id: string;
|
|
316
|
+
value: boolean;
|
|
317
|
+
}
|
|
258
318
|
/** https://discord.com/developers/docs/components/reference#action-row-action-row-structure */
|
|
259
319
|
export interface ActionRow {
|
|
260
320
|
type: ComponentTypes.ActionRow;
|
|
@@ -475,13 +535,13 @@ export interface Label {
|
|
|
475
535
|
id?: number;
|
|
476
536
|
label: string;
|
|
477
537
|
description?: string;
|
|
478
|
-
component: TextInput | StringSelect | UserSelect | RoleSelect | MentionableSelect | ChannelSelect | FileUpload;
|
|
538
|
+
component: TextInput | StringSelect | UserSelect | RoleSelect | MentionableSelect | ChannelSelect | FileUpload | RadioGroup | CheckboxGroup | Checkbox;
|
|
479
539
|
}
|
|
480
540
|
/** https://discord.com/developers/docs/components/reference#label-label-interaction-response-structure */
|
|
481
541
|
export interface LabelInteractionResponse {
|
|
482
542
|
type: ComponentTypes.Label;
|
|
483
543
|
id: number;
|
|
484
|
-
component: TextInputInteractionResponse | StringSelectInteractionResponse | UserSelectInteractionResponse | RoleSelectInteractionResponse | MentionableSelectInteractionResponse | ChannelSelectInteractionResponse | FileUploadInteractionResponse;
|
|
544
|
+
component: TextInputInteractionResponse | StringSelectInteractionResponse | UserSelectInteractionResponse | RoleSelectInteractionResponse | MentionableSelectInteractionResponse | ChannelSelectInteractionResponse | FileUploadInteractionResponse | RadioGroupInteractionResponse | CheckboxGroupInteractionResponse | CheckboxInteractionResponse;
|
|
485
545
|
}
|
|
486
546
|
/** https://discord.com/developers/docs/components/reference#file-upload-file-upload-structure */
|
|
487
547
|
export interface FileUpload {
|
|
@@ -508,3 +568,63 @@ export interface UnfurledMediaItem {
|
|
|
508
568
|
contentType?: string;
|
|
509
569
|
attachmentId?: snowflake;
|
|
510
570
|
}
|
|
571
|
+
/** https://docs.discord.com/developers/components/reference#radio-group-structure */
|
|
572
|
+
export interface RadioGroup {
|
|
573
|
+
type: ComponentTypes.RadioGroup;
|
|
574
|
+
id?: number;
|
|
575
|
+
customId: string;
|
|
576
|
+
options: Array<RadioGroupOptions>;
|
|
577
|
+
required?: boolean;
|
|
578
|
+
}
|
|
579
|
+
/** https://docs.discord.com/developers/components/reference#radio-group-option-structure */
|
|
580
|
+
export interface RadioGroupOptions {
|
|
581
|
+
value: string;
|
|
582
|
+
label: string;
|
|
583
|
+
description?: string;
|
|
584
|
+
default?: boolean;
|
|
585
|
+
}
|
|
586
|
+
/** https://docs.discord.com/developers/components/reference#radio-group-interaction-response-structure */
|
|
587
|
+
export interface RadioGroupInteractionResponse {
|
|
588
|
+
type: ComponentTypes.RadioGroup;
|
|
589
|
+
id: number;
|
|
590
|
+
customId: string;
|
|
591
|
+
value: string | null;
|
|
592
|
+
}
|
|
593
|
+
/** https://docs.discord.com/developers/components/reference#checkbox-group-structure */
|
|
594
|
+
export interface CheckboxGroup {
|
|
595
|
+
type: ComponentTypes.CheckboxGroup;
|
|
596
|
+
id?: number;
|
|
597
|
+
customId: string;
|
|
598
|
+
options: Array<CheckboxGroupOptions>;
|
|
599
|
+
minValues?: number;
|
|
600
|
+
maxValues?: number;
|
|
601
|
+
required?: boolean;
|
|
602
|
+
}
|
|
603
|
+
/** https://docs.discord.com/developers/components/reference#checkbox-group-option-structure */
|
|
604
|
+
export interface CheckboxGroupOptions {
|
|
605
|
+
value: string;
|
|
606
|
+
label: string;
|
|
607
|
+
description?: string;
|
|
608
|
+
default?: boolean;
|
|
609
|
+
}
|
|
610
|
+
/** https://docs.discord.com/developers/components/reference#checkbox-group-interaction-response-structure */
|
|
611
|
+
export interface CheckboxGroupInteractionResponse {
|
|
612
|
+
type: ComponentTypes.CheckboxGroup;
|
|
613
|
+
id: number;
|
|
614
|
+
customId: string;
|
|
615
|
+
values: Array<string>;
|
|
616
|
+
}
|
|
617
|
+
/** https://docs.discord.com/developers/components/reference#checkbox-structure */
|
|
618
|
+
export interface Checkbox {
|
|
619
|
+
type: ComponentTypes.Checkbox;
|
|
620
|
+
id?: number;
|
|
621
|
+
customId: string;
|
|
622
|
+
default?: boolean;
|
|
623
|
+
}
|
|
624
|
+
/** https://docs.discord.com/developers/components/reference#checkbox-interaction-response-structure */
|
|
625
|
+
export interface CheckboxInteractionResponse {
|
|
626
|
+
type: ComponentTypes.Checkbox;
|
|
627
|
+
id: number;
|
|
628
|
+
customId: string;
|
|
629
|
+
value: boolean;
|
|
630
|
+
}
|
|
@@ -22,7 +22,7 @@ export interface RawInvite {
|
|
|
22
22
|
stage_instance?: RawInviteStageInstance;
|
|
23
23
|
guild_scheduled_event?: RawGuildScheduledEvent;
|
|
24
24
|
flags?: GuildInviteFlags;
|
|
25
|
-
roles?: Array<RawRole
|
|
25
|
+
roles?: Array<Pick<RawRole, "id" | "name" | "position" | "color" | "colors" | "icon" | "unicode_emoji">>;
|
|
26
26
|
}
|
|
27
27
|
/** https://discord.com/developers/docs/resources/invite#invite-metadata-object-invite-metadata-structure */
|
|
28
28
|
export interface RawInviteMetadata {
|
|
@@ -55,7 +55,7 @@ export interface Invite {
|
|
|
55
55
|
stageInstance?: InviteStageInstance;
|
|
56
56
|
guildScheduledEvent?: GuildScheduledEvent;
|
|
57
57
|
flags?: GuildInviteFlags;
|
|
58
|
-
roles?: Array<Role
|
|
58
|
+
roles?: Array<Pick<Role, "id" | "name" | "position" | "color" | "colors" | "icon" | "unicodeEmoji">>;
|
|
59
59
|
}
|
|
60
60
|
/** https://discord.com/developers/docs/resources/invite#invite-metadata-object-invite-metadata-structure */
|
|
61
61
|
export interface InviteMetadata {
|
package/dist/package.json
CHANGED