disgroove 2.0.0-dev.3a6f4ba → 2.0.0-dev.825fc77

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.
Files changed (93) hide show
  1. package/dist/lib/Client.d.ts +560 -142
  2. package/dist/lib/Client.js +1794 -124
  3. package/dist/lib/Client.js.map +1 -1
  4. package/dist/lib/constants.d.ts +7 -7
  5. package/dist/lib/constants.js +218 -218
  6. package/dist/lib/gateway/Shard.d.ts +0 -1
  7. package/dist/lib/gateway/Shard.js +65 -261
  8. package/dist/lib/gateway/Shard.js.map +1 -1
  9. package/dist/lib/gateway/ShardManager.d.ts +1 -2
  10. package/dist/lib/gateway/ShardManager.js +1 -2
  11. package/dist/lib/gateway/ShardManager.js.map +1 -1
  12. package/dist/lib/index.d.ts +0 -1
  13. package/dist/lib/index.js +0 -1
  14. package/dist/lib/index.js.map +1 -1
  15. package/dist/lib/rest/Endpoints.d.ts +3 -3
  16. package/dist/lib/rest/Endpoints.js +8 -8
  17. package/dist/lib/rest/Endpoints.js.map +1 -1
  18. package/dist/lib/rest/RequestManager.d.ts +8 -2
  19. package/dist/lib/rest/RequestManager.js +17 -10
  20. package/dist/lib/rest/RequestManager.js.map +1 -1
  21. package/dist/lib/rest/index.d.ts +0 -1
  22. package/dist/lib/rest/index.js +0 -1
  23. package/dist/lib/rest/index.js.map +1 -1
  24. package/dist/lib/structures/Application.d.ts +93 -11
  25. package/dist/lib/structures/Application.js.map +1 -1
  26. package/dist/lib/structures/ApplicationCommand.d.ts +18 -6
  27. package/dist/lib/structures/ApplicationCommand.js.map +1 -1
  28. package/dist/lib/structures/AutoModerationRule.d.ts +11 -2
  29. package/dist/lib/structures/AutoModerationRule.js.map +1 -1
  30. package/dist/lib/structures/Channel.d.ts +108 -14
  31. package/dist/lib/structures/Channel.js +1 -1
  32. package/dist/lib/structures/Channel.js.map +1 -1
  33. package/dist/lib/structures/ClientApplication.d.ts +93 -11
  34. package/dist/lib/structures/ClientApplication.js.map +1 -1
  35. package/dist/lib/structures/Emoji.d.ts +5 -2
  36. package/dist/lib/structures/Emoji.js.map +1 -1
  37. package/dist/lib/structures/Guild.d.ts +234 -31
  38. package/dist/lib/structures/Guild.js.map +1 -1
  39. package/dist/lib/structures/GuildMember.d.ts +14 -3
  40. package/dist/lib/structures/GuildMember.js.map +1 -1
  41. package/dist/lib/structures/GuildScheduledEvent.d.ts +13 -2
  42. package/dist/lib/structures/GuildScheduledEvent.js.map +1 -1
  43. package/dist/lib/structures/GuildTemplate.d.ts +5 -2
  44. package/dist/lib/structures/GuildTemplate.js.map +1 -1
  45. package/dist/lib/structures/Interaction.d.ts +32 -7
  46. package/dist/lib/structures/Interaction.js.map +1 -1
  47. package/dist/lib/structures/Message.d.ts +16 -3
  48. package/dist/lib/structures/Message.js.map +1 -1
  49. package/dist/lib/structures/Role.d.ts +10 -2
  50. package/dist/lib/structures/Role.js.map +1 -1
  51. package/dist/lib/structures/StageInstance.d.ts +5 -2
  52. package/dist/lib/structures/StageInstance.js.map +1 -1
  53. package/dist/lib/structures/Sticker.d.ts +6 -2
  54. package/dist/lib/structures/Sticker.js.map +1 -1
  55. package/dist/lib/structures/User.d.ts +28 -9
  56. package/dist/lib/structures/User.js +3 -3
  57. package/dist/lib/structures/User.js.map +1 -1
  58. package/dist/lib/structures/Webhook.d.ts +35 -9
  59. package/dist/lib/structures/Webhook.js +14 -3
  60. package/dist/lib/structures/Webhook.js.map +1 -1
  61. package/dist/lib/types/application-command.d.ts +21 -21
  62. package/dist/lib/types/application-role-connection-metadata.d.ts +1 -1
  63. package/dist/lib/types/application.d.ts +17 -17
  64. package/dist/lib/types/audit-log.d.ts +15 -16
  65. package/dist/lib/types/auto-moderation.d.ts +11 -11
  66. package/dist/lib/types/channel.d.ts +83 -83
  67. package/dist/lib/types/emoji.d.ts +3 -3
  68. package/dist/lib/types/entitlements.d.ts +1 -1
  69. package/dist/lib/types/gateway-events.d.ts +11 -336
  70. package/dist/lib/types/guild-scheduled-event.d.ts +10 -10
  71. package/dist/lib/types/guild-template.d.ts +4 -4
  72. package/dist/lib/types/guild.d.ts +44 -45
  73. package/dist/lib/types/interaction.d.ts +37 -37
  74. package/dist/lib/types/invite.d.ts +12 -12
  75. package/dist/lib/types/message-components.d.ts +12 -12
  76. package/dist/lib/types/role.d.ts +3 -3
  77. package/dist/lib/types/sku.d.ts +8 -8
  78. package/dist/lib/types/stage-instance.d.ts +1 -1
  79. package/dist/lib/types/sticker.d.ts +6 -6
  80. package/dist/lib/types/team.d.ts +5 -5
  81. package/dist/lib/types/user.d.ts +6 -6
  82. package/dist/lib/types/voice.d.ts +4 -4
  83. package/dist/lib/types/webhook.d.ts +14 -14
  84. package/dist/lib/utils/Util.d.ts +0 -13
  85. package/dist/lib/utils/Util.js +0 -536
  86. package/dist/lib/utils/Util.js.map +1 -1
  87. package/dist/lib/utils/errors.d.ts +1 -1
  88. package/dist/lib/utils/errors.js +4 -4
  89. package/dist/lib/utils/index.d.ts +0 -1
  90. package/dist/lib/utils/index.js +0 -1
  91. package/dist/lib/utils/index.js.map +1 -1
  92. package/dist/package.json +1 -1
  93. package/package.json +1 -1
@@ -1,4 +1,4 @@
1
- import type { JSONGuildMember, RawGuildMember } from ".";
1
+ import type { GuildMember, RawGuildMember } from ".";
2
2
  /** https://discord.com/developers/docs/resources/voice#voice-state-object-voice-state-structure */
3
3
  export interface RawVoiceState {
4
4
  guild_id?: string;
@@ -23,11 +23,11 @@ export interface RawVoiceRegion {
23
23
  deprecated: boolean;
24
24
  custom: boolean;
25
25
  }
26
- export interface JSONVoiceState {
26
+ export interface VoiceState {
27
27
  guildId?: string;
28
28
  channelId: string | null;
29
29
  userId: string;
30
- member?: JSONGuildMember;
30
+ member?: GuildMember;
31
31
  sessionId: string;
32
32
  deaf: boolean;
33
33
  mute: boolean;
@@ -38,7 +38,7 @@ export interface JSONVoiceState {
38
38
  suppress: boolean;
39
39
  requestToSpeakTimestamp: string | null;
40
40
  }
41
- export interface JSONVoiceRegion {
41
+ export interface VoiceRegion {
42
42
  id: string;
43
43
  name: string;
44
44
  optimal: boolean;
@@ -1,5 +1,5 @@
1
1
  import type { MessageFlags, WebhookTypes } from "../constants";
2
- import type { JSONActionRow, JSONAllowedMentions, JSONAttachment, JSONChannel, JSONEmbed, JSONGuild, JSONUser, RawChannel, RawGuild, RawUser } from ".";
2
+ import type { ActionRow, AllowedMentions, Attachment, Channel, Embed, Guild, User, RawChannel, RawGuild, RawUser } from ".";
3
3
  import type { File } from "../rest";
4
4
  /** https://discord.com/developers/docs/resources/webhook#webhook-object-webhook-structure */
5
5
  export interface RawWebhook {
@@ -16,18 +16,18 @@ export interface RawWebhook {
16
16
  source_channel?: RawChannel;
17
17
  url?: string;
18
18
  }
19
- export interface JSONWebhook {
19
+ export interface Webhook {
20
20
  id: string;
21
21
  type: WebhookTypes;
22
22
  guildId?: string | null;
23
23
  channelId: string | null;
24
- user?: JSONUser;
24
+ user?: User;
25
25
  name: string | null;
26
26
  avatar: string | null;
27
27
  token?: string;
28
28
  applicationId: string | null;
29
- sourceGuild?: JSONGuild;
30
- sourceChannel?: JSONChannel;
29
+ sourceGuild?: Guild;
30
+ sourceChannel?: Channel;
31
31
  url?: string;
32
32
  }
33
33
  export interface CreateWebhookParams {
@@ -42,22 +42,22 @@ export interface EditWebhookParams {
42
42
  export interface ExecuteWebhookParams {
43
43
  content?: string | null;
44
44
  username?: string;
45
- avatarURL?: string;
45
+ avatarUrl?: string;
46
46
  tts?: boolean;
47
- embeds?: Array<JSONEmbed> | null;
48
- allowedMentions?: JSONAllowedMentions | null;
49
- components?: Array<JSONActionRow> | null;
47
+ embeds?: Array<Embed> | null;
48
+ allowedMentions?: AllowedMentions | null;
49
+ components?: Array<ActionRow> | null;
50
50
  files?: Array<File> | null;
51
- attachments?: Array<JSONAttachment> | null;
51
+ attachments?: Array<Attachment> | null;
52
52
  flags?: MessageFlags | null;
53
53
  threadName?: string;
54
54
  }
55
55
  export interface EditWebhookMessageParams {
56
56
  content?: string | null;
57
- embeds?: Array<JSONEmbed> | null;
57
+ embeds?: Array<Embed> | null;
58
58
  flags?: MessageFlags | null;
59
- allowedMentions?: JSONAllowedMentions | null;
60
- components?: Array<JSONActionRow> | null;
59
+ allowedMentions?: AllowedMentions | null;
60
+ components?: Array<ActionRow> | null;
61
61
  files?: Array<File> | null;
62
- attachments?: Array<JSONAttachment> | null;
62
+ attachments?: Array<Attachment> | null;
63
63
  }
@@ -1,17 +1,4 @@
1
- import type { JSONActionRow, JSONApplicationCommand, JSONAttachment, JSONChannel, JSONEmbed, JSONEmoji, JSONRole, JSONUser, PresenceUpdateEventFields, RawActionRow, RawApplicationCommand, RawAttachment, RawChannel, RawEmbed, RawEmoji, RawPresenceUpdateEventFields, RawRole, RawUser } from "../types";
2
- import type { Client } from "../Client";
3
1
  export declare class Util {
4
- applicationCommandToRaw(command: Partial<JSONApplicationCommand>): Partial<RawApplicationCommand>;
5
- attachmentToJSON(attachment: RawAttachment): JSONAttachment;
6
- channelToRaw(channel: JSONChannel): RawChannel;
7
- embedsToJSON(embeds: Array<RawEmbed>): Array<JSONEmbed>;
8
- embedsToRaw(embeds: Array<JSONEmbed>): Array<RawEmbed>;
9
- emojiToRaw(emoji: JSONEmoji): RawEmoji;
10
- messageComponentsToJSON(components: Array<RawActionRow>): Array<JSONActionRow>;
11
- messageComponentsToRaw(components: Array<JSONActionRow>): Array<RawActionRow>;
12
- presenceToREST(presence: RawPresenceUpdateEventFields, client: Client): PresenceUpdateEventFields;
13
- roleToRaw(role: JSONRole | Partial<JSONRole>): RawRole | Partial<RawRole>;
14
2
  toCamelCase<T>(obj: Record<string, any>): T;
15
3
  toSnakeCase<T>(obj: Record<string, any>): T;
16
- userToRaw(user: JSONUser): RawUser;
17
4
  }
@@ -1,522 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Util = void 0;
4
- const constants_1 = require("../constants");
5
- const structures_1 = require("../structures");
6
4
  class Util {
7
- applicationCommandToRaw(command) {
8
- return {
9
- id: command.id,
10
- type: command.type,
11
- application_id: command.applicationId,
12
- guild_id: command.guildId,
13
- name: command.name,
14
- name_localizations: command.nameLocalizations,
15
- description: command.description,
16
- description_localizations: command.descriptionLocalizations,
17
- options: command.options?.map((option) => ({
18
- type: option.type,
19
- name: option.name,
20
- name_localizations: option.nameLocalizations,
21
- description: option.description,
22
- description_localizations: option.descriptionLocalizations,
23
- required: option.required,
24
- choices: option.choices?.map((choice) => ({
25
- name: choice.name,
26
- name_localizations: choice.nameLocalizations,
27
- value: choice.value,
28
- })),
29
- options: option.options?.map((o) => ({
30
- type: o.type,
31
- name: o.name,
32
- name_localizations: o.nameLocalizations,
33
- description: o.description,
34
- description_localizations: o.descriptionLocalizations,
35
- required: o.required,
36
- choices: o.choices?.map((choice) => ({
37
- name: choice.name,
38
- name_localizations: choice.nameLocalizations,
39
- value: choice.value,
40
- })),
41
- channel_types: o.channelTypes,
42
- min_value: o.minValue,
43
- max_value: o.maxValue,
44
- min_length: o.minLength,
45
- max_length: o.maxLength,
46
- autocomplete: o.autocomplete,
47
- })),
48
- channel_types: option.channelTypes,
49
- min_value: option.minValue,
50
- max_value: option.maxValue,
51
- min_length: option.minLength,
52
- max_length: option.maxLength,
53
- autocomplete: option.autocomplete,
54
- })),
55
- default_member_permissions: command.defaultMemberPermissions,
56
- dm_permission: command.dmPermission,
57
- default_permission: command.defaultPermission,
58
- nsfw: command.nsfw,
59
- version: command.version,
60
- };
61
- }
62
- attachmentToJSON(attachment) {
63
- return {
64
- id: attachment.id,
65
- filename: attachment.filename,
66
- description: attachment.description,
67
- contentType: attachment.content_type,
68
- size: attachment.size,
69
- url: attachment.url,
70
- proxyURL: attachment.proxy_url,
71
- height: attachment.height,
72
- width: attachment.width,
73
- ephemeral: attachment.ephemeral,
74
- durationSecs: attachment.duration_secs,
75
- waveform: attachment.waveform,
76
- flags: attachment.flags,
77
- };
78
- }
79
- channelToRaw(channel) {
80
- return {
81
- id: channel.id,
82
- type: channel.type,
83
- guild_id: channel.guildId,
84
- position: channel.position,
85
- permission_overwrites: channel.permissionOverwrites?.map((overwrite) => ({
86
- id: overwrite.id,
87
- type: overwrite.type,
88
- allow: overwrite.allow,
89
- deny: overwrite.deny,
90
- })),
91
- name: channel.name,
92
- topic: channel.topic,
93
- nsfw: channel.nsfw,
94
- last_message_id: channel.lastMessageId,
95
- bitrate: channel.bitrate,
96
- user_limit: channel.userLimit,
97
- rate_limit_per_user: channel.rateLimitPerUser,
98
- recipients: channel.recipients?.map((recipient) => this.userToRaw(recipient)),
99
- icon: channel.icon,
100
- owner_id: channel.ownerId,
101
- application_id: channel.applicationId,
102
- managed: channel.managed,
103
- parent_id: channel.parentId,
104
- last_pin_timestamp: channel.lastPinTimestamp,
105
- rtc_region: channel.rtcRegion,
106
- video_quality_mode: channel.videoQualityMode,
107
- message_count: channel.messageCount,
108
- member_count: channel.memberCount,
109
- thread_metadata: channel.threadMetadata !== undefined
110
- ? {
111
- archived: channel.threadMetadata?.archived,
112
- auto_archive_duration: channel.threadMetadata?.autoArchiveDuration,
113
- archive_timestamp: channel.threadMetadata?.archiveTimestamp,
114
- locked: channel.threadMetadata?.locked,
115
- invitable: channel.threadMetadata?.invitable,
116
- create_timestamp: channel.threadMetadata?.createTimestamp,
117
- }
118
- : undefined,
119
- member: channel.member !== undefined
120
- ? {
121
- id: channel.member.id,
122
- user_id: channel.member.userId,
123
- join_timestamp: channel.member.joinTimestamp,
124
- flags: channel.member.flags,
125
- member: channel.member.member !== undefined
126
- ? {
127
- user: channel.member.member.user !== undefined
128
- ? this.userToRaw(channel.member.member.user)
129
- : undefined,
130
- nick: channel.member.member.nick,
131
- avatar: channel.member.member.avatar,
132
- roles: channel.member.member.roles,
133
- joined_at: channel.member.member.joinedAt,
134
- premium_since: channel.member.member.premiumSince,
135
- deaf: channel.member.member.deaf,
136
- mute: channel.member.member.mute,
137
- flags: channel.member.member.flags,
138
- pending: channel.member.member.pending,
139
- permissions: channel.member.member.permissions,
140
- communication_disabled_until: channel.member.member.communicationDisabledUntil,
141
- }
142
- : undefined,
143
- }
144
- : undefined,
145
- default_auto_archive_duration: channel.defaultAutoArchiveDuration,
146
- permissions: channel.permissions,
147
- flags: channel.flags,
148
- total_message_sent: channel.totalMessageSent,
149
- available_tags: channel.availableTags?.map((availableTag) => ({
150
- id: availableTag.id,
151
- name: availableTag.name,
152
- moderated: availableTag.moderated,
153
- emoji_id: availableTag.emojiId,
154
- emoji_name: availableTag.emojiName,
155
- })),
156
- applied_tags: channel.appliedTags,
157
- default_reaction_emoji: channel.defaultReactionEmoji !== undefined
158
- ? channel.defaultReactionEmoji !== null
159
- ? {
160
- emoji_id: channel.defaultReactionEmoji.emojiId,
161
- emoji_name: channel.defaultReactionEmoji.emojiName,
162
- }
163
- : null
164
- : undefined,
165
- default_thread_rate_limit_per_user: channel.defaultThreadRateLimitPerUser,
166
- default_sort_order: channel.defaultSortOrder,
167
- default_forum_layout: channel.defaultForumLayout,
168
- };
169
- }
170
- embedsToJSON(embeds) {
171
- return embeds.map((embed) => ({
172
- title: embed.title,
173
- type: embed.type,
174
- description: embed.description,
175
- url: embed.url,
176
- timestamp: embed.timestamp,
177
- color: embed.color,
178
- footer: embed.footer !== undefined
179
- ? {
180
- text: embed.footer.text,
181
- iconURL: embed.footer.icon_url,
182
- proxyIconURL: embed.footer.proxy_icon_url,
183
- }
184
- : undefined,
185
- image: embed.image !== undefined
186
- ? {
187
- url: embed.image.url,
188
- proxyURL: embed.image.proxy_url,
189
- height: embed.image.height,
190
- width: embed.image.width,
191
- }
192
- : undefined,
193
- thumbnail: embed.thumbnail !== undefined
194
- ? {
195
- url: embed.thumbnail.url,
196
- proxyURL: embed.thumbnail.proxy_url,
197
- height: embed.thumbnail.height,
198
- width: embed.thumbnail.width,
199
- }
200
- : undefined,
201
- video: {
202
- url: embed.video?.url,
203
- proxyURL: embed.video?.proxy_url,
204
- height: embed.video?.height,
205
- width: embed.video?.width,
206
- },
207
- provider: {
208
- name: embed.provider?.name,
209
- url: embed.provider?.url,
210
- },
211
- author: embed.author !== undefined
212
- ? {
213
- name: embed.author.name,
214
- url: embed.author.url,
215
- iconURL: embed.author.icon_url,
216
- proxyIconURL: embed.author.proxy_icon_url,
217
- }
218
- : undefined,
219
- fields: embed.fields?.map((field) => ({
220
- name: field.name,
221
- value: field.value,
222
- inline: field.inline,
223
- })),
224
- }));
225
- }
226
- embedsToRaw(embeds) {
227
- return embeds.map((embed) => ({
228
- title: embed.title,
229
- type: embed.type,
230
- description: embed.description,
231
- url: embed.url,
232
- timestamp: embed.timestamp,
233
- color: embed.color,
234
- footer: embed.footer !== undefined
235
- ? {
236
- text: embed.footer.text,
237
- icon_url: embed.footer.iconURL,
238
- proxy_icon_url: embed.footer.proxyIconURL,
239
- }
240
- : undefined,
241
- image: embed.image !== undefined
242
- ? {
243
- url: embed.image.url,
244
- proxy_url: embed.image.proxyURL,
245
- height: embed.image.height,
246
- width: embed.image.width,
247
- }
248
- : undefined,
249
- thumbnail: embed.thumbnail !== undefined
250
- ? {
251
- url: embed.thumbnail.url,
252
- proxy_url: embed.thumbnail.proxyURL,
253
- height: embed.thumbnail.height,
254
- width: embed.thumbnail.width,
255
- }
256
- : undefined,
257
- video: {
258
- url: embed.video?.url,
259
- proxy_url: embed.video?.proxyURL,
260
- height: embed.video?.height,
261
- width: embed.video?.width,
262
- },
263
- provider: {
264
- name: embed.provider?.name,
265
- url: embed.provider?.url,
266
- },
267
- author: embed.author !== undefined
268
- ? {
269
- name: embed.author.name,
270
- url: embed.author.url,
271
- icon_url: embed.author.iconURL,
272
- proxy_icon_url: embed.author.proxyIconURL,
273
- }
274
- : undefined,
275
- fields: embed.fields?.map((field) => ({
276
- name: field.name,
277
- value: field.value,
278
- inline: field.inline,
279
- })),
280
- }));
281
- }
282
- emojiToRaw(emoji) {
283
- return {
284
- id: emoji.id,
285
- name: emoji.name,
286
- roles: emoji.roles,
287
- user: emoji.user !== undefined ? this.userToRaw(emoji.user) : undefined,
288
- require_colons: emoji.requireColons,
289
- managed: emoji.managed,
290
- animated: emoji.animated,
291
- available: emoji.available,
292
- };
293
- }
294
- messageComponentsToJSON(components) {
295
- return components.map((component) => ({
296
- type: component.type,
297
- components: component.components.map((c) => {
298
- switch (c.type) {
299
- case constants_1.ComponentTypes.Button: {
300
- return {
301
- type: c.type,
302
- style: c.style,
303
- label: c.label,
304
- emoji: c.emoji !== undefined
305
- ? {
306
- name: c.emoji.name,
307
- id: c.emoji.id,
308
- animated: c.emoji.animated,
309
- }
310
- : undefined,
311
- customId: c.custom_id,
312
- url: c.url,
313
- disabled: c.disabled,
314
- };
315
- }
316
- case constants_1.ComponentTypes.TextInput: {
317
- return {
318
- type: c.type,
319
- customId: c.custom_id,
320
- style: c.style,
321
- label: c.label,
322
- minLength: c.min_length,
323
- maxLength: c.max_length,
324
- required: c.required,
325
- value: c.value,
326
- placeholder: c.placeholder,
327
- };
328
- }
329
- case constants_1.ComponentTypes.ChannelSelect: {
330
- return {
331
- type: c.type,
332
- customId: c.custom_id,
333
- channelTypes: c.channel_types,
334
- placeholder: c.placeholder,
335
- defaultValues: c.default_values,
336
- minValues: c.min_values,
337
- maxValues: c.max_values,
338
- disabled: c.disabled,
339
- };
340
- }
341
- case constants_1.ComponentTypes.StringSelect: {
342
- return {
343
- type: c.type,
344
- customId: c.custom_id,
345
- placeholder: c.placeholder,
346
- options: c.options?.map((option) => ({
347
- label: option.label,
348
- value: option.value,
349
- description: option.description,
350
- emoji: option.emoji !== undefined
351
- ? {
352
- name: option.emoji.name,
353
- id: option.emoji.id,
354
- animated: option.emoji.animated,
355
- }
356
- : undefined,
357
- default: option.default,
358
- })),
359
- minValues: c.min_values,
360
- maxValues: c.max_values,
361
- disabled: c.disabled,
362
- };
363
- }
364
- case constants_1.ComponentTypes.MentionableSelect:
365
- case constants_1.ComponentTypes.RoleSelect:
366
- case constants_1.ComponentTypes.UserSelect: {
367
- return {
368
- type: c.type,
369
- customId: c.custom_id,
370
- placeholder: c.placeholder,
371
- defaultValues: c.default_values,
372
- minValues: c.min_values,
373
- maxValues: c.max_values,
374
- disabled: c.disabled,
375
- };
376
- }
377
- }
378
- }),
379
- }));
380
- }
381
- messageComponentsToRaw(components) {
382
- return components.map((component) => ({
383
- type: component.type,
384
- components: component.components.map((c) => {
385
- switch (c.type) {
386
- case constants_1.ComponentTypes.Button: {
387
- return {
388
- type: c.type,
389
- style: c.style,
390
- label: c.label,
391
- emoji: c.emoji !== undefined
392
- ? {
393
- name: c.emoji.name,
394
- id: c.emoji.id,
395
- animated: c.emoji.animated,
396
- }
397
- : undefined,
398
- custom_id: c.customId,
399
- url: c.url,
400
- disabled: c.disabled,
401
- };
402
- }
403
- case constants_1.ComponentTypes.TextInput: {
404
- return {
405
- type: c.type,
406
- custom_id: c.customId,
407
- style: c.style,
408
- label: c.label,
409
- min_length: c.minLength,
410
- max_length: c.maxLength,
411
- required: c.required,
412
- value: c.value,
413
- placeholder: c.placeholder,
414
- };
415
- }
416
- case constants_1.ComponentTypes.ChannelSelect: {
417
- return {
418
- type: c.type,
419
- custom_id: c.customId,
420
- channel_types: c.channelTypes,
421
- placeholder: c.placeholder,
422
- default_values: c.defaultValues,
423
- min_values: c.minValues,
424
- max_values: c.maxValues,
425
- disabled: c.disabled,
426
- };
427
- }
428
- case constants_1.ComponentTypes.StringSelect: {
429
- return {
430
- type: c.type,
431
- custom_id: c.customId,
432
- placeholder: c.placeholder,
433
- options: c.options?.map((option) => ({
434
- label: option.label,
435
- value: option.value,
436
- description: option.description,
437
- emoji: option.emoji !== undefined
438
- ? {
439
- name: option.emoji.name,
440
- id: option.emoji.id,
441
- animated: option.emoji.animated,
442
- }
443
- : undefined,
444
- default: option.default,
445
- })),
446
- min_values: c.minValues,
447
- max_values: c.maxValues,
448
- disabled: c.disabled,
449
- };
450
- }
451
- case constants_1.ComponentTypes.MentionableSelect:
452
- case constants_1.ComponentTypes.RoleSelect:
453
- case constants_1.ComponentTypes.UserSelect: {
454
- return {
455
- type: c.type,
456
- custom_id: c.customId,
457
- placeholder: c.placeholder,
458
- default_values: c.defaultValues,
459
- min_values: c.minValues,
460
- max_values: c.maxValues,
461
- disabled: c.disabled,
462
- };
463
- }
464
- }
465
- }),
466
- }));
467
- }
468
- presenceToREST(presence, client) {
469
- return {
470
- user: new structures_1.User(presence.user, client),
471
- guildId: presence.guild_id,
472
- status: presence.status,
473
- activities: presence.activities.map((activity) => ({
474
- name: activity.name,
475
- type: activity.type,
476
- url: activity.url,
477
- createdAt: activity.created_at,
478
- timestamps: activity.timestamps,
479
- applicationId: activity.application_id,
480
- details: activity.details,
481
- state: activity.state,
482
- party: activity.party,
483
- assets: {
484
- largeImage: activity.assets?.large_image,
485
- largeText: activity.assets?.large_text,
486
- smallImage: activity.assets?.small_image,
487
- smallText: activity.assets?.small_text,
488
- },
489
- secrets: activity.secrets,
490
- instance: activity.instance,
491
- flags: activity.flags,
492
- buttons: activity.buttons,
493
- })),
494
- clientStatus: presence.client_status,
495
- };
496
- }
497
- roleToRaw(role) {
498
- return {
499
- id: role.id,
500
- name: role.name,
501
- color: role.color,
502
- hoist: role.hoist,
503
- icon: role.icon,
504
- unicode_emoji: role.unicodeEmoji,
505
- position: role.position,
506
- permissions: role.permissions,
507
- managed: role.managed,
508
- mentionable: role.mentionable,
509
- tags: {
510
- bot_id: role.tags?.botId,
511
- integration_id: role.tags?.integrationId,
512
- premium_subscriber: role.tags?.premiumSubscriber,
513
- subscription_listing_id: role.tags?.subscriptionListingId,
514
- available_for_purchase: role.tags?.availableForPurchase,
515
- guild_connections: role.tags?.guildConnections,
516
- },
517
- flags: role.flags,
518
- };
519
- }
520
5
  toCamelCase(obj) {
521
6
  if (obj !== null && typeof obj === "object") {
522
7
  if (Array.isArray(obj)) {
@@ -557,27 +42,6 @@ class Util {
557
42
  return obj;
558
43
  }
559
44
  }
560
- userToRaw(user) {
561
- return {
562
- id: user.id,
563
- username: user.username,
564
- discriminator: user.discriminator,
565
- global_name: user.globalName,
566
- avatar: user.avatar,
567
- bot: user.bot,
568
- system: user.system,
569
- mfa_enabled: user.mfaEnabled,
570
- banner: user.banner,
571
- accent_color: user.accentColor,
572
- locale: user.locale,
573
- verified: user.verified,
574
- email: user.email,
575
- flags: user.flags,
576
- premium_type: user.premiumType,
577
- public_flags: user.publicFlags,
578
- avatar_decoration: user.avatarDecoration,
579
- };
580
- }
581
45
  }
582
46
  exports.Util = Util;
583
47
  //# sourceMappingURL=Util.js.map