oceanic.js 1.5.1-dev.41182e4 → 1.5.1-dev.66991ee
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/dist/lib/gateway/Shard.js +2 -1
- package/dist/lib/routes/Guilds.js +2 -1
- package/dist/lib/routes/OAuth.d.ts +3 -1
- package/dist/lib/routes/OAuth.js +6 -2
- package/dist/lib/structures/AutoModerationRule.js +3 -1
- package/dist/lib/structures/ClientApplication.d.ts +3 -1
- package/dist/lib/structures/ClientApplication.js +7 -3
- package/dist/lib/structures/CommandInteraction.d.ts +4 -3
- package/dist/lib/structures/CommandInteraction.js +6 -2
- package/dist/lib/structures/ComponentInteraction.d.ts +4 -3
- package/dist/lib/structures/ComponentInteraction.js +6 -2
- package/dist/lib/structures/Guild.d.ts +1 -1
- package/dist/lib/structures/Guild.js +2 -2
- package/dist/lib/structures/Member.d.ts +1 -1
- package/dist/lib/structures/Member.js +1 -1
- package/dist/lib/structures/ModalSubmitInteraction.d.ts +4 -3
- package/dist/lib/structures/ModalSubmitInteraction.js +6 -2
- package/dist/lib/types/application-commands.d.ts +19 -16
- package/dist/lib/types/audit-log.d.ts +3 -1
- package/dist/lib/types/auto-moderation.d.ts +8 -4
- package/dist/lib/types/channels.d.ts +43 -39
- package/dist/lib/types/client.d.ts +1 -1
- package/dist/lib/types/gateway.d.ts +1 -1
- package/dist/lib/types/guild-template.d.ts +1 -1
- package/dist/lib/types/guilds.d.ts +20 -19
- package/dist/lib/types/interactions.d.ts +18 -16
- package/dist/lib/types/oauth.d.ts +7 -7
- package/dist/lib/types/request-handler.d.ts +1 -1
- package/dist/lib/types/users.d.ts +4 -4
- package/dist/lib/types/webhooks.d.ts +9 -9
- package/dist/lib/util/RawContainer.d.ts +11 -0
- package/dist/lib/util/RawContainer.js +14 -0
- package/dist/lib/util/Util.d.ts +8 -3
- package/dist/lib/util/Util.js +50 -28
- package/dist/package.json +1 -1
- package/package.json +1 -1
|
@@ -40,6 +40,7 @@ import type ForumChannel from "../structures/ForumChannel";
|
|
|
40
40
|
import type Message from "../structures/Message";
|
|
41
41
|
import type Guild from "../structures/Guild";
|
|
42
42
|
import type Invite from "../structures/Invite";
|
|
43
|
+
import type { RawComponentsContainer, RawEmbedsContainer } from "../util/RawContainer";
|
|
43
44
|
|
|
44
45
|
export interface RawChannel {
|
|
45
46
|
application_id?: string;
|
|
@@ -83,23 +84,23 @@ export interface RawChannel {
|
|
|
83
84
|
user_limit?: number;
|
|
84
85
|
video_quality_mode?: VideoQualityModes;
|
|
85
86
|
}
|
|
86
|
-
export
|
|
87
|
-
export
|
|
87
|
+
export interface RawGuildChannel extends Required<Pick<RawChannel, "id" | "guild_id" | "parent_id">> { name: string; type: GuildChannelTypes; }
|
|
88
|
+
export interface RawPrivateChannel extends Required<Pick<RawChannel, "id" | "last_message_id" | "recipients">> { type: ChannelTypes.DM; }
|
|
88
89
|
// nicks is undocumented, creating a group dm DOES work, and they show in the client, so we're supporting them
|
|
89
|
-
export
|
|
90
|
-
export
|
|
91
|
-
export
|
|
92
|
-
export
|
|
93
|
-
export
|
|
94
|
-
export
|
|
90
|
+
export interface RawGroupChannel extends Required<Pick<RawChannel, "id" | "recipients" | "application_id" | "icon" | "owner_id" | "nsfw" | "last_message_id">> { managed: boolean; name: string; nicks?: Array<Record<"id" | "nick", string>>; type: ChannelTypes.GROUP_DM; }
|
|
91
|
+
export interface RawTextChannel extends Omit<RawGuildChannel, "type">, Required<Pick<RawChannel, "default_auto_archive_duration" | "last_message_id" | "last_pin_timestamp" | "rate_limit_per_user" | "topic" | "nsfw" | "permission_overwrites" | "position">> { type: ChannelTypes.GUILD_TEXT; }
|
|
92
|
+
export interface RawCategoryChannel extends Omit<RawGuildChannel, "type">, Required<Pick<RawChannel, "permission_overwrites" | "position">> { type: ChannelTypes.GUILD_CATEGORY; }
|
|
93
|
+
export interface RawAnnouncementChannel extends Omit<RawTextChannel, "type"> { type: ChannelTypes.GUILD_ANNOUNCEMENT; }
|
|
94
|
+
export interface RawVoiceChannel extends Omit<RawGuildChannel, "type">, Required<Pick<RawChannel, "bitrate" | "user_limit" | "video_quality_mode" | "rtc_region" | "nsfw" | "topic" | "permission_overwrites" | "position" | "last_message_id" | "rate_limit_per_user">> { type: ChannelTypes.GUILD_VOICE; }
|
|
95
|
+
export interface RawStageChannel extends Omit<RawVoiceChannel, "type"> { type: ChannelTypes.GUILD_STAGE_VOICE; }
|
|
95
96
|
export type RawThreadChannel = RawAnnouncementThreadChannel | RawPublicThreadChannel | RawPrivateThreadChannel;
|
|
96
|
-
export
|
|
97
|
-
export
|
|
98
|
-
export
|
|
99
|
-
export
|
|
97
|
+
export interface RawAnnouncementThreadChannel extends Required<Pick<RawChannel, "id" | "guild_id" | "parent_id" | "owner_id" | "last_message_id" | "thread_metadata" | "message_count" | "member_count" | "rate_limit_per_user" | "flags" | "total_message_sent" | "newly_created" | "member">> { name: string; type: ChannelTypes.ANNOUNCEMENT_THREAD; }
|
|
98
|
+
export interface RawPublicThreadChannel extends Omit<RawAnnouncementThreadChannel, "type">, Required<Pick<RawChannel, "applied_tags">> { type: ChannelTypes.PUBLIC_THREAD; }
|
|
99
|
+
export interface RawPrivateThreadChannel extends Omit<RawAnnouncementThreadChannel, "type" | "member"> { member: RawChannel["member"]; type: ChannelTypes.PRIVATE_THREAD; }
|
|
100
|
+
export interface RawForumChannel extends Omit<RawGuildChannel, "type">, Required<Pick<RawChannel, "position" | "topic" | "flags" | "permission_overwrites" | "rate_limit_per_user" | "nsfw" | "available_tags" | "template" | "default_reaction_emoji" | "last_message_id" | "default_sort_order" | "default_thread_rate_limit_per_user" | "default_auto_archive_duration" | "default_forum_layout">> { type: ChannelTypes.GUILD_FORUM; }
|
|
100
101
|
|
|
101
|
-
export
|
|
102
|
-
export
|
|
102
|
+
export interface PartialChannel extends Pick<RawChannel, "id" | "name" | "type"> {}
|
|
103
|
+
export interface RawInteractionResolvedChannel extends Omit<Required<Pick<RawChannel, "id" | "type" | "permissions">>, "name">, Pick<RawChannel, "thread_metadata" | "parent_id"> { name: string | null; }
|
|
103
104
|
|
|
104
105
|
export interface RawOverwrite {
|
|
105
106
|
allow: string;
|
|
@@ -224,16 +225,16 @@ export interface EditGuildChannelOptions {
|
|
|
224
225
|
videoQualityMode?: VideoQualityModes | null;
|
|
225
226
|
}
|
|
226
227
|
|
|
227
|
-
export
|
|
228
|
-
export
|
|
229
|
-
export
|
|
230
|
-
export
|
|
231
|
-
export
|
|
232
|
-
export
|
|
228
|
+
export interface EditChannelOptions extends EditGroupDMOptions, EditGuildChannelOptions {}
|
|
229
|
+
export interface EditAnyGuildChannelOptions extends Pick<EditGuildChannelOptions, "name" | "position" | "permissionOverwrites"> {}
|
|
230
|
+
export interface EditTextChannelOptions extends EditAnyGuildChannelOptions, Pick<EditGuildChannelOptions, "topic" | "nsfw" | "rateLimitPerUser" | "parentID" | "defaultAutoArchiveDuration"> { type?: ChannelTypes.GUILD_ANNOUNCEMENT; }
|
|
231
|
+
export interface EditAnnouncementChannelOptions extends Omit<EditTextChannelOptions, "rateLimitPerUser" | "type"> { type?: ChannelTypes.GUILD_TEXT; }
|
|
232
|
+
export interface EditVoiceChannelOptions extends EditAnyGuildChannelOptions, Pick<EditGuildChannelOptions, "nsfw" | "bitrate" | "userLimit" | "parentID" | "rtcRegion" | "videoQualityMode"> {}
|
|
233
|
+
export interface EditStageChannelOptions extends EditAnyGuildChannelOptions, Pick<EditGuildChannelOptions, "bitrate" | "rtcRegion"> {}
|
|
233
234
|
export type EditThreadChannelOptions = EditPublicThreadChannelOptions | EditPrivateThreadChannelOptions;
|
|
234
|
-
export
|
|
235
|
-
export
|
|
236
|
-
export
|
|
235
|
+
export interface EditPublicThreadChannelOptions extends Pick<EditGuildChannelOptions, "name" | "archived" | "autoArchiveDuration" | "locked" | "rateLimitPerUser" | "flags" | "appliedTags"> {}
|
|
236
|
+
export interface EditPrivateThreadChannelOptions extends EditPublicThreadChannelOptions, Pick<EditGuildChannelOptions, "invitable"> {}
|
|
237
|
+
export interface EditForumChannelOptions extends EditAnyGuildChannelOptions, Pick<EditGuildChannelOptions, "availableTags" | "defaultReactionEmoji" | "defaultSortOrder" |"defaultThreadRateLimitPerUser" | "flags" | "nsfw" | "rateLimitPerUser" | "topic"> {}
|
|
237
238
|
|
|
238
239
|
export interface AddGroupRecipientOptions {
|
|
239
240
|
/** The access token of the user to add. */
|
|
@@ -250,11 +251,11 @@ export interface CreateMessageOptions {
|
|
|
250
251
|
/** An array of [partial attachments](https://discord.com/developers/docs/resources/channel#attachment-object) related to the sent files. */
|
|
251
252
|
attachments?: Array<MessageAttachment>;
|
|
252
253
|
/** An array of [components](https://discord.com/developers/docs/interactions/message-components) to send. Convert `snake_case` keys to `camelCase`. */
|
|
253
|
-
components?: Array<MessageActionRow
|
|
254
|
+
components?: Array<MessageActionRow | RawComponentsContainer<RawMessageActionRow>>;
|
|
254
255
|
/** The content of the message. */
|
|
255
256
|
content?: string;
|
|
256
257
|
/** An array of [embeds](https://discord.com/developers/docs/resources/channel#embed-object) to send. Convert `snake_case` keys to `camelCase`. */
|
|
257
|
-
embeds?: Array<EmbedOptions>;
|
|
258
|
+
embeds?: Array<EmbedOptions | RawEmbedsContainer>;
|
|
258
259
|
/** The files to send. */
|
|
259
260
|
files?: Array<File>;
|
|
260
261
|
/** The [flags](https://discord.com/developers/docs/resources/channel#message-object-message-flags) to send with the message. */
|
|
@@ -455,8 +456,11 @@ export interface RawActionRowBase<T extends RawComponent> {
|
|
|
455
456
|
type: ComponentTypes.ACTION_ROW;
|
|
456
457
|
}
|
|
457
458
|
|
|
458
|
-
export
|
|
459
|
-
export
|
|
459
|
+
export interface RawMessageActionRow extends RawActionRowBase<RawMessageComponent> {}
|
|
460
|
+
export interface RawModalActionRow extends RawActionRowBase<RawModalComponent> {}
|
|
461
|
+
export type ActionRowToRaw<T extends MessageActionRow | ModalActionRow> =
|
|
462
|
+
T extends MessageActionRow ? RawMessageActionRow :
|
|
463
|
+
T extends ModalActionRow ? RawModalActionRow : never;
|
|
460
464
|
|
|
461
465
|
export type Component = MessageComponent | ModalComponent;
|
|
462
466
|
export type MessageComponent = ButtonComponent | SelectMenuComponent;
|
|
@@ -512,11 +516,11 @@ export interface RawChannelSelectMenuOptions {
|
|
|
512
516
|
channel_types: Array<ChannelTypes>;
|
|
513
517
|
}
|
|
514
518
|
|
|
515
|
-
export
|
|
516
|
-
export
|
|
517
|
-
export
|
|
518
|
-
export
|
|
519
|
-
export
|
|
519
|
+
export interface RawStringSelectMenu extends RawSelectMenuBase<ComponentTypes.STRING_SELECT>, RawStringSelectMenuOptions {}
|
|
520
|
+
export interface RawUserSelectMenu extends RawSelectMenuBase<ComponentTypes.USER_SELECT> {}
|
|
521
|
+
export interface RawRoleSelectMenu extends RawSelectMenuBase<ComponentTypes.ROLE_SELECT> {}
|
|
522
|
+
export interface RawMentionableSelectMenu extends RawSelectMenuBase<ComponentTypes.MENTIONABLE_SELECT> {}
|
|
523
|
+
export interface RawChannelSelectMenu extends RawSelectMenuBase<ComponentTypes.CHANNEL_SELECT>, RawChannelSelectMenuOptions {}
|
|
520
524
|
|
|
521
525
|
|
|
522
526
|
export interface SelectMenuBase<T extends SelectMenuTypes> {
|
|
@@ -536,11 +540,11 @@ export interface ChannelSelectMenuOptions {
|
|
|
536
540
|
channelTypes: Array<ChannelTypes>;
|
|
537
541
|
}
|
|
538
542
|
|
|
539
|
-
export
|
|
540
|
-
export
|
|
541
|
-
export
|
|
542
|
-
export
|
|
543
|
-
export
|
|
543
|
+
export interface StringSelectMenu extends SelectMenuBase<ComponentTypes.STRING_SELECT>, StringSelectMenuOptions {}
|
|
544
|
+
export interface UserSelectMenu extends SelectMenuBase<ComponentTypes.USER_SELECT> {}
|
|
545
|
+
export interface RoleSelectMenu extends SelectMenuBase<ComponentTypes.ROLE_SELECT> {}
|
|
546
|
+
export interface MentionableSelectMenu extends SelectMenuBase<ComponentTypes.MENTIONABLE_SELECT> {}
|
|
547
|
+
export interface ChannelSelectMenu extends SelectMenuBase<ComponentTypes.CHANNEL_SELECT>, ChannelSelectMenuOptions {}
|
|
544
548
|
|
|
545
549
|
export interface SelectOption {
|
|
546
550
|
default?: boolean;
|
|
@@ -587,7 +591,7 @@ export interface RawAttachment {
|
|
|
587
591
|
width?: number;
|
|
588
592
|
}
|
|
589
593
|
// @TODO verify what can be sent with `attachments` in message creation/deletion, this is an assumption
|
|
590
|
-
export
|
|
594
|
+
export interface MessageAttachment extends Pick<RawAttachment, "id">, Partial<Pick<RawAttachment, "description" | "filename">> {}
|
|
591
595
|
|
|
592
596
|
export interface RawAllowedMentions {
|
|
593
597
|
parse: Array<"everyone" | "roles" | "users">;
|
|
@@ -732,7 +736,7 @@ export interface GetReactionsOptions {
|
|
|
732
736
|
limit?: number;
|
|
733
737
|
}
|
|
734
738
|
|
|
735
|
-
export
|
|
739
|
+
export interface EditMessageOptions extends Pick<CreateMessageOptions, "content" | "embeds" | "allowedMentions" | "components" | "attachments" | "files" | "flags"> {}
|
|
736
740
|
|
|
737
741
|
export interface EditPermissionOptions {
|
|
738
742
|
/** The permissions to allow. */
|
|
@@ -34,7 +34,7 @@ export interface ClientOptions {
|
|
|
34
34
|
/** The options for the request handler. */
|
|
35
35
|
rest?: RESTOptions;
|
|
36
36
|
}
|
|
37
|
-
|
|
37
|
+
export interface ClientInstanceOptions extends Required<Omit<ClientOptions, "rest" | "gateway" | "collectionLimits">> { collectionLimits: Required<CollectionLimitsOptions>; }
|
|
38
38
|
|
|
39
39
|
export interface RESTOptions {
|
|
40
40
|
/**
|
|
@@ -199,7 +199,7 @@ export interface Activity {
|
|
|
199
199
|
type: ActivityTypes;
|
|
200
200
|
url?: string | null;
|
|
201
201
|
}
|
|
202
|
-
export
|
|
202
|
+
export interface BotActivity extends Pick<Activity, "name" | "url"> { type: BotActivityTypes; }
|
|
203
203
|
|
|
204
204
|
export interface ActivityEmoji {
|
|
205
205
|
animated?: boolean;
|
|
@@ -100,7 +100,8 @@ export interface RawGuild {
|
|
|
100
100
|
widget_channel_id?: string | null;
|
|
101
101
|
widget_enabled?: boolean;
|
|
102
102
|
}
|
|
103
|
-
|
|
103
|
+
|
|
104
|
+
export interface RawInviteGuild extends Pick<RawGuild, "id" | "name" | "splash" | "banner" | "description" | "icon" | "features" | "verification_level" | "vanity_url_code" | "premium_subscription_count" | "nsfw_level"> {}
|
|
104
105
|
|
|
105
106
|
export interface RawRole {
|
|
106
107
|
color: number;
|
|
@@ -141,8 +142,8 @@ export interface Emoji {
|
|
|
141
142
|
roles?: Array<string>;
|
|
142
143
|
user?: RawUser;
|
|
143
144
|
}
|
|
144
|
-
export
|
|
145
|
-
export
|
|
145
|
+
export interface RawGuildEmoji extends Required<Omit<Emoji, "user" | "id">> { id: string; user?: RawUser; }
|
|
146
|
+
export interface GuildEmoji extends Omit<RawGuildEmoji, "user" | "id" | "require_colons"> { id: string; requireColons?: boolean; user?: User; }
|
|
146
147
|
export interface RawWelcomeScreen {
|
|
147
148
|
description: string | null;
|
|
148
149
|
welcome_channels: Array<RawWelcomeScreenChannel>;
|
|
@@ -218,8 +219,8 @@ export interface RawMember {
|
|
|
218
219
|
roles: Array<string>;
|
|
219
220
|
user?: RawUser;
|
|
220
221
|
}
|
|
221
|
-
export
|
|
222
|
-
export
|
|
222
|
+
export interface RESTMember extends Required<Omit<RawMember, "permissions" | "joined_at">> { joined_at: string; }
|
|
223
|
+
export interface InteractionMember extends Required<RawMember> {}
|
|
223
224
|
|
|
224
225
|
export interface RawIntegration {
|
|
225
226
|
account: IntegrationAccount;
|
|
@@ -253,7 +254,7 @@ export interface RawIntegrationApplication {
|
|
|
253
254
|
name: string;
|
|
254
255
|
}
|
|
255
256
|
|
|
256
|
-
export
|
|
257
|
+
export interface PartialEmoji extends Pick<Emoji, "id" | "name" | "animated"> {}
|
|
257
258
|
|
|
258
259
|
export interface CreateEmojiOptions {
|
|
259
260
|
/** The image (buffer, or full data url). */
|
|
@@ -400,11 +401,11 @@ export interface CreateChannelOptions<T extends GuildChannelTypesWithoutThreads
|
|
|
400
401
|
videoQualityMode?: VideoQualityModes | null;
|
|
401
402
|
}
|
|
402
403
|
|
|
403
|
-
export
|
|
404
|
-
export
|
|
405
|
-
export
|
|
406
|
-
export
|
|
407
|
-
export
|
|
404
|
+
export interface CreateTextChannelOptions extends Omit<CreateChannelOptions<ChannelTypes.GUILD_TEXT>, "rtcRegion" | "userLimit" | "videoQualityMode"> {}
|
|
405
|
+
export interface CreateVoiceChannelOptions extends Omit<CreateChannelOptions<ChannelTypes.GUILD_VOICE>, "defaultAutoArchiveDuration" | "topic"> {}
|
|
406
|
+
export interface CreateCategoryChannelOptions extends Omit<CreateChannelOptions<ChannelTypes.GUILD_CATEGORY>, "defaultAutoArchiveDuration" | "nsfw" | "parentID" | "rtcRegion" | "topic" | "userLimit" | "videoQualityMode"> {}
|
|
407
|
+
export interface CreateAnnouncementChannelOptions extends Omit<CreateChannelOptions<ChannelTypes.GUILD_ANNOUNCEMENT>, "rtcRegion" | "userLimit" | "videoQualityMode"> {}
|
|
408
|
+
export interface CreateStageChannelOptions extends Omit<CreateChannelOptions<ChannelTypes.GUILD_STAGE_VOICE>, "defaultAutoArchiveDuration" | "nsfw" | "rtcRegion" | "topic" | "userLimit" | "videoQualityMode"> {}
|
|
408
409
|
|
|
409
410
|
export type CreateChannelReturn<T extends GuildChannelTypesWithoutThreads> =
|
|
410
411
|
T extends ChannelTypes.GUILD_TEXT ? TextChannel :
|
|
@@ -495,7 +496,7 @@ export interface EditMemberOptions {
|
|
|
495
496
|
roles?: Array<string>;
|
|
496
497
|
}
|
|
497
498
|
|
|
498
|
-
export
|
|
499
|
+
export interface EditCurrentMemberOptions extends Pick<EditMemberOptions, "nick" | "reason"> {}
|
|
499
500
|
|
|
500
501
|
export interface GetBansOptions {
|
|
501
502
|
/** The ID of the user to get bans after. */
|
|
@@ -532,7 +533,7 @@ export interface EditRolePositionsEntry {
|
|
|
532
533
|
position?: number | null;
|
|
533
534
|
}
|
|
534
535
|
|
|
535
|
-
export
|
|
536
|
+
export interface EditRoleOptions extends CreateRoleOptions {}
|
|
536
537
|
|
|
537
538
|
export interface GetPruneCountOptions {
|
|
538
539
|
/** The number of days to prune. */
|
|
@@ -666,10 +667,10 @@ export interface CreateStageInstanceOptions {
|
|
|
666
667
|
topic: string;
|
|
667
668
|
}
|
|
668
669
|
|
|
669
|
-
export
|
|
670
|
+
export interface EditStageInstanceOptions extends Pick<CreateStageInstanceOptions, "topic" | "privacyLevel"> {
|
|
670
671
|
/** The reason for editing the stage instance. */
|
|
671
672
|
reason?: string;
|
|
672
|
-
}
|
|
673
|
+
}
|
|
673
674
|
|
|
674
675
|
export interface EditMFALevelOptions {
|
|
675
676
|
/** The new MFA level. */
|
|
@@ -733,14 +734,14 @@ export interface RawOAuthGuild {
|
|
|
733
734
|
permissions: string;
|
|
734
735
|
}
|
|
735
736
|
|
|
736
|
-
export
|
|
737
|
+
export interface PresenceActivity extends Omit<GatewayActivity, "application_id" | "assets" | "created_at"> {
|
|
737
738
|
applicationID?: string;
|
|
738
739
|
assets?: Partial<Record<"largeImage" | "largeText" | "smallImage" | "smallText", string>>;
|
|
739
740
|
createdAt: number;
|
|
740
|
-
}
|
|
741
|
+
}
|
|
741
742
|
|
|
742
|
-
export
|
|
743
|
+
export interface Presence extends Omit<PresenceUpdate, "user" | "guild_id" | "client_status" | "activities"> {
|
|
743
744
|
activities?: Array<PresenceActivity>;
|
|
744
745
|
clientStatus: ClientStatus;
|
|
745
746
|
guildID: string;
|
|
746
|
-
}
|
|
747
|
+
}
|
|
@@ -36,8 +36,10 @@ import type PrivateChannel from "../structures/PrivateChannel";
|
|
|
36
36
|
import type TypedCollection from "../util/TypedCollection";
|
|
37
37
|
import type InteractionResolvedChannel from "../structures/InteractionResolvedChannel";
|
|
38
38
|
import type SelectMenuValuesWrapper from "../util/SelectMenuValuesWrapper";
|
|
39
|
+
import type { RawComponentsContainer } from "../util/RawContainer";
|
|
39
40
|
|
|
40
|
-
export
|
|
41
|
+
export interface InteractionContent extends Pick<ExecuteWebhookOptions, "tts" | "content" | "embeds" | "allowedMentions" | "flags" | "components" | "attachments" | "files"> {}
|
|
42
|
+
export interface InitialInteractionContent extends Omit<InteractionContent, "files"> {}
|
|
41
43
|
|
|
42
44
|
export type InteractionResponse = PingInteractionResponse | MessageInteractionResponse | DeferredInteractionResponse | AutocompleteInteractionResponse | ModalInteractionResponse;
|
|
43
45
|
export interface PingInteractionResponse {
|
|
@@ -70,7 +72,7 @@ export interface ModalInteractionResponse {
|
|
|
70
72
|
|
|
71
73
|
|
|
72
74
|
export interface ModalData {
|
|
73
|
-
components: Array<ModalActionRow
|
|
75
|
+
components: Array<ModalActionRow | RawComponentsContainer<RawModalActionRow>>;
|
|
74
76
|
/** The custom ID of the modal. */
|
|
75
77
|
customID: string;
|
|
76
78
|
/** The title of the modal. */
|
|
@@ -96,11 +98,11 @@ export interface RawInteraction {
|
|
|
96
98
|
|
|
97
99
|
export type AnyRawInteraction = RawPingInteraction | AnyRawGatewayInteraction;
|
|
98
100
|
export type AnyRawGatewayInteraction = RawApplicationCommandInteraction | RawMessageComponentInteraction | RawAutocompleteInteraction | RawModalSubmitInteraction;
|
|
99
|
-
export
|
|
100
|
-
export
|
|
101
|
-
export
|
|
102
|
-
export
|
|
103
|
-
export
|
|
101
|
+
export interface RawPingInteraction extends Pick<RawInteraction, "application_id" | "id" | "token" | "type" | "version"> {}
|
|
102
|
+
export interface RawApplicationCommandInteraction extends Omit<RawInteraction, "data" | "message"> { data: RawApplicationCommandInteractionData; }
|
|
103
|
+
export interface RawMessageComponentInteraction extends Omit<RawInteraction, "data" | "message"> { data: RawMessageComponentInteractionData; message: RawMessage; }
|
|
104
|
+
export interface RawAutocompleteInteraction extends Omit<RawInteraction, "data" | "message"> { data: RawAutocompleteInteractionData; }
|
|
105
|
+
export interface RawModalSubmitInteraction extends Omit<RawInteraction, "data" | "message"> { data: RawModalSubmitInteractionData; }
|
|
104
106
|
|
|
105
107
|
export type RawInteractionData = RawApplicationCommandInteractionData | RawMessageComponentInteractionData | RawAutocompleteInteractionData | RawModalSubmitInteractionData;
|
|
106
108
|
export type InteractionData = ApplicationCommandInteractionData | MessageComponentInteractionData | AutocompleteInteractionData | ModalSubmitInteractionData;
|
|
@@ -123,8 +125,8 @@ export interface ApplicationCommandInteractionData {
|
|
|
123
125
|
targetID?: string;
|
|
124
126
|
type: ApplicationCommandTypes;
|
|
125
127
|
}
|
|
126
|
-
export
|
|
127
|
-
export
|
|
128
|
+
export interface RawAutocompleteInteractionData extends Omit<RawApplicationCommandInteractionData, "resolved" | "target_id"> {}
|
|
129
|
+
export interface AutocompleteInteractionData extends Omit<ApplicationCommandInteractionData, "resolved" | "targetID"> {}
|
|
128
130
|
|
|
129
131
|
export interface RawMessageComponentInteractionResolvedData {
|
|
130
132
|
channels?: Record<string, RawInteractionResolvedChannel>;
|
|
@@ -251,23 +253,23 @@ export interface AutocompleteChoice {
|
|
|
251
253
|
|
|
252
254
|
|
|
253
255
|
export type GuildAutocompleteInteraction = AutocompleteInteraction<AnyGuildTextChannel>;
|
|
254
|
-
export
|
|
256
|
+
export interface PrivateAutocompleteInteraction extends Omit<AutocompleteInteraction<PrivateChannel | Uncached>, | "appPermissions" | "guild" | "guildID" | "guildLocale" | "member" | "memberPermissions"> {}
|
|
255
257
|
export type AnyAutocompleteInteraction = GuildAutocompleteInteraction | PrivateAutocompleteInteraction;
|
|
256
258
|
|
|
257
259
|
export type GuildCommandInteraction = CommandInteraction<AnyGuildTextChannel>;
|
|
258
|
-
export
|
|
260
|
+
export interface PrivateCommandInteraction extends Omit<CommandInteraction<PrivateChannel | Uncached>, "appPermissions" | "guild" | "guildID" | "guildLocale" | "member" | "memberPermissions"> {}
|
|
259
261
|
export type AnyCommandInteraction = GuildCommandInteraction | PrivateCommandInteraction;
|
|
260
262
|
|
|
261
|
-
export
|
|
262
|
-
export
|
|
263
|
+
export interface GuildComponentButtonInteraction extends Omit<ComponentInteraction<ComponentTypes.BUTTON, AnyGuildTextChannel>, "data"> { data: MessageComponentButtonInteractionData; }
|
|
264
|
+
export interface GuildComponentSelectMenuInteraction extends Omit<ComponentInteraction<SelectMenuTypes, AnyGuildTextChannel>, "data"> { data: MessageComponentSelectMenuInteractionData; }
|
|
263
265
|
export type GuildComponentInteraction = GuildComponentButtonInteraction | GuildComponentSelectMenuInteraction;
|
|
264
|
-
export
|
|
265
|
-
export
|
|
266
|
+
export interface PrivateComponentButtonInteraction extends Omit<ComponentInteraction<ComponentTypes.BUTTON, PrivateChannel | Uncached>, "appPermissions" | "guild" | "guildID" | "guildLocale" | "member" | "memberPermissions" | "data"> { data: MessageComponentButtonInteractionData; }
|
|
267
|
+
export interface PrivateComponentSelectMenuInteraction extends Omit<ComponentInteraction<SelectMenuTypes, PrivateChannel | Uncached>, "appPermissions" | "guild" | "guildID" | "guildLocale" | "member" | "memberPermissions" | "data"> { data: MessageComponentSelectMenuInteractionData; }
|
|
266
268
|
export type PrivateComponentInteraction = PrivateComponentButtonInteraction | PrivateComponentSelectMenuInteraction;
|
|
267
269
|
export type AnyComponentInteraction = GuildComponentInteraction | PrivateComponentInteraction;
|
|
268
270
|
|
|
269
271
|
export type GuildModalSubmitInteraction = ModalSubmitInteraction<AnyGuildTextChannel>;
|
|
270
|
-
export
|
|
272
|
+
export interface PrivateModalSubmitInteraction extends Omit<ModalSubmitInteraction<PrivateChannel | Uncached>, "appPermissions" | "guild" | "guildID" | "guildLocale" | "member" | "memberPermissions"> {}
|
|
271
273
|
export type AnyModalSubmitInteraction = GuildModalSubmitInteraction | PrivateModalSubmitInteraction;
|
|
272
274
|
|
|
273
275
|
export type SubCommandArray = [subcommand: string] | [subcommandGroup: string, subcommand: string];
|
|
@@ -39,9 +39,9 @@ export interface RawApplication {
|
|
|
39
39
|
terms_of_service_url?: string;
|
|
40
40
|
verify_key: string;
|
|
41
41
|
}
|
|
42
|
-
export
|
|
43
|
-
export
|
|
44
|
-
export
|
|
42
|
+
export interface RawPartialApplication extends Pick<RawApplication, "id" | "name" | "icon" | "description">, Partial<Pick<RawApplication, "bot_public" | "bot_require_code_grant" | "verify_key">> {}
|
|
43
|
+
export interface RESTApplication extends Omit<RawApplication, "cover_image" | "flags" | "owner" | "rpc_origins" | "install_params">, Required<Pick<RawApplication, "cover_image" | "flags" | "install_params" | "owner" | "rpc_origins">> {}
|
|
44
|
+
export interface RawClientApplication extends Required<Pick<RawApplication, "id" | "flags">> {}
|
|
45
45
|
|
|
46
46
|
export interface RawTeam {
|
|
47
47
|
icon: string | null;
|
|
@@ -162,8 +162,8 @@ export interface RefreshTokenOptions {
|
|
|
162
162
|
refreshToken: string;
|
|
163
163
|
}
|
|
164
164
|
|
|
165
|
-
export
|
|
166
|
-
export
|
|
165
|
+
export interface RawRefreshTokenResponse extends Omit<RawExchangeCodeResponse, "webhook"> {}
|
|
166
|
+
export interface RefreshTokenResponse extends Omit<ExchangeCodeResponse, "webhook"> {}
|
|
167
167
|
|
|
168
168
|
export interface ClientCredentialsTokenOptions {
|
|
169
169
|
/** The id of the client to perform the authorization with. This can be omitted if the global authorization is the proper (Basic base64(clientID:clientSecret)) already, or if connected to the gateway and ready. */
|
|
@@ -174,8 +174,8 @@ export interface ClientCredentialsTokenOptions {
|
|
|
174
174
|
scopes: Array<string>;
|
|
175
175
|
}
|
|
176
176
|
|
|
177
|
-
export
|
|
178
|
-
export
|
|
177
|
+
export interface RawClientCredentialsTokenResponse extends Omit<RawExchangeCodeResponse, "refresh_token"> {}
|
|
178
|
+
export interface ClientCredentialsTokenResponse extends Omit<ExchangeCodeResponse, "refreshToken"> {}
|
|
179
179
|
|
|
180
180
|
export interface RevokeTokenOptions {
|
|
181
181
|
/** The id of the client the authorization was performed with. */
|
|
@@ -4,7 +4,7 @@ import type { RESTMethod } from "../Constants";
|
|
|
4
4
|
import type { FormData } from "undici";
|
|
5
5
|
|
|
6
6
|
// internal use
|
|
7
|
-
|
|
7
|
+
export interface RequestHandlerInstanceOptions extends Required<Omit<RESTOptions, "agent">>, Pick<RESTOptions, "agent"> {}
|
|
8
8
|
|
|
9
9
|
export interface RequestOptions {
|
|
10
10
|
auth?: boolean | string;
|
|
@@ -22,10 +22,10 @@ export interface RESTUser {
|
|
|
22
22
|
username: string;
|
|
23
23
|
verified?: boolean;
|
|
24
24
|
}
|
|
25
|
-
export
|
|
26
|
-
export
|
|
27
|
-
export
|
|
28
|
-
export
|
|
25
|
+
export interface RawUser extends Pick<RESTUser, "id" | "username" | "discriminator" | "avatar" | "avatar_decoration" | "bot" | "system" | "banner" | "accent_color">, Required<Pick<RESTUser, "public_flags">> {}
|
|
26
|
+
export interface RawUserWithMember extends RawUser, Pick<RESTUser, "member"> {}
|
|
27
|
+
export interface RawOAuthUser extends Pick<RESTUser, "id" | "username" | "discriminator" | "avatar" | "avatar_decoration" | "bot" | "system">, Required<Pick<RESTUser, "banner" | "accent_color" | "locale" | "mfa_enabled" | "email" | "verified" | "flags" | "public_flags">> {}
|
|
28
|
+
export interface RawExtendedUser extends Pick<RawOAuthUser, "avatar" | "avatar_decoration" | "bot" | "discriminator" | "email" | "flags" | "id" | "mfa_enabled" | "username" | "verified"> {}
|
|
29
29
|
|
|
30
30
|
export interface EditSelfUserOptions {
|
|
31
31
|
/** The new avatar (buffer, or full data url). `null` to reset. */
|
|
@@ -18,11 +18,11 @@ export interface RawWebhook {
|
|
|
18
18
|
url?: string;
|
|
19
19
|
user?: RawUser;
|
|
20
20
|
}
|
|
21
|
-
export
|
|
22
|
-
export
|
|
23
|
-
export
|
|
24
|
-
export
|
|
25
|
-
export
|
|
21
|
+
export interface BasicWebhook extends Pick<RawWebhook, "type" | "id" | "name" | "avatar" | "channel_id" | "guild_id" | "application_id"> {}
|
|
22
|
+
export interface OAuthWebhook extends Required<BasicWebhook & Pick<RawWebhook, "url" | "token">> {}
|
|
23
|
+
export interface GuildWebhook extends BasicWebhook, Pick<RawWebhook, "user" | "token"> {}
|
|
24
|
+
export interface ApplicationWebhook extends Pick<RawWebhook, "type" | "id" | "name" | "avatar" | "channel_id" | "guild_id" | "application_id">, Required<Pick<RawWebhook, "token">> {}
|
|
25
|
+
export interface ChannelFollowerWebhook extends BasicWebhook, Required<Pick<RawWebhook, "source_guild" | "source_channel">>, Pick<RawWebhook, "user"> {}
|
|
26
26
|
|
|
27
27
|
export interface CreateWebhookOptions {
|
|
28
28
|
/** The avatar (buffer, or full data url). */
|
|
@@ -46,7 +46,7 @@ export interface EditWebhookOptions extends EditWebhookTokenOptions {
|
|
|
46
46
|
reason?: string;
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
-
export
|
|
49
|
+
export interface ExecuteWebhookOptions extends Pick<CreateMessageOptions, "content" | "tts" | "embeds" | "allowedMentions" | "components" | "attachments" | "flags" | "files"> {
|
|
50
50
|
/** The url of an avatar to use. */
|
|
51
51
|
avatarURL?: string;
|
|
52
52
|
/** The id of the thread to send the message to. */
|
|
@@ -57,15 +57,15 @@ export type ExecuteWebhookOptions = Pick<CreateMessageOptions, "content" | "tts"
|
|
|
57
57
|
username?: string;
|
|
58
58
|
/** If the created message should be returned. */
|
|
59
59
|
wait?: boolean;
|
|
60
|
-
}
|
|
61
|
-
export
|
|
60
|
+
}
|
|
61
|
+
export interface ExecuteWebhookWaitOptions extends Omit<ExecuteWebhookOptions, "wait"> { wait: true; }
|
|
62
62
|
|
|
63
63
|
export interface GetWebhookMessageOptions {
|
|
64
64
|
messageID: string;
|
|
65
65
|
threadID?: string;
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
-
export
|
|
68
|
+
export interface EditWebhookMessageOptions extends Pick<ExecuteWebhookOptions, "content" | "embeds" | "allowedMentions" | "components" | "attachments" | "threadID" | "files"> {}
|
|
69
69
|
|
|
70
70
|
export interface DeleteWebhookMessageOptions {
|
|
71
71
|
/** The id of the thread the message is in. */
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/** @module RawContainer */
|
|
2
|
+
import type { RawModalActionRow, RawMessageActionRow, RawEmbedOptions } from "../types/channels";
|
|
3
|
+
export type RawContainerData = RawEmbedOptions | RawModalActionRow | RawMessageActionRow;
|
|
4
|
+
export type RawEmbedsContainer = RawContainer<RawEmbedOptions>;
|
|
5
|
+
export type RawComponentsContainer<T extends RawMessageActionRow | RawModalActionRow = RawMessageActionRow | RawModalActionRow> = RawContainer<T>;
|
|
6
|
+
/** A container for raw data, such as {@link Types/Channels~RawEmbedOptions | embeds}, {@link Types/Channels~RawMessageActionRow | components}, or {@link Types/Channels~RawModalActionRow | modals}. */
|
|
7
|
+
export default class RawContainer<D extends RawContainerData> {
|
|
8
|
+
private data;
|
|
9
|
+
constructor(data: D);
|
|
10
|
+
get(): D;
|
|
11
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
/** A container for raw data, such as {@link Types/Channels~RawEmbedOptions | embeds}, {@link Types/Channels~RawMessageActionRow | components}, or {@link Types/Channels~RawModalActionRow | modals}. */
|
|
4
|
+
class RawContainer {
|
|
5
|
+
data;
|
|
6
|
+
constructor(data) {
|
|
7
|
+
this.data = data;
|
|
8
|
+
}
|
|
9
|
+
get() {
|
|
10
|
+
return this.data;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
exports.default = RawContainer;
|
|
14
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiUmF3Q29udGFpbmVyLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vbGliL3V0aWwvUmF3Q29udGFpbmVyLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBTUEsd01BQXdNO0FBQ3hNLE1BQXFCLFlBQVk7SUFDckIsSUFBSSxDQUFJO0lBQ2hCLFlBQVksSUFBTztRQUNmLElBQUksQ0FBQyxJQUFJLEdBQUcsSUFBSSxDQUFDO0lBQ3JCLENBQUM7SUFFRCxHQUFHO1FBQ0MsT0FBTyxJQUFJLENBQUMsSUFBSSxDQUFDO0lBQ3JCLENBQUM7Q0FDSjtBQVRELCtCQVNDIn0=
|
package/dist/lib/util/Util.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
+
import { type RawComponentsContainer, type RawEmbedsContainer } from "./RawContainer";
|
|
2
3
|
import type Client from "../Client";
|
|
3
4
|
import { type ImageFormat } from "../Constants";
|
|
4
|
-
import type { AllowedMentions, AnyChannel, AnyThreadChannel, Component, Embed, EmbedOptions, MessageActionRow, ModalActionRow, RawAllowedMentions, RawChannel, RawComponent, RawEmbed, RawEmbedOptions, RawMessageActionRow, RawModalActionRow, RawThreadChannel, ToComponentFromRaw, ToRawFromComponent } from "../types/channels";
|
|
5
|
+
import type { ActionRowToRaw, AllowedMentions, AnyChannel, AnyThreadChannel, Component, Embed, EmbedOptions, MessageActionRow, ModalActionRow, RawAllowedMentions, RawChannel, RawComponent, RawEmbed, RawEmbedOptions, RawMessageActionRow, RawModalActionRow, RawThreadChannel, ToComponentFromRaw, ToRawFromComponent } from "../types/channels";
|
|
5
6
|
import type { RawMember, RawSticker, RESTMember, Sticker } from "../types/guilds";
|
|
6
7
|
import type { ApplicationCommandOptions, RawApplicationCommandOption } from "../types/application-commands";
|
|
7
8
|
import Member from "../structures/Member";
|
|
@@ -10,16 +11,20 @@ export default class Util {
|
|
|
10
11
|
#private;
|
|
11
12
|
static BASE64URL_REGEX: RegExp;
|
|
12
13
|
constructor(client: Client);
|
|
14
|
+
static raw(data: RawEmbedOptions): RawEmbedsContainer;
|
|
15
|
+
static raw(data: Array<RawEmbedOptions>): Array<RawEmbedsContainer>;
|
|
16
|
+
static raw<T extends RawModalActionRow | RawMessageActionRow>(data: T): RawComponentsContainer<T>;
|
|
17
|
+
static raw<T extends RawModalActionRow | RawMessageActionRow>(data: Array<T>): Array<RawComponentsContainer<T>>;
|
|
13
18
|
/** @hidden intentionally not documented - this is an internal function */
|
|
14
19
|
_convertImage(image: Buffer | string, name: string): string;
|
|
15
20
|
componentToParsed<T extends RawComponent>(component: T): ToComponentFromRaw<T>;
|
|
16
21
|
componentToRaw<T extends Component>(component: T): ToRawFromComponent<T>;
|
|
17
22
|
componentsToParsed<T extends RawModalActionRow | RawMessageActionRow>(components: Array<T>): T extends RawModalActionRow ? Array<ModalActionRow> : T extends RawMessageActionRow ? Array<MessageActionRow> : never;
|
|
18
|
-
componentsToRaw<T extends ModalActionRow | MessageActionRow>(components: Array<T
|
|
23
|
+
componentsToRaw<T extends ModalActionRow | MessageActionRow>(components: Array<T | RawComponentsContainer<ActionRowToRaw<T>>>): Array<ActionRowToRaw<T>>;
|
|
19
24
|
convertImage(img: Buffer | string): string;
|
|
20
25
|
convertSticker(raw: RawSticker): Sticker;
|
|
21
26
|
embedsToParsed(embeds: Array<RawEmbed>): Array<Embed>;
|
|
22
|
-
embedsToRaw(embeds: Array<EmbedOptions>): Array<RawEmbedOptions>;
|
|
27
|
+
embedsToRaw(embeds: Array<EmbedOptions | RawEmbedsContainer>): Array<RawEmbedOptions>;
|
|
23
28
|
formatAllowedMentions(allowed?: AllowedMentions): RawAllowedMentions;
|
|
24
29
|
formatImage(url: string, format?: ImageFormat, size?: number): string;
|
|
25
30
|
getMagic(file: Buffer, len?: number): string;
|