disgroove 2.2.7-dev.4cca8cf → 2.2.7-dev.8886fa2

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.
@@ -5,8 +5,8 @@ import type { RawChannel, Channel } from "./channel";
5
5
  import type { snowflake } from "./common";
6
6
  import type { RawEntitlement, Entitlement } from "./entitlements";
7
7
  import type { RawGuildMember, GuildMember, Guild, RawGuild } from "./guild";
8
- import type { RawMessage, RawAttachment, RawEmbed, RawAllowedMentions, Message, Attachment, Embed, AllowedMentions, MessageTopLevelComponent, RawMessageTopLevelComponent } from "./message";
9
- import type { RawTextInput, TextInput } from "./message-components";
8
+ import type { RawMessage, RawAttachment, RawEmbed, RawAllowedMentions, Message, Attachment, Embed, AllowedMentions } from "./message";
9
+ import type { ActionRow, Container, File, Label, MediaGallery, RawActionRow, RawContainer, RawFile, RawLabel, RawMediaGallery, RawSection, RawSeparator, RawTextDisplay, Section, Separator, TextDisplay } from "./message-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";
@@ -54,10 +54,7 @@ export interface RawMessageComponentData {
54
54
  /** https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-modal-submit-data-structure */
55
55
  export interface RawModalSubmitData {
56
56
  custom_id: string;
57
- components: Array<{
58
- type: ComponentTypes.ActionRow;
59
- components: Array<RawTextInput>;
60
- }>;
57
+ components: Array<RawActionRow | RawTextDisplay | RawLabel>;
61
58
  }
62
59
  /** https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-resolved-data-structure */
63
60
  export interface RawResolvedData {
@@ -96,7 +93,7 @@ export interface RawInteractionCallbackData {
96
93
  embeds?: Array<RawEmbed>;
97
94
  allowed_mentions?: RawAllowedMentions;
98
95
  flags?: MessageFlags;
99
- components?: Array<RawMessageTopLevelComponent>;
96
+ components?: Array<RawActionRow | RawSection | RawTextDisplay | RawMediaGallery | RawFile | RawSeparator | RawContainer | RawLabel>;
100
97
  attachments?: Array<Pick<RawAttachment, "filename" | "description">>;
101
98
  poll?: RawPollCreateParams;
102
99
  files?: Array<FileData>;
@@ -168,10 +165,7 @@ export interface MessageComponentData {
168
165
  }
169
166
  export interface ModalSubmitData {
170
167
  customID: string;
171
- components: Array<{
172
- type: ComponentTypes.ActionRow;
173
- components: Array<TextInput>;
174
- }>;
168
+ components: Array<ActionRow | TextDisplay | Label>;
175
169
  }
176
170
  export interface ResolvedData {
177
171
  users?: Record<snowflake, User>;
@@ -205,7 +199,7 @@ export interface InteractionCallbackData {
205
199
  embeds?: Array<Embed>;
206
200
  allowedMentions?: AllowedMentions;
207
201
  flags?: MessageFlags;
208
- components?: Array<MessageTopLevelComponent>;
202
+ components?: Array<ActionRow | Section | TextDisplay | MediaGallery | File | Separator | Container | Label>;
209
203
  attachments?: Array<Pick<Attachment, "filename" | "description">>;
210
204
  poll?: PollCreateParams;
211
205
  files?: Array<FileData>;
@@ -1,81 +1,113 @@
1
1
  import type { ButtonStyles, ChannelTypes, ComponentTypes, SeparatorSpacing, TextInputStyles } from "../constants";
2
2
  import type { snowflake } from "./common";
3
3
  import type { RawEmoji, Emoji } from "./emoji";
4
+ /** https://discord.com/developers/docs/components/reference#action-row-action-row-structure */
5
+ export interface RawActionRow {
6
+ type: ComponentTypes.ActionRow;
7
+ components: Array<RawButton | RawStringSelect | RawTextInput | RawUserSelect | RawRoleSelect | RawMentionableSelect | RawChannelSelect>;
8
+ id?: number;
9
+ }
4
10
  /** https://discord.com/developers/docs/components/reference#button-button-structure */
5
11
  export interface RawButton {
6
12
  type: ComponentTypes.Button;
13
+ id?: number;
7
14
  style: ButtonStyles;
8
15
  label?: string;
9
16
  emoji?: Pick<RawEmoji, "name" | "id" | "animated">;
10
- custom_id?: string;
17
+ custom_id: string;
11
18
  sku_id?: snowflake;
12
19
  url?: string;
13
20
  disabled?: boolean;
14
- id?: number;
15
21
  }
16
- /** https://discord.com/developers/docs/components/reference#container-container-structure */
17
- export interface RawContainer {
18
- type: ComponentTypes.Container;
22
+ /** https://discord.com/developers/docs/components/reference#string-select-string-select-structure */
23
+ export interface RawStringSelect {
24
+ type: ComponentTypes.StringSelect;
19
25
  id?: number;
20
- components: Array<RawActionRow | RawTextDisplay | RawSection | RawMediaGallery | RawSeparator | RawFile>;
21
- accent_color?: number | null;
22
- spoiler?: boolean;
26
+ custom_id: string;
27
+ options: Array<RawSelectOption>;
28
+ placeholder?: string;
29
+ min_values?: number;
30
+ max_values?: number;
31
+ required?: boolean;
32
+ disabled?: boolean;
23
33
  }
24
- /** https://discord.com/developers/docs/components/reference#file-file-structure */
25
- export interface RawFile {
26
- type: ComponentTypes.File;
34
+ /** https://discord.com/developers/docs/components/reference#string-select-select-option-structure */
35
+ export interface RawSelectOption {
36
+ label: string;
37
+ value: string;
38
+ description?: string;
39
+ emoji?: Pick<RawEmoji, "name" | "id" | "animated">;
40
+ default?: boolean;
41
+ }
42
+ /** https://discord.com/developers/docs/components/reference#text-input-text-input-structure */
43
+ export interface RawTextInput {
44
+ type: ComponentTypes.TextInput;
27
45
  id?: number;
28
- file: RawUnfurledMediaItem;
29
- spoiler?: boolean;
30
- name: string;
31
- size: number;
46
+ custom_id: string;
47
+ style: TextInputStyles;
48
+ min_length?: number;
49
+ max_length?: number;
50
+ required?: boolean;
51
+ value?: string;
52
+ placeholder?: string;
53
+ label: string;
32
54
  }
33
- /** https://discord.com/developers/docs/components/reference#media-gallery-media-gallery-structure */
34
- export interface RawMediaGallery {
35
- type: ComponentTypes.MediaGallery;
55
+ /** https://discord.com/developers/docs/components/reference#user-select-user-select-structure */
56
+ export interface RawUserSelect {
57
+ type: ComponentTypes.UserSelect;
36
58
  id?: number;
37
- items: Array<RawMediaGalleryItem>;
59
+ custom_id: string;
60
+ placeholder?: string;
61
+ default_values?: Array<RawDefaultValue>;
62
+ min_values?: number;
63
+ max_values?: number;
64
+ disabled?: boolean;
38
65
  }
39
- /** https://discord.com/developers/docs/components/reference#media-gallery-media-gallery-item-structure */
40
- export interface RawMediaGalleryItem {
41
- media: RawUnfurledMediaItem;
42
- description?: string;
43
- spoiler?: boolean;
66
+ /** https://discord.com/developers/docs/components/reference#user-select-select-default-value-structure */
67
+ export interface RawDefaultValue {
68
+ id: snowflake;
69
+ type: "user" | "role" | "channel";
44
70
  }
45
- /** https://discord.com/developers/docs/components/reference#section-section-structure */
46
- export interface RawSection {
47
- type: ComponentTypes.Section;
71
+ /** https://discord.com/developers/docs/components/reference#role-select-role-select-structure */
72
+ export interface RawRoleSelect {
73
+ type: ComponentTypes.RoleSelect;
48
74
  id?: number;
49
- components: Array<RawTextDisplay>;
50
- accessory: RawThumbnail | RawButton;
51
- }
52
- /** https://discord.com/developers/docs/interactions/message-components#select-menu-object-select-menu-structure */
53
- export interface RawSelectMenu {
54
- type: ComponentTypes.ChannelSelect | ComponentTypes.MentionableSelect | ComponentTypes.RoleSelect | ComponentTypes.StringSelect | ComponentTypes.UserSelect;
55
75
  custom_id: string;
56
- options?: Array<RawSelectOption>;
57
- channel_types?: Array<ChannelTypes>;
58
76
  placeholder?: string;
59
77
  default_values?: Array<RawDefaultValue>;
60
78
  min_values?: number;
61
79
  max_values?: number;
62
80
  disabled?: boolean;
81
+ }
82
+ /** https://discord.com/developers/docs/components/reference#mentionable-select-mentionable-select-structure */
83
+ export interface RawMentionableSelect {
84
+ type: ComponentTypes.MentionableSelect;
63
85
  id?: number;
86
+ custom_id: string;
87
+ placeholder?: string;
88
+ default_values?: Array<RawDefaultValue>;
89
+ min_values?: number;
90
+ max_values?: number;
91
+ disabled?: boolean;
64
92
  }
65
- /** https://discord.com/developers/docs/components/reference#string-select-select-option-structure */
66
- export interface RawSelectOption {
67
- label: string;
68
- value: string;
69
- description?: string;
70
- emoji?: Pick<RawEmoji, "name" | "id" | "animated">;
71
- default?: boolean;
93
+ /** https://discord.com/developers/docs/components/reference#channel-select-channel-select-structure */
94
+ export interface RawChannelSelect {
95
+ type: ComponentTypes.ChannelSelect;
96
+ id?: number;
97
+ custom_id: string;
98
+ channel_types?: Array<ChannelTypes>;
99
+ placeholder?: string;
100
+ default_values?: Array<RawDefaultValue>;
101
+ min_values?: number;
102
+ max_values?: number;
103
+ disabled?: boolean;
72
104
  }
73
- /** https://discord.com/developers/docs/components/reference#separator-separator-structure */
74
- export interface RawSeparator {
75
- type: ComponentTypes.Separator;
105
+ /** https://discord.com/developers/docs/components/reference#section-section-structure */
106
+ export interface RawSection {
107
+ type: ComponentTypes.Section;
76
108
  id?: number;
77
- divider?: boolean;
78
- spacing?: SeparatorSpacing;
109
+ components: Array<RawTextDisplay>;
110
+ accessory: RawButton | RawThumbnail;
79
111
  }
80
112
  /** https://discord.com/developers/docs/components/reference#text-display-text-display-structure */
81
113
  export interface RawTextDisplay {
@@ -91,31 +123,51 @@ export interface RawThumbnail {
91
123
  description?: string;
92
124
  spoiler?: boolean;
93
125
  }
94
- /** https://discord.com/developers/docs/components/reference#user-select-select-default-value-structure */
95
- export interface RawDefaultValue {
96
- id: snowflake;
97
- type: string;
126
+ /** https://discord.com/developers/docs/components/reference#media-gallery-media-gallery-structure */
127
+ export interface RawMediaGallery {
128
+ type: ComponentTypes.MediaGallery;
129
+ id?: number;
130
+ items: Array<RawMediaGalleryItem>;
98
131
  }
99
- /** https://discord.com/developers/docs/components/reference#text-input-text-input-structure */
100
- export interface RawTextInput {
101
- type: ComponentTypes.TextInput;
102
- custom_id: string;
103
- style: TextInputStyles;
104
- label: string;
105
- min_length?: number;
106
- max_length?: number;
107
- required?: boolean;
108
- value?: string;
109
- placeholder?: string;
132
+ /** https://discord.com/developers/docs/components/reference#media-gallery-media-gallery-item-structure */
133
+ export interface RawMediaGalleryItem {
134
+ media: RawUnfurledMediaItem;
135
+ description?: string;
136
+ spoiler?: boolean;
137
+ }
138
+ /** https://discord.com/developers/docs/components/reference#file-file-structure */
139
+ export interface RawFile {
140
+ type: ComponentTypes.File;
110
141
  id?: number;
142
+ file: RawUnfurledMediaItem;
143
+ spoiler?: boolean;
144
+ name: string;
145
+ size: number;
111
146
  }
112
- /** https://discord.com/developers/docs/components/reference#action-row-action-row-structure */
113
- export interface RawActionRow {
114
- type: ComponentTypes.ActionRow;
115
- components: Array<RawButton | RawSelectMenu | RawTextInput>;
147
+ /** https://discord.com/developers/docs/components/reference#separator-separator-structure */
148
+ export interface RawSeparator {
149
+ type: ComponentTypes.Separator;
150
+ id?: number;
151
+ divider?: boolean;
152
+ spacing?: SeparatorSpacing;
153
+ }
154
+ /** https://discord.com/developers/docs/components/reference#container-container-structure */
155
+ export interface RawContainer {
156
+ type: ComponentTypes.Container;
116
157
  id?: number;
158
+ components: Array<RawActionRow | RawTextDisplay | RawSection | RawMediaGallery | RawSeparator | RawFile>;
159
+ accent_color?: number | null;
160
+ spoiler?: boolean;
161
+ }
162
+ /** https://discord.com/developers/docs/components/reference#label-label-structure */
163
+ export interface RawLabel {
164
+ type: ComponentTypes.Label;
165
+ id?: number;
166
+ label: string;
167
+ description?: string;
168
+ component: RawTextInput | RawStringSelect;
117
169
  }
118
- /** https://discord.com/developers/docs/components/reference#unfurled-media-item-structure */
170
+ /** https://discord.com/developers/docs/components/reference#unfurled-media-item-unfurled-media-item-structure */
119
171
  export interface RawUnfurledMediaItem {
120
172
  url: string;
121
173
  proxy_url?: string;
@@ -124,72 +176,102 @@ export interface RawUnfurledMediaItem {
124
176
  content_type?: string;
125
177
  attachment_id?: snowflake;
126
178
  }
179
+ export interface ActionRow {
180
+ type: ComponentTypes.ActionRow;
181
+ components: Array<Button | StringSelect | TextInput | UserSelect | RoleSelect | MentionableSelect | ChannelSelect>;
182
+ id?: number;
183
+ }
127
184
  export interface Button {
128
185
  type: ComponentTypes.Button;
186
+ id?: number;
129
187
  style: ButtonStyles;
130
188
  label?: string;
131
189
  emoji?: Pick<Emoji, "name" | "id" | "animated">;
132
- customID?: string;
190
+ customID: string;
133
191
  skuID?: snowflake;
134
192
  url?: string;
135
193
  disabled?: boolean;
136
- id?: number;
137
194
  }
138
- export interface Container {
139
- type: ComponentTypes.Container;
195
+ export interface StringSelect {
196
+ type: ComponentTypes.StringSelect;
140
197
  id?: number;
141
- components: Array<ActionRow | TextDisplay | Section | MediaGallery | Separator | File>;
142
- accentColor?: number | null;
143
- spoiler?: boolean;
198
+ customID: string;
199
+ options: Array<SelectOption>;
200
+ placeholder?: string;
201
+ minValues?: number;
202
+ maxValues?: number;
203
+ required?: boolean;
204
+ disabled?: boolean;
144
205
  }
145
- export interface File {
146
- type: ComponentTypes.File;
206
+ export interface SelectOption {
207
+ label: string;
208
+ value: string;
209
+ description?: string;
210
+ emoji?: Pick<Emoji, "name" | "id" | "animated">;
211
+ default?: boolean;
212
+ }
213
+ export interface TextInput {
214
+ type: ComponentTypes.TextInput;
147
215
  id?: number;
148
- file: UnfurledMediaItem;
149
- spoiler?: boolean;
150
- name: string;
151
- size: number;
216
+ customID: string;
217
+ style: TextInputStyles;
218
+ minLength?: number;
219
+ maxLength?: number;
220
+ required?: boolean;
221
+ value?: string;
222
+ placeholder?: string;
223
+ label: string;
152
224
  }
153
- export interface MediaGallery {
154
- type: ComponentTypes.MediaGallery;
225
+ export interface UserSelect {
226
+ type: ComponentTypes.UserSelect;
155
227
  id?: number;
156
- items: Array<MediaGalleryItem>;
228
+ customID: string;
229
+ placeholder?: string;
230
+ defaultValues?: Array<DefaultValue>;
231
+ minValues?: number;
232
+ maxValues?: number;
233
+ disabled?: boolean;
157
234
  }
158
- export interface MediaGalleryItem {
159
- media: UnfurledMediaItem;
160
- description?: string;
161
- spoiler?: boolean;
235
+ export interface DefaultValue {
236
+ id: snowflake;
237
+ type: "user" | "role" | "channel";
162
238
  }
163
- export interface Section {
164
- type: ComponentTypes.Section;
239
+ export interface RoleSelect {
240
+ type: ComponentTypes.RoleSelect;
165
241
  id?: number;
166
- components: Array<TextDisplay>;
167
- accessory: Thumbnail | Button;
168
- }
169
- export interface SelectMenu {
170
- type: ComponentTypes.ChannelSelect | ComponentTypes.MentionableSelect | ComponentTypes.RoleSelect | ComponentTypes.StringSelect | ComponentTypes.UserSelect;
171
242
  customID: string;
172
- options?: Array<SelectOption>;
173
- channelTypes?: Array<ChannelTypes>;
174
243
  placeholder?: string;
175
244
  defaultValues?: Array<DefaultValue>;
176
245
  minValues?: number;
177
246
  maxValues?: number;
178
247
  disabled?: boolean;
248
+ }
249
+ export interface MentionableSelect {
250
+ type: ComponentTypes.MentionableSelect;
179
251
  id?: number;
252
+ customID: string;
253
+ placeholder?: string;
254
+ defaultValues?: Array<DefaultValue>;
255
+ minValues?: number;
256
+ maxValues?: number;
257
+ disabled?: boolean;
180
258
  }
181
- export interface SelectOption {
182
- label: string;
183
- value: string;
184
- description?: string;
185
- emoji?: Pick<Emoji, "name" | "id" | "animated">;
186
- default?: boolean;
259
+ export interface ChannelSelect {
260
+ type: ComponentTypes.ChannelSelect;
261
+ id?: number;
262
+ customID: string;
263
+ channelTypes?: Array<ChannelTypes>;
264
+ placeholder?: string;
265
+ defaultValues?: Array<DefaultValue>;
266
+ minValues?: number;
267
+ maxValues?: number;
268
+ disabled?: boolean;
187
269
  }
188
- export interface Separator {
189
- type: ComponentTypes.Separator;
270
+ export interface Section {
271
+ type: ComponentTypes.Section;
190
272
  id?: number;
191
- divider?: boolean;
192
- spacing?: SeparatorSpacing;
273
+ components: Array<TextDisplay>;
274
+ accessory: Button | Thumbnail;
193
275
  }
194
276
  export interface TextDisplay {
195
277
  type: ComponentTypes.TextDisplay;
@@ -203,26 +285,43 @@ export interface Thumbnail {
203
285
  description?: string;
204
286
  spoiler?: boolean;
205
287
  }
206
- export interface DefaultValue {
207
- id: snowflake;
208
- type: string;
288
+ export interface MediaGallery {
289
+ type: ComponentTypes.MediaGallery;
290
+ id?: number;
291
+ items: Array<MediaGalleryItem>;
209
292
  }
210
- export interface TextInput {
211
- type: ComponentTypes.TextInput;
212
- customID: string;
213
- style: TextInputStyles;
214
- label: string;
215
- minLength?: number;
216
- maxLength?: number;
217
- required?: boolean;
218
- value?: string;
219
- placeholder?: string;
293
+ export interface MediaGalleryItem {
294
+ media: UnfurledMediaItem;
295
+ description?: string;
296
+ spoiler?: boolean;
297
+ }
298
+ export interface File {
299
+ type: ComponentTypes.File;
220
300
  id?: number;
301
+ file: UnfurledMediaItem;
302
+ spoiler?: boolean;
303
+ name: string;
304
+ size: number;
221
305
  }
222
- export interface ActionRow {
223
- type: ComponentTypes.ActionRow;
224
- components: Array<Button | SelectMenu | TextInput>;
306
+ export interface Separator {
307
+ type: ComponentTypes.Separator;
225
308
  id?: number;
309
+ divider?: boolean;
310
+ spacing?: SeparatorSpacing;
311
+ }
312
+ export interface Container {
313
+ type: ComponentTypes.Container;
314
+ id?: number;
315
+ components: Array<ActionRow | TextDisplay | Section | MediaGallery | Separator | File>;
316
+ accentColor?: number | null;
317
+ spoiler?: boolean;
318
+ }
319
+ export interface Label {
320
+ type: ComponentTypes.Label;
321
+ id?: number;
322
+ label: string;
323
+ description?: string;
324
+ component: TextInput | StringSelect;
226
325
  }
227
326
  export interface UnfurledMediaItem {
228
327
  url: string;
@@ -38,7 +38,7 @@ export interface RawMessage {
38
38
  interaction_metadata?: RawMessageInteractionMetadata;
39
39
  interaction?: RawMessageInteraction;
40
40
  thread?: RawChannel;
41
- components?: Array<RawMessageTopLevelComponent>;
41
+ components?: Array<RawActionRow | RawSection | RawTextDisplay | RawMediaGallery | RawFile | RawSeparator | RawContainer>;
42
42
  sticker_items?: Array<RawStickerItem>;
43
43
  stickers?: Array<RawSticker>;
44
44
  position?: number;
@@ -47,7 +47,6 @@ export interface RawMessage {
47
47
  poll?: RawPoll;
48
48
  call?: RawMessageCall;
49
49
  }
50
- export type RawMessageTopLevelComponent = RawActionRow | RawTextDisplay | RawContainer | RawFile | RawSection | RawSeparator | RawMediaGallery;
51
50
  /** https://discord.com/developers/docs/resources/message#message-object-message-activity-structure */
52
51
  export interface RawMessageActivity {
53
52
  type: MessageActivityTypes;
@@ -231,7 +230,7 @@ export interface Message {
231
230
  interactionMetadata?: MessageInteractionMetadata;
232
231
  interaction?: MessageInteraction;
233
232
  thread?: Channel;
234
- components?: Array<MessageTopLevelComponent>;
233
+ components?: Array<ActionRow | Section | TextDisplay | MediaGallery | File | Separator | Container>;
235
234
  stickerItems?: Array<StickerItem>;
236
235
  stickers?: Array<Sticker>;
237
236
  position?: number;
@@ -240,7 +239,6 @@ export interface Message {
240
239
  poll?: Poll;
241
240
  call?: MessageCall;
242
241
  }
243
- export type MessageTopLevelComponent = ActionRow | TextDisplay | Container | File | Section | Separator | MediaGallery;
244
242
  export interface MessageActivity {
245
243
  type: MessageActivityTypes;
246
244
  partyID?: string;
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "disgroove",
3
- "version": "2.2.7-dev.4cca8cf",
3
+ "version": "2.2.7-dev.8886fa2",
4
4
  "description": "A module to interface with Discord",
5
5
  "main": "./dist/lib/index.js",
6
6
  "types": "./dist/lib/index.d.ts",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "disgroove",
3
- "version": "2.2.7-dev.4cca8cf",
3
+ "version": "2.2.7-dev.8886fa2",
4
4
  "description": "A module to interface with Discord",
5
5
  "main": "./dist/lib/index.js",
6
6
  "types": "./dist/lib/index.d.ts",