From 2814d7e2f5c457eddc7932471c38ce5a8bcdd867 Mon Sep 17 00:00:00 2001 From: Vlad Frangu Date: Mon, 4 Mar 2024 21:41:06 +0200 Subject: [PATCH] chore: wowzah --- .prettierignore | 3 ++ deno/payloads/common.ts | 2 +- .../_applicationCommands/_chatInput/shared.ts | 2 +- .../_applicationCommands/chatInput.ts | 28 +++++++++---------- .../_applicationCommands/contextMenu.ts | 14 +++++----- .../_applicationCommands/permissions.ts | 4 +-- .../v10/_interactions/applicationCommands.ts | 2 +- deno/payloads/v10/_interactions/base.ts | 28 +++++++++---------- .../v10/_interactions/messageComponents.ts | 16 +++++------ deno/payloads/v10/_interactions/responses.ts | 6 ++-- .../_applicationCommands/_chatInput/shared.ts | 2 +- .../_applicationCommands/chatInput.ts | 28 +++++++++---------- .../_applicationCommands/contextMenu.ts | 14 +++++----- .../v8/_interactions/applicationCommands.ts | 2 +- deno/payloads/v8/_interactions/base.ts | 20 ++++++------- deno/payloads/v8/_interactions/responses.ts | 6 ++-- .../_applicationCommands/_chatInput/shared.ts | 2 +- .../_applicationCommands/chatInput.ts | 28 +++++++++---------- .../_applicationCommands/contextMenu.ts | 14 +++++----- .../_applicationCommands/permissions.ts | 4 +-- .../v9/_interactions/applicationCommands.ts | 2 +- deno/payloads/v9/_interactions/base.ts | 28 +++++++++---------- .../v9/_interactions/messageComponents.ts | 16 +++++------ deno/payloads/v9/_interactions/responses.ts | 6 ++-- package.json | 6 ++-- payloads/common.ts | 2 +- .../_applicationCommands/_chatInput/shared.ts | 2 +- .../_applicationCommands/chatInput.ts | 28 +++++++++---------- .../_applicationCommands/contextMenu.ts | 14 +++++----- .../_applicationCommands/permissions.ts | 4 +-- .../v10/_interactions/applicationCommands.ts | 2 +- payloads/v10/_interactions/base.ts | 28 +++++++++---------- .../v10/_interactions/messageComponents.ts | 16 +++++------ payloads/v10/_interactions/responses.ts | 6 ++-- .../_applicationCommands/_chatInput/shared.ts | 2 +- .../_applicationCommands/chatInput.ts | 28 +++++++++---------- .../_applicationCommands/contextMenu.ts | 14 +++++----- .../v8/_interactions/applicationCommands.ts | 2 +- payloads/v8/_interactions/base.ts | 20 ++++++------- payloads/v8/_interactions/responses.ts | 6 ++-- .../_applicationCommands/_chatInput/shared.ts | 2 +- .../_applicationCommands/chatInput.ts | 28 +++++++++---------- .../_applicationCommands/contextMenu.ts | 14 +++++----- .../_applicationCommands/permissions.ts | 4 +-- .../v9/_interactions/applicationCommands.ts | 2 +- payloads/v9/_interactions/base.ts | 28 +++++++++---------- .../v9/_interactions/messageComponents.ts | 16 +++++------ payloads/v9/_interactions/responses.ts | 6 ++-- scripts/actions/create-pr.mjs | 4 +-- scripts/actions/create-release.mjs | 4 +-- scripts/actions/report-deno-not-ran.mjs | 8 ++++-- scripts/bump-version.mjs | 4 +-- scripts/bump-website-version.mjs | 1 + scripts/deno.mjs | 13 +++++---- scripts/versions.mjs | 28 +++++++++---------- 55 files changed, 313 insertions(+), 306 deletions(-) diff --git a/.prettierignore b/.prettierignore index ba19d385..0aca574f 100644 --- a/.prettierignore +++ b/.prettierignore @@ -18,3 +18,6 @@ website/build # Miscellaneous CODEOWNERS + +# Format all of scripts +!scripts/**/* diff --git a/deno/payloads/common.ts b/deno/payloads/common.ts index 2f442065..af098d53 100644 --- a/deno/payloads/common.ts +++ b/deno/payloads/common.ts @@ -305,7 +305,7 @@ export interface RESTErrorGroupWrapper { _errors: RESTErrorData[]; } -export type RESTErrorData = RESTErrorGroupWrapper | RESTErrorFieldInformation | { [k: string]: RESTErrorData } | string; +export type RESTErrorData = RESTErrorFieldInformation | RESTErrorGroupWrapper | string | { [k: string]: RESTErrorData }; /** * https://discord.com/developers/docs/topics/rate-limits#exceeding-a-rate-limit-rate-limit-response-structure diff --git a/deno/payloads/v10/_interactions/_applicationCommands/_chatInput/shared.ts b/deno/payloads/v10/_interactions/_applicationCommands/_chatInput/shared.ts index 4bc23e43..bc7b9e7b 100644 --- a/deno/payloads/v10/_interactions/_applicationCommands/_chatInput/shared.ts +++ b/deno/payloads/v10/_interactions/_applicationCommands/_chatInput/shared.ts @@ -20,7 +20,7 @@ export enum ApplicationCommandOptionType { /** * https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-option-choice-structure */ -export interface APIApplicationCommandOptionChoice { +export interface APIApplicationCommandOptionChoice { name: string; name_localizations?: LocalizationMap | null; value: ValueType; diff --git a/deno/payloads/v10/_interactions/_applicationCommands/chatInput.ts b/deno/payloads/v10/_interactions/_applicationCommands/chatInput.ts index 36b9d0fc..c22f69c9 100644 --- a/deno/payloads/v10/_interactions/_applicationCommands/chatInput.ts +++ b/deno/payloads/v10/_interactions/_applicationCommands/chatInput.ts @@ -65,42 +65,42 @@ export * from './_chatInput/user.ts'; * https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-option-structure */ export type APIApplicationCommandBasicOption = - | APIApplicationCommandStringOption - | APIApplicationCommandIntegerOption + | APIApplicationCommandAttachmentOption | APIApplicationCommandBooleanOption - | APIApplicationCommandUserOption | APIApplicationCommandChannelOption - | APIApplicationCommandRoleOption + | APIApplicationCommandIntegerOption | APIApplicationCommandMentionableOption | APIApplicationCommandNumberOption - | APIApplicationCommandAttachmentOption; + | APIApplicationCommandRoleOption + | APIApplicationCommandStringOption + | APIApplicationCommandUserOption; /** * https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-option-structure */ export type APIApplicationCommandOption = - | APIApplicationCommandSubcommandOption + | APIApplicationCommandBasicOption | APIApplicationCommandSubcommandGroupOption - | APIApplicationCommandBasicOption; + | APIApplicationCommandSubcommandOption; /** * https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-interaction-data-option-structure */ export type APIApplicationCommandInteractionDataOption = - | APIApplicationCommandInteractionDataSubcommandOption + | APIApplicationCommandInteractionDataBasicOption | APIApplicationCommandInteractionDataSubcommandGroupOption - | APIApplicationCommandInteractionDataBasicOption; + | APIApplicationCommandInteractionDataSubcommandOption; export type APIApplicationCommandInteractionDataBasicOption = - | APIApplicationCommandInteractionDataStringOption - | APIApplicationCommandInteractionDataIntegerOption + | APIApplicationCommandInteractionDataAttachmentOption | APIApplicationCommandInteractionDataBooleanOption - | APIApplicationCommandInteractionDataUserOption | APIApplicationCommandInteractionDataChannelOption - | APIApplicationCommandInteractionDataRoleOption + | APIApplicationCommandInteractionDataIntegerOption | APIApplicationCommandInteractionDataMentionableOption | APIApplicationCommandInteractionDataNumberOption - | APIApplicationCommandInteractionDataAttachmentOption; + | APIApplicationCommandInteractionDataRoleOption + | APIApplicationCommandInteractionDataStringOption + | APIApplicationCommandInteractionDataUserOption; /** * https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-interaction-data diff --git a/deno/payloads/v10/_interactions/_applicationCommands/contextMenu.ts b/deno/payloads/v10/_interactions/_applicationCommands/contextMenu.ts index 8c431277..8284769f 100644 --- a/deno/payloads/v10/_interactions/_applicationCommands/contextMenu.ts +++ b/deno/payloads/v10/_interactions/_applicationCommands/contextMenu.ts @@ -33,8 +33,8 @@ export interface APIMessageApplicationCommandInteractionDataResolved { * https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-interaction-data */ export type APIContextMenuInteractionData = - | APIUserApplicationCommandInteractionData - | APIMessageApplicationCommandInteractionData; + | APIMessageApplicationCommandInteractionData + | APIUserApplicationCommandInteractionData; /** * https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object @@ -74,18 +74,18 @@ export type APIMessageApplicationCommandGuildInteraction = /** * https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object */ -export type APIContextMenuInteraction = APIUserApplicationCommandInteraction | APIMessageApplicationCommandInteraction; +export type APIContextMenuInteraction = APIMessageApplicationCommandInteraction | APIUserApplicationCommandInteraction; /** * https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object */ export type APIContextMenuDMInteraction = - | APIUserApplicationCommandDMInteraction - | APIMessageApplicationCommandDMInteraction; + | APIMessageApplicationCommandDMInteraction + | APIUserApplicationCommandDMInteraction; /** * https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object */ export type APIContextMenuGuildInteraction = - | APIUserApplicationCommandGuildInteraction - | APIMessageApplicationCommandGuildInteraction; + | APIMessageApplicationCommandGuildInteraction + | APIUserApplicationCommandGuildInteraction; diff --git a/deno/payloads/v10/_interactions/_applicationCommands/permissions.ts b/deno/payloads/v10/_interactions/_applicationCommands/permissions.ts index 5a9671ad..1a425469 100644 --- a/deno/payloads/v10/_interactions/_applicationCommands/permissions.ts +++ b/deno/payloads/v10/_interactions/_applicationCommands/permissions.ts @@ -54,6 +54,6 @@ export enum ApplicationCommandPermissionType { */ export const APIApplicationCommandPermissionsConstant = { // eslint-disable-next-line unicorn/prefer-native-coercion-functions - Everyone: (guildId: string | bigint): Snowflake => String(guildId), - AllChannels: (guildId: string | bigint): Snowflake => String(BigInt(guildId) - 1n), + Everyone: (guildId: bigint | string): Snowflake => String(guildId), + AllChannels: (guildId: bigint | string): Snowflake => String(BigInt(guildId) - 1n), }; diff --git a/deno/payloads/v10/_interactions/applicationCommands.ts b/deno/payloads/v10/_interactions/applicationCommands.ts index fa6d90a4..4e087fe5 100644 --- a/deno/payloads/v10/_interactions/applicationCommands.ts +++ b/deno/payloads/v10/_interactions/applicationCommands.ts @@ -118,7 +118,7 @@ export type APIApplicationCommandInteractionWrapper, - 'channel' | 'channel_id' | 'data' | 'app_permissions' + 'app_permissions' | 'channel_id' | 'channel' | 'data' > >; diff --git a/deno/payloads/v10/_interactions/base.ts b/deno/payloads/v10/_interactions/base.ts index b50f3d38..55f37b71 100644 --- a/deno/payloads/v10/_interactions/base.ts +++ b/deno/payloads/v10/_interactions/base.ts @@ -16,15 +16,15 @@ import type { InteractionType } from './responses.ts'; export type PartialAPIMessageInteractionGuildMember = Pick< APIGuildMember, - | 'roles' - | 'premium_since' - | 'pending' - | 'nick' - | 'mute' - | 'joined_at' - | 'deaf' - | 'communication_disabled_until' | 'avatar' + | 'communication_disabled_until' + | 'deaf' + | 'joined_at' + | 'mute' + | 'nick' + | 'pending' + | 'premium_since' + | 'roles' >; /** @@ -139,7 +139,7 @@ export interface APIBaseInteraction { export type APIDMInteractionWrapper> = Omit< Original, - 'member' | 'guild_id' + 'guild_id' | 'member' > & Required>; @@ -147,7 +147,7 @@ export type APIGuildInteractionWrapper & - Required>; + Required>; export interface APIInteractionDataResolvedChannelBase extends Required { type: T; @@ -160,12 +160,12 @@ export interface APIInteractionDataResolvedChannelBase ex export type APIInteractionDataResolvedChannel = | APIInteractionDataResolvedChannelBase> | (APIInteractionDataResolvedChannelBase & - Pick); + Pick); /** * https://discord.com/developers/docs/resources/guild#guild-member-object */ -export interface APIInteractionDataResolvedGuildMember extends Omit { +export interface APIInteractionDataResolvedGuildMember extends Omit { permissions: Permissions; } @@ -188,8 +188,8 @@ export type APIChatInputApplicationCommandInteractionDataResolved = APIInteracti /** * `users` and optional `members` from APIInteractionDataResolved, for user commands and user selects */ -export type APIUserInteractionDataResolved = Required> & - Pick; +export type APIUserInteractionDataResolved = Pick & + Required>; /** * @deprecated Renamed to `APIUserInteractionDataResolved` diff --git a/deno/payloads/v10/_interactions/messageComponents.ts b/deno/payloads/v10/_interactions/messageComponents.ts index d2136c3b..7462df2e 100644 --- a/deno/payloads/v10/_interactions/messageComponents.ts +++ b/deno/payloads/v10/_interactions/messageComponents.ts @@ -15,7 +15,7 @@ export type APIMessageComponentInteraction = APIBaseInteraction< Required< Pick< APIBaseInteraction, - 'channel' | 'channel_id' | 'data' | 'app_permissions' | 'message' + 'app_permissions' | 'channel_id' | 'channel' | 'data' | 'message' > >; @@ -26,7 +26,7 @@ export type APIMessageComponentButtonInteraction = APIBaseInteraction< Required< Pick< APIBaseInteraction, - 'channel' | 'channel_id' | 'data' | 'app_permissions' | 'message' + 'app_permissions' | 'channel_id' | 'channel' | 'data' | 'message' > >; @@ -37,7 +37,7 @@ export type APIMessageComponentSelectMenuInteraction = APIBaseInteraction< Required< Pick< APIBaseInteraction, - 'channel' | 'channel_id' | 'data' | 'app_permissions' | 'message' + 'app_permissions' | 'channel_id' | 'channel' | 'data' | 'message' > >; @@ -76,7 +76,7 @@ export interface APIMessageRoleSelectInteractionData export interface APIMessageMentionableSelectInteractionData extends APIMessageComponentBaseInteractionData { values: Snowflake[]; - resolved: Pick; + resolved: Pick; } export interface APIMessageChannelSelectInteractionData @@ -86,11 +86,11 @@ export interface APIMessageChannelSelectInteractionData } export type APIMessageSelectMenuInteractionData = - | APIMessageStringSelectInteractionData - | APIMessageUserSelectInteractionData - | APIMessageRoleSelectInteractionData + | APIMessageChannelSelectInteractionData | APIMessageMentionableSelectInteractionData - | APIMessageChannelSelectInteractionData; + | APIMessageRoleSelectInteractionData + | APIMessageStringSelectInteractionData + | APIMessageUserSelectInteractionData; export type APIMessageComponentDMInteraction = APIDMInteractionWrapper; diff --git a/deno/payloads/v10/_interactions/responses.ts b/deno/payloads/v10/_interactions/responses.ts index bd0f7bc3..14cc51e6 100644 --- a/deno/payloads/v10/_interactions/responses.ts +++ b/deno/payloads/v10/_interactions/responses.ts @@ -18,12 +18,12 @@ export enum InteractionType { * https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-response-object */ export type APIInteractionResponse = - | APIInteractionResponsePong + | APIApplicationCommandAutocompleteResponse | APIInteractionResponseChannelMessageWithSource | APIInteractionResponseDeferredChannelMessageWithSource | APIInteractionResponseDeferredMessageUpdate + | APIInteractionResponsePong | APIInteractionResponseUpdateMessage - | APIApplicationCommandAutocompleteResponse | APIModalInteractionResponse | APIPremiumRequiredInteractionResponse; @@ -107,7 +107,7 @@ export enum InteractionResponseType { */ export type APIInteractionResponseCallbackData = Omit< RESTPostAPIWebhookWithTokenJSONBody, - 'username' | 'avatar_url' + 'avatar_url' | 'username' > & { flags?: MessageFlags }; export interface APICommandAutocompleteInteractionResponseCallbackData { diff --git a/deno/payloads/v8/_interactions/_applicationCommands/_chatInput/shared.ts b/deno/payloads/v8/_interactions/_applicationCommands/_chatInput/shared.ts index 57c42cfd..6f3fff39 100644 --- a/deno/payloads/v8/_interactions/_applicationCommands/_chatInput/shared.ts +++ b/deno/payloads/v8/_interactions/_applicationCommands/_chatInput/shared.ts @@ -22,7 +22,7 @@ export enum ApplicationCommandOptionType { * * @deprecated API and gateway v8 are deprecated and the types will not receive further updates, please update to v10. */ -export interface APIApplicationCommandOptionChoice { +export interface APIApplicationCommandOptionChoice { name: string; value: ValueType; } diff --git a/deno/payloads/v8/_interactions/_applicationCommands/chatInput.ts b/deno/payloads/v8/_interactions/_applicationCommands/chatInput.ts index b52b53ac..55c70394 100644 --- a/deno/payloads/v8/_interactions/_applicationCommands/chatInput.ts +++ b/deno/payloads/v8/_interactions/_applicationCommands/chatInput.ts @@ -72,15 +72,15 @@ export * from './_chatInput/user.ts'; * @deprecated API and gateway v8 are deprecated and the types will not receive further updates, please update to v10. */ export type APIApplicationCommandBasicOption = - | APIApplicationCommandStringOption - | APIApplicationCommandIntegerOption + | APIApplicationCommandAttachmentOption | APIApplicationCommandBooleanOption - | APIApplicationCommandUserOption | APIApplicationCommandChannelOption - | APIApplicationCommandRoleOption + | APIApplicationCommandIntegerOption | APIApplicationCommandMentionableOption | APIApplicationCommandNumberOption - | APIApplicationCommandAttachmentOption; + | APIApplicationCommandRoleOption + | APIApplicationCommandStringOption + | APIApplicationCommandUserOption; /** * https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-option-structure @@ -88,9 +88,9 @@ export type APIApplicationCommandBasicOption = * @deprecated API and gateway v8 are deprecated and the types will not receive further updates, please update to v10. */ export type APIApplicationCommandOption = - | APIApplicationCommandSubcommandOption + | APIApplicationCommandBasicOption | APIApplicationCommandSubcommandGroupOption - | APIApplicationCommandBasicOption; + | APIApplicationCommandSubcommandOption; /** * https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-interaction-data-option-structure @@ -98,23 +98,23 @@ export type APIApplicationCommandOption = * @deprecated API and gateway v8 are deprecated and the types will not receive further updates, please update to v10. */ export type APIApplicationCommandInteractionDataOption = - | APIApplicationCommandInteractionDataSubcommandOption + | APIApplicationCommandInteractionDataBasicOption | APIApplicationCommandInteractionDataSubcommandGroupOption - | APIApplicationCommandInteractionDataBasicOption; + | APIApplicationCommandInteractionDataSubcommandOption; /** * @deprecated API and gateway v8 are deprecated and the types will not receive further updates, please update to v10. */ export type APIApplicationCommandInteractionDataBasicOption = - | APIApplicationCommandInteractionDataStringOption - | APIApplicationCommandInteractionDataIntegerOption + | APIApplicationCommandInteractionDataAttachmentOption | APIApplicationCommandInteractionDataBooleanOption - | APIApplicationCommandInteractionDataUserOption | APIApplicationCommandInteractionDataChannelOption - | APIApplicationCommandInteractionDataRoleOption + | APIApplicationCommandInteractionDataIntegerOption | APIApplicationCommandInteractionDataMentionableOption | APIApplicationCommandInteractionDataNumberOption - | APIApplicationCommandInteractionDataAttachmentOption; + | APIApplicationCommandInteractionDataRoleOption + | APIApplicationCommandInteractionDataStringOption + | APIApplicationCommandInteractionDataUserOption; /** * https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-interaction-data-structure diff --git a/deno/payloads/v8/_interactions/_applicationCommands/contextMenu.ts b/deno/payloads/v8/_interactions/_applicationCommands/contextMenu.ts index bb447c5a..d0f04862 100644 --- a/deno/payloads/v8/_interactions/_applicationCommands/contextMenu.ts +++ b/deno/payloads/v8/_interactions/_applicationCommands/contextMenu.ts @@ -56,8 +56,8 @@ export interface APIMessageApplicationCommandInteractionDataResolved { * @deprecated API and gateway v8 are deprecated and the types will not receive further updates, please update to v10. */ export type APIContextMenuInteractionData = - | APIUserApplicationCommandInteractionData - | APIMessageApplicationCommandInteractionData; + | APIMessageApplicationCommandInteractionData + | APIUserApplicationCommandInteractionData; /** * https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object @@ -111,7 +111,7 @@ export type APIMessageApplicationCommandGuildInteraction = * * @deprecated API and gateway v8 are deprecated and the types will not receive further updates, please update to v10. */ -export type APIContextMenuInteraction = APIUserApplicationCommandInteraction | APIMessageApplicationCommandInteraction; +export type APIContextMenuInteraction = APIMessageApplicationCommandInteraction | APIUserApplicationCommandInteraction; /** * https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object @@ -119,8 +119,8 @@ export type APIContextMenuInteraction = APIUserApplicationCommandInteraction | A * @deprecated API and gateway v8 are deprecated and the types will not receive further updates, please update to v10. */ export type APIContextMenuDMInteraction = - | APIUserApplicationCommandDMInteraction - | APIMessageApplicationCommandDMInteraction; + | APIMessageApplicationCommandDMInteraction + | APIUserApplicationCommandDMInteraction; /** * https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object @@ -128,5 +128,5 @@ export type APIContextMenuDMInteraction = * @deprecated API and gateway v8 are deprecated and the types will not receive further updates, please update to v10. */ export type APIContextMenuGuildInteraction = - | APIUserApplicationCommandGuildInteraction - | APIMessageApplicationCommandGuildInteraction; + | APIMessageApplicationCommandGuildInteraction + | APIUserApplicationCommandGuildInteraction; diff --git a/deno/payloads/v8/_interactions/applicationCommands.ts b/deno/payloads/v8/_interactions/applicationCommands.ts index 152917cd..f356d99a 100644 --- a/deno/payloads/v8/_interactions/applicationCommands.ts +++ b/deno/payloads/v8/_interactions/applicationCommands.ts @@ -101,7 +101,7 @@ export interface APIInteractionDataResolvedChannel extends Required { +export interface APIInteractionDataResolvedGuildMember extends Omit { permissions: Permissions; } diff --git a/deno/payloads/v8/_interactions/base.ts b/deno/payloads/v8/_interactions/base.ts index 8526eac5..9800dd9b 100644 --- a/deno/payloads/v8/_interactions/base.ts +++ b/deno/payloads/v8/_interactions/base.ts @@ -10,15 +10,15 @@ import type { InteractionType } from './responses.ts'; */ export type PartialAPIMessageInteractionGuildMember = Pick< APIGuildMember, - | 'roles' - | 'premium_since' - | 'pending' - | 'nick' - | 'mute' - | 'joined_at' - | 'deaf' - | 'communication_disabled_until' | 'avatar' + | 'communication_disabled_until' + | 'deaf' + | 'joined_at' + | 'mute' + | 'nick' + | 'pending' + | 'premium_since' + | 'roles' >; /** @@ -128,7 +128,7 @@ export interface APIBaseInteraction { */ export type APIDMInteractionWrapper> = Omit< Original, - 'member' | 'guild_id' + 'guild_id' | 'member' > & Required>; @@ -139,4 +139,4 @@ export type APIGuildInteractionWrapper & - Required>; + Required>; diff --git a/deno/payloads/v8/_interactions/responses.ts b/deno/payloads/v8/_interactions/responses.ts index 8ec98a8c..79784dc1 100644 --- a/deno/payloads/v8/_interactions/responses.ts +++ b/deno/payloads/v8/_interactions/responses.ts @@ -22,12 +22,12 @@ export enum InteractionType { * @deprecated API and gateway v8 are deprecated and the types will not receive further updates, please update to v10. */ export type APIInteractionResponse = - | APIInteractionResponsePong + | APIApplicationCommandAutocompleteResponse | APIInteractionResponseChannelMessageWithSource | APIInteractionResponseDeferredChannelMessageWithSource | APIInteractionResponseDeferredMessageUpdate + | APIInteractionResponsePong | APIInteractionResponseUpdateMessage - | APIApplicationCommandAutocompleteResponse | APIModalInteractionResponse; /** @@ -127,7 +127,7 @@ export enum InteractionResponseType { */ export type APIInteractionResponseCallbackData = Omit< RESTPostAPIWebhookWithTokenJSONBody, - 'username' | 'avatar_url' + 'avatar_url' | 'username' > & { flags?: MessageFlags }; /** diff --git a/deno/payloads/v9/_interactions/_applicationCommands/_chatInput/shared.ts b/deno/payloads/v9/_interactions/_applicationCommands/_chatInput/shared.ts index ac3a2c23..56707526 100644 --- a/deno/payloads/v9/_interactions/_applicationCommands/_chatInput/shared.ts +++ b/deno/payloads/v9/_interactions/_applicationCommands/_chatInput/shared.ts @@ -20,7 +20,7 @@ export enum ApplicationCommandOptionType { /** * https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-option-choice-structure */ -export interface APIApplicationCommandOptionChoice { +export interface APIApplicationCommandOptionChoice { name: string; name_localizations?: LocalizationMap | null; value: ValueType; diff --git a/deno/payloads/v9/_interactions/_applicationCommands/chatInput.ts b/deno/payloads/v9/_interactions/_applicationCommands/chatInput.ts index 36b9d0fc..c22f69c9 100644 --- a/deno/payloads/v9/_interactions/_applicationCommands/chatInput.ts +++ b/deno/payloads/v9/_interactions/_applicationCommands/chatInput.ts @@ -65,42 +65,42 @@ export * from './_chatInput/user.ts'; * https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-option-structure */ export type APIApplicationCommandBasicOption = - | APIApplicationCommandStringOption - | APIApplicationCommandIntegerOption + | APIApplicationCommandAttachmentOption | APIApplicationCommandBooleanOption - | APIApplicationCommandUserOption | APIApplicationCommandChannelOption - | APIApplicationCommandRoleOption + | APIApplicationCommandIntegerOption | APIApplicationCommandMentionableOption | APIApplicationCommandNumberOption - | APIApplicationCommandAttachmentOption; + | APIApplicationCommandRoleOption + | APIApplicationCommandStringOption + | APIApplicationCommandUserOption; /** * https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-option-structure */ export type APIApplicationCommandOption = - | APIApplicationCommandSubcommandOption + | APIApplicationCommandBasicOption | APIApplicationCommandSubcommandGroupOption - | APIApplicationCommandBasicOption; + | APIApplicationCommandSubcommandOption; /** * https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-interaction-data-option-structure */ export type APIApplicationCommandInteractionDataOption = - | APIApplicationCommandInteractionDataSubcommandOption + | APIApplicationCommandInteractionDataBasicOption | APIApplicationCommandInteractionDataSubcommandGroupOption - | APIApplicationCommandInteractionDataBasicOption; + | APIApplicationCommandInteractionDataSubcommandOption; export type APIApplicationCommandInteractionDataBasicOption = - | APIApplicationCommandInteractionDataStringOption - | APIApplicationCommandInteractionDataIntegerOption + | APIApplicationCommandInteractionDataAttachmentOption | APIApplicationCommandInteractionDataBooleanOption - | APIApplicationCommandInteractionDataUserOption | APIApplicationCommandInteractionDataChannelOption - | APIApplicationCommandInteractionDataRoleOption + | APIApplicationCommandInteractionDataIntegerOption | APIApplicationCommandInteractionDataMentionableOption | APIApplicationCommandInteractionDataNumberOption - | APIApplicationCommandInteractionDataAttachmentOption; + | APIApplicationCommandInteractionDataRoleOption + | APIApplicationCommandInteractionDataStringOption + | APIApplicationCommandInteractionDataUserOption; /** * https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-interaction-data diff --git a/deno/payloads/v9/_interactions/_applicationCommands/contextMenu.ts b/deno/payloads/v9/_interactions/_applicationCommands/contextMenu.ts index 8c431277..8284769f 100644 --- a/deno/payloads/v9/_interactions/_applicationCommands/contextMenu.ts +++ b/deno/payloads/v9/_interactions/_applicationCommands/contextMenu.ts @@ -33,8 +33,8 @@ export interface APIMessageApplicationCommandInteractionDataResolved { * https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-interaction-data */ export type APIContextMenuInteractionData = - | APIUserApplicationCommandInteractionData - | APIMessageApplicationCommandInteractionData; + | APIMessageApplicationCommandInteractionData + | APIUserApplicationCommandInteractionData; /** * https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object @@ -74,18 +74,18 @@ export type APIMessageApplicationCommandGuildInteraction = /** * https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object */ -export type APIContextMenuInteraction = APIUserApplicationCommandInteraction | APIMessageApplicationCommandInteraction; +export type APIContextMenuInteraction = APIMessageApplicationCommandInteraction | APIUserApplicationCommandInteraction; /** * https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object */ export type APIContextMenuDMInteraction = - | APIUserApplicationCommandDMInteraction - | APIMessageApplicationCommandDMInteraction; + | APIMessageApplicationCommandDMInteraction + | APIUserApplicationCommandDMInteraction; /** * https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object */ export type APIContextMenuGuildInteraction = - | APIUserApplicationCommandGuildInteraction - | APIMessageApplicationCommandGuildInteraction; + | APIMessageApplicationCommandGuildInteraction + | APIUserApplicationCommandGuildInteraction; diff --git a/deno/payloads/v9/_interactions/_applicationCommands/permissions.ts b/deno/payloads/v9/_interactions/_applicationCommands/permissions.ts index 5a9671ad..1a425469 100644 --- a/deno/payloads/v9/_interactions/_applicationCommands/permissions.ts +++ b/deno/payloads/v9/_interactions/_applicationCommands/permissions.ts @@ -54,6 +54,6 @@ export enum ApplicationCommandPermissionType { */ export const APIApplicationCommandPermissionsConstant = { // eslint-disable-next-line unicorn/prefer-native-coercion-functions - Everyone: (guildId: string | bigint): Snowflake => String(guildId), - AllChannels: (guildId: string | bigint): Snowflake => String(BigInt(guildId) - 1n), + Everyone: (guildId: bigint | string): Snowflake => String(guildId), + AllChannels: (guildId: bigint | string): Snowflake => String(BigInt(guildId) - 1n), }; diff --git a/deno/payloads/v9/_interactions/applicationCommands.ts b/deno/payloads/v9/_interactions/applicationCommands.ts index 7d649d2f..52c7b5a5 100644 --- a/deno/payloads/v9/_interactions/applicationCommands.ts +++ b/deno/payloads/v9/_interactions/applicationCommands.ts @@ -118,7 +118,7 @@ export type APIApplicationCommandInteractionWrapper, - 'channel' | 'channel_id' | 'data' | 'app_permissions' + 'app_permissions' | 'channel_id' | 'channel' | 'data' > >; diff --git a/deno/payloads/v9/_interactions/base.ts b/deno/payloads/v9/_interactions/base.ts index 8afb0971..897e3ab7 100644 --- a/deno/payloads/v9/_interactions/base.ts +++ b/deno/payloads/v9/_interactions/base.ts @@ -16,15 +16,15 @@ import type { InteractionType } from './responses.ts'; export type PartialAPIMessageInteractionGuildMember = Pick< APIGuildMember, - | 'roles' - | 'premium_since' - | 'pending' - | 'nick' - | 'mute' - | 'joined_at' - | 'deaf' - | 'communication_disabled_until' | 'avatar' + | 'communication_disabled_until' + | 'deaf' + | 'joined_at' + | 'mute' + | 'nick' + | 'pending' + | 'premium_since' + | 'roles' >; /** @@ -139,7 +139,7 @@ export interface APIBaseInteraction { export type APIDMInteractionWrapper> = Omit< Original, - 'member' | 'guild_id' + 'guild_id' | 'member' > & Required>; @@ -147,7 +147,7 @@ export type APIGuildInteractionWrapper & - Required>; + Required>; export interface APIInteractionDataResolvedChannelBase extends Required { type: T; @@ -160,12 +160,12 @@ export interface APIInteractionDataResolvedChannelBase ex export type APIInteractionDataResolvedChannel = | APIInteractionDataResolvedChannelBase> | (APIInteractionDataResolvedChannelBase & - Pick); + Pick); /** * https://discord.com/developers/docs/resources/guild#guild-member-object */ -export interface APIInteractionDataResolvedGuildMember extends Omit { +export interface APIInteractionDataResolvedGuildMember extends Omit { permissions: Permissions; } @@ -188,8 +188,8 @@ export type APIChatInputApplicationCommandInteractionDataResolved = APIInteracti /** * `users` and optional `members` from APIInteractionDataResolved, for user commands and user selects */ -export type APIUserInteractionDataResolved = Required> & - Pick; +export type APIUserInteractionDataResolved = Pick & + Required>; /** * @deprecated Renamed to `APIUserInteractionDataResolved` diff --git a/deno/payloads/v9/_interactions/messageComponents.ts b/deno/payloads/v9/_interactions/messageComponents.ts index d2136c3b..7462df2e 100644 --- a/deno/payloads/v9/_interactions/messageComponents.ts +++ b/deno/payloads/v9/_interactions/messageComponents.ts @@ -15,7 +15,7 @@ export type APIMessageComponentInteraction = APIBaseInteraction< Required< Pick< APIBaseInteraction, - 'channel' | 'channel_id' | 'data' | 'app_permissions' | 'message' + 'app_permissions' | 'channel_id' | 'channel' | 'data' | 'message' > >; @@ -26,7 +26,7 @@ export type APIMessageComponentButtonInteraction = APIBaseInteraction< Required< Pick< APIBaseInteraction, - 'channel' | 'channel_id' | 'data' | 'app_permissions' | 'message' + 'app_permissions' | 'channel_id' | 'channel' | 'data' | 'message' > >; @@ -37,7 +37,7 @@ export type APIMessageComponentSelectMenuInteraction = APIBaseInteraction< Required< Pick< APIBaseInteraction, - 'channel' | 'channel_id' | 'data' | 'app_permissions' | 'message' + 'app_permissions' | 'channel_id' | 'channel' | 'data' | 'message' > >; @@ -76,7 +76,7 @@ export interface APIMessageRoleSelectInteractionData export interface APIMessageMentionableSelectInteractionData extends APIMessageComponentBaseInteractionData { values: Snowflake[]; - resolved: Pick; + resolved: Pick; } export interface APIMessageChannelSelectInteractionData @@ -86,11 +86,11 @@ export interface APIMessageChannelSelectInteractionData } export type APIMessageSelectMenuInteractionData = - | APIMessageStringSelectInteractionData - | APIMessageUserSelectInteractionData - | APIMessageRoleSelectInteractionData + | APIMessageChannelSelectInteractionData | APIMessageMentionableSelectInteractionData - | APIMessageChannelSelectInteractionData; + | APIMessageRoleSelectInteractionData + | APIMessageStringSelectInteractionData + | APIMessageUserSelectInteractionData; export type APIMessageComponentDMInteraction = APIDMInteractionWrapper; diff --git a/deno/payloads/v9/_interactions/responses.ts b/deno/payloads/v9/_interactions/responses.ts index 6bb3966d..f40872aa 100644 --- a/deno/payloads/v9/_interactions/responses.ts +++ b/deno/payloads/v9/_interactions/responses.ts @@ -18,12 +18,12 @@ export enum InteractionType { * https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-response-object */ export type APIInteractionResponse = - | APIInteractionResponsePong + | APIApplicationCommandAutocompleteResponse | APIInteractionResponseChannelMessageWithSource | APIInteractionResponseDeferredChannelMessageWithSource | APIInteractionResponseDeferredMessageUpdate + | APIInteractionResponsePong | APIInteractionResponseUpdateMessage - | APIApplicationCommandAutocompleteResponse | APIModalInteractionResponse | APIPremiumRequiredInteractionResponse; @@ -107,7 +107,7 @@ export enum InteractionResponseType { */ export type APIInteractionResponseCallbackData = Omit< RESTPostAPIWebhookWithTokenJSONBody, - 'username' | 'avatar_url' + 'avatar_url' | 'username' > & { flags?: MessageFlags }; export interface APICommandAutocompleteInteractionResponseCallbackData { diff --git a/package.json b/package.json index 58ddcf16..b2193ee1 100644 --- a/package.json +++ b/package.json @@ -97,7 +97,7 @@ "changelog": "conventional-changelog -p angular -i CHANGELOG.md -s", "ci:pr": "run-s changelog lint build:deno && node ./scripts/bump-website-version.mjs", "clean:deno": "rimraf deno/", - "clean:node": "rimraf --glob {gateway,payloads,rest,rpc,voice,utils}/**/*.{js,mjs,d.ts,*map} {globals,v*}.{js,mjs,d.ts,*map}", + "clean:node": "rimraf --glob \"{gateway,payloads,rest,rpc,voice,utils}/**/*.{js,mjs,d.ts,*map}\" \"{globals,v*}.{js,mjs,d.ts,*map}\"", "clean": "run-p clean:*", "esm:gateway": "gen-esm-wrapper ./gateway/index.js ./gateway/index.mjs", "esm:globals": "gen-esm-wrapper ./globals.js ./globals.mjs", @@ -107,11 +107,11 @@ "esm:utils": "gen-esm-wrapper ./utils/index.js ./utils/index.mjs", "esm:versions": "node ./scripts/versions.mjs", "esm:voice": "gen-esm-wrapper ./voice/index.js ./voice/index.mjs", - "lint": "prettier --write . && eslint --fix --ext mjs,ts {gateway,payloads,rest,rpc,voice,utils}/**/*.ts {globals,v*}.ts scripts/**/*.mjs", + "lint": "prettier --write . && eslint --fix --ext mjs,ts \"{gateway,payloads,rest,rpc,voice,utils}/**/*.ts\" \"{globals,v*}.ts\" \"scripts/**/*.mjs\"", "postpublish": "run-s clean:node build:deno", "prepare": "tsc -p ./.eslint-plugin-local && (is-ci || husky)", "prepublishOnly": "run-s clean test:lint build:node", - "test:lint": "prettier --check . && eslint --ext mjs,ts {gateway,payloads,rest,rpc,voice,utils}/**/*.ts {globals,v*}.ts scripts/**/*.mjs", + "test:lint": "prettier --check . && eslint --ext mjs,ts \"{gateway,payloads,rest,rpc,voice,utils}/**/*.ts\" \"{globals,v*}.ts\" \"scripts/**/*.mjs\"", "pretest:types": "tsc", "test:types": "tsd -t ./v10.d.ts", "posttest:types": "npm run clean:node" diff --git a/payloads/common.ts b/payloads/common.ts index ef5ddf89..6d5b31a5 100644 --- a/payloads/common.ts +++ b/payloads/common.ts @@ -305,7 +305,7 @@ export interface RESTErrorGroupWrapper { _errors: RESTErrorData[]; } -export type RESTErrorData = RESTErrorGroupWrapper | RESTErrorFieldInformation | { [k: string]: RESTErrorData } | string; +export type RESTErrorData = RESTErrorFieldInformation | RESTErrorGroupWrapper | string | { [k: string]: RESTErrorData }; /** * https://discord.com/developers/docs/topics/rate-limits#exceeding-a-rate-limit-rate-limit-response-structure diff --git a/payloads/v10/_interactions/_applicationCommands/_chatInput/shared.ts b/payloads/v10/_interactions/_applicationCommands/_chatInput/shared.ts index 0d826031..ce580558 100644 --- a/payloads/v10/_interactions/_applicationCommands/_chatInput/shared.ts +++ b/payloads/v10/_interactions/_applicationCommands/_chatInput/shared.ts @@ -20,7 +20,7 @@ export enum ApplicationCommandOptionType { /** * https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-option-choice-structure */ -export interface APIApplicationCommandOptionChoice { +export interface APIApplicationCommandOptionChoice { name: string; name_localizations?: LocalizationMap | null; value: ValueType; diff --git a/payloads/v10/_interactions/_applicationCommands/chatInput.ts b/payloads/v10/_interactions/_applicationCommands/chatInput.ts index 7f1f1eea..f1ae3148 100644 --- a/payloads/v10/_interactions/_applicationCommands/chatInput.ts +++ b/payloads/v10/_interactions/_applicationCommands/chatInput.ts @@ -65,42 +65,42 @@ export * from './_chatInput/user'; * https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-option-structure */ export type APIApplicationCommandBasicOption = - | APIApplicationCommandStringOption - | APIApplicationCommandIntegerOption + | APIApplicationCommandAttachmentOption | APIApplicationCommandBooleanOption - | APIApplicationCommandUserOption | APIApplicationCommandChannelOption - | APIApplicationCommandRoleOption + | APIApplicationCommandIntegerOption | APIApplicationCommandMentionableOption | APIApplicationCommandNumberOption - | APIApplicationCommandAttachmentOption; + | APIApplicationCommandRoleOption + | APIApplicationCommandStringOption + | APIApplicationCommandUserOption; /** * https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-option-structure */ export type APIApplicationCommandOption = - | APIApplicationCommandSubcommandOption + | APIApplicationCommandBasicOption | APIApplicationCommandSubcommandGroupOption - | APIApplicationCommandBasicOption; + | APIApplicationCommandSubcommandOption; /** * https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-interaction-data-option-structure */ export type APIApplicationCommandInteractionDataOption = - | APIApplicationCommandInteractionDataSubcommandOption + | APIApplicationCommandInteractionDataBasicOption | APIApplicationCommandInteractionDataSubcommandGroupOption - | APIApplicationCommandInteractionDataBasicOption; + | APIApplicationCommandInteractionDataSubcommandOption; export type APIApplicationCommandInteractionDataBasicOption = - | APIApplicationCommandInteractionDataStringOption - | APIApplicationCommandInteractionDataIntegerOption + | APIApplicationCommandInteractionDataAttachmentOption | APIApplicationCommandInteractionDataBooleanOption - | APIApplicationCommandInteractionDataUserOption | APIApplicationCommandInteractionDataChannelOption - | APIApplicationCommandInteractionDataRoleOption + | APIApplicationCommandInteractionDataIntegerOption | APIApplicationCommandInteractionDataMentionableOption | APIApplicationCommandInteractionDataNumberOption - | APIApplicationCommandInteractionDataAttachmentOption; + | APIApplicationCommandInteractionDataRoleOption + | APIApplicationCommandInteractionDataStringOption + | APIApplicationCommandInteractionDataUserOption; /** * https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-interaction-data diff --git a/payloads/v10/_interactions/_applicationCommands/contextMenu.ts b/payloads/v10/_interactions/_applicationCommands/contextMenu.ts index 7305a40b..5f1f6bbc 100644 --- a/payloads/v10/_interactions/_applicationCommands/contextMenu.ts +++ b/payloads/v10/_interactions/_applicationCommands/contextMenu.ts @@ -33,8 +33,8 @@ export interface APIMessageApplicationCommandInteractionDataResolved { * https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-interaction-data */ export type APIContextMenuInteractionData = - | APIUserApplicationCommandInteractionData - | APIMessageApplicationCommandInteractionData; + | APIMessageApplicationCommandInteractionData + | APIUserApplicationCommandInteractionData; /** * https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object @@ -74,18 +74,18 @@ export type APIMessageApplicationCommandGuildInteraction = /** * https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object */ -export type APIContextMenuInteraction = APIUserApplicationCommandInteraction | APIMessageApplicationCommandInteraction; +export type APIContextMenuInteraction = APIMessageApplicationCommandInteraction | APIUserApplicationCommandInteraction; /** * https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object */ export type APIContextMenuDMInteraction = - | APIUserApplicationCommandDMInteraction - | APIMessageApplicationCommandDMInteraction; + | APIMessageApplicationCommandDMInteraction + | APIUserApplicationCommandDMInteraction; /** * https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object */ export type APIContextMenuGuildInteraction = - | APIUserApplicationCommandGuildInteraction - | APIMessageApplicationCommandGuildInteraction; + | APIMessageApplicationCommandGuildInteraction + | APIUserApplicationCommandGuildInteraction; diff --git a/payloads/v10/_interactions/_applicationCommands/permissions.ts b/payloads/v10/_interactions/_applicationCommands/permissions.ts index 5aac8511..7642503b 100644 --- a/payloads/v10/_interactions/_applicationCommands/permissions.ts +++ b/payloads/v10/_interactions/_applicationCommands/permissions.ts @@ -54,6 +54,6 @@ export enum ApplicationCommandPermissionType { */ export const APIApplicationCommandPermissionsConstant = { // eslint-disable-next-line unicorn/prefer-native-coercion-functions - Everyone: (guildId: string | bigint): Snowflake => String(guildId), - AllChannels: (guildId: string | bigint): Snowflake => String(BigInt(guildId) - 1n), + Everyone: (guildId: bigint | string): Snowflake => String(guildId), + AllChannels: (guildId: bigint | string): Snowflake => String(BigInt(guildId) - 1n), }; diff --git a/payloads/v10/_interactions/applicationCommands.ts b/payloads/v10/_interactions/applicationCommands.ts index 283986f8..f72421da 100644 --- a/payloads/v10/_interactions/applicationCommands.ts +++ b/payloads/v10/_interactions/applicationCommands.ts @@ -118,7 +118,7 @@ export type APIApplicationCommandInteractionWrapper, - 'channel' | 'channel_id' | 'data' | 'app_permissions' + 'app_permissions' | 'channel_id' | 'channel' | 'data' > >; diff --git a/payloads/v10/_interactions/base.ts b/payloads/v10/_interactions/base.ts index fde9962c..2fbd2d84 100644 --- a/payloads/v10/_interactions/base.ts +++ b/payloads/v10/_interactions/base.ts @@ -16,15 +16,15 @@ import type { InteractionType } from './responses'; export type PartialAPIMessageInteractionGuildMember = Pick< APIGuildMember, - | 'roles' - | 'premium_since' - | 'pending' - | 'nick' - | 'mute' - | 'joined_at' - | 'deaf' - | 'communication_disabled_until' | 'avatar' + | 'communication_disabled_until' + | 'deaf' + | 'joined_at' + | 'mute' + | 'nick' + | 'pending' + | 'premium_since' + | 'roles' >; /** @@ -139,7 +139,7 @@ export interface APIBaseInteraction { export type APIDMInteractionWrapper> = Omit< Original, - 'member' | 'guild_id' + 'guild_id' | 'member' > & Required>; @@ -147,7 +147,7 @@ export type APIGuildInteractionWrapper & - Required>; + Required>; export interface APIInteractionDataResolvedChannelBase extends Required { type: T; @@ -160,12 +160,12 @@ export interface APIInteractionDataResolvedChannelBase ex export type APIInteractionDataResolvedChannel = | APIInteractionDataResolvedChannelBase> | (APIInteractionDataResolvedChannelBase & - Pick); + Pick); /** * https://discord.com/developers/docs/resources/guild#guild-member-object */ -export interface APIInteractionDataResolvedGuildMember extends Omit { +export interface APIInteractionDataResolvedGuildMember extends Omit { permissions: Permissions; } @@ -188,8 +188,8 @@ export type APIChatInputApplicationCommandInteractionDataResolved = APIInteracti /** * `users` and optional `members` from APIInteractionDataResolved, for user commands and user selects */ -export type APIUserInteractionDataResolved = Required> & - Pick; +export type APIUserInteractionDataResolved = Pick & + Required>; /** * @deprecated Renamed to `APIUserInteractionDataResolved` diff --git a/payloads/v10/_interactions/messageComponents.ts b/payloads/v10/_interactions/messageComponents.ts index d1968ee5..ad4ce9f9 100644 --- a/payloads/v10/_interactions/messageComponents.ts +++ b/payloads/v10/_interactions/messageComponents.ts @@ -15,7 +15,7 @@ export type APIMessageComponentInteraction = APIBaseInteraction< Required< Pick< APIBaseInteraction, - 'channel' | 'channel_id' | 'data' | 'app_permissions' | 'message' + 'app_permissions' | 'channel_id' | 'channel' | 'data' | 'message' > >; @@ -26,7 +26,7 @@ export type APIMessageComponentButtonInteraction = APIBaseInteraction< Required< Pick< APIBaseInteraction, - 'channel' | 'channel_id' | 'data' | 'app_permissions' | 'message' + 'app_permissions' | 'channel_id' | 'channel' | 'data' | 'message' > >; @@ -37,7 +37,7 @@ export type APIMessageComponentSelectMenuInteraction = APIBaseInteraction< Required< Pick< APIBaseInteraction, - 'channel' | 'channel_id' | 'data' | 'app_permissions' | 'message' + 'app_permissions' | 'channel_id' | 'channel' | 'data' | 'message' > >; @@ -76,7 +76,7 @@ export interface APIMessageRoleSelectInteractionData export interface APIMessageMentionableSelectInteractionData extends APIMessageComponentBaseInteractionData { values: Snowflake[]; - resolved: Pick; + resolved: Pick; } export interface APIMessageChannelSelectInteractionData @@ -86,11 +86,11 @@ export interface APIMessageChannelSelectInteractionData } export type APIMessageSelectMenuInteractionData = - | APIMessageStringSelectInteractionData - | APIMessageUserSelectInteractionData - | APIMessageRoleSelectInteractionData + | APIMessageChannelSelectInteractionData | APIMessageMentionableSelectInteractionData - | APIMessageChannelSelectInteractionData; + | APIMessageRoleSelectInteractionData + | APIMessageStringSelectInteractionData + | APIMessageUserSelectInteractionData; export type APIMessageComponentDMInteraction = APIDMInteractionWrapper; diff --git a/payloads/v10/_interactions/responses.ts b/payloads/v10/_interactions/responses.ts index fb34dc14..0f916d51 100644 --- a/payloads/v10/_interactions/responses.ts +++ b/payloads/v10/_interactions/responses.ts @@ -18,12 +18,12 @@ export enum InteractionType { * https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-response-object */ export type APIInteractionResponse = - | APIInteractionResponsePong + | APIApplicationCommandAutocompleteResponse | APIInteractionResponseChannelMessageWithSource | APIInteractionResponseDeferredChannelMessageWithSource | APIInteractionResponseDeferredMessageUpdate + | APIInteractionResponsePong | APIInteractionResponseUpdateMessage - | APIApplicationCommandAutocompleteResponse | APIModalInteractionResponse | APIPremiumRequiredInteractionResponse; @@ -107,7 +107,7 @@ export enum InteractionResponseType { */ export type APIInteractionResponseCallbackData = Omit< RESTPostAPIWebhookWithTokenJSONBody, - 'username' | 'avatar_url' + 'avatar_url' | 'username' > & { flags?: MessageFlags }; export interface APICommandAutocompleteInteractionResponseCallbackData { diff --git a/payloads/v8/_interactions/_applicationCommands/_chatInput/shared.ts b/payloads/v8/_interactions/_applicationCommands/_chatInput/shared.ts index 57c42cfd..6f3fff39 100644 --- a/payloads/v8/_interactions/_applicationCommands/_chatInput/shared.ts +++ b/payloads/v8/_interactions/_applicationCommands/_chatInput/shared.ts @@ -22,7 +22,7 @@ export enum ApplicationCommandOptionType { * * @deprecated API and gateway v8 are deprecated and the types will not receive further updates, please update to v10. */ -export interface APIApplicationCommandOptionChoice { +export interface APIApplicationCommandOptionChoice { name: string; value: ValueType; } diff --git a/payloads/v8/_interactions/_applicationCommands/chatInput.ts b/payloads/v8/_interactions/_applicationCommands/chatInput.ts index 44a9c7c6..e1d35e5d 100644 --- a/payloads/v8/_interactions/_applicationCommands/chatInput.ts +++ b/payloads/v8/_interactions/_applicationCommands/chatInput.ts @@ -72,15 +72,15 @@ export * from './_chatInput/user'; * @deprecated API and gateway v8 are deprecated and the types will not receive further updates, please update to v10. */ export type APIApplicationCommandBasicOption = - | APIApplicationCommandStringOption - | APIApplicationCommandIntegerOption + | APIApplicationCommandAttachmentOption | APIApplicationCommandBooleanOption - | APIApplicationCommandUserOption | APIApplicationCommandChannelOption - | APIApplicationCommandRoleOption + | APIApplicationCommandIntegerOption | APIApplicationCommandMentionableOption | APIApplicationCommandNumberOption - | APIApplicationCommandAttachmentOption; + | APIApplicationCommandRoleOption + | APIApplicationCommandStringOption + | APIApplicationCommandUserOption; /** * https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-option-structure @@ -88,9 +88,9 @@ export type APIApplicationCommandBasicOption = * @deprecated API and gateway v8 are deprecated and the types will not receive further updates, please update to v10. */ export type APIApplicationCommandOption = - | APIApplicationCommandSubcommandOption + | APIApplicationCommandBasicOption | APIApplicationCommandSubcommandGroupOption - | APIApplicationCommandBasicOption; + | APIApplicationCommandSubcommandOption; /** * https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-interaction-data-option-structure @@ -98,23 +98,23 @@ export type APIApplicationCommandOption = * @deprecated API and gateway v8 are deprecated and the types will not receive further updates, please update to v10. */ export type APIApplicationCommandInteractionDataOption = - | APIApplicationCommandInteractionDataSubcommandOption + | APIApplicationCommandInteractionDataBasicOption | APIApplicationCommandInteractionDataSubcommandGroupOption - | APIApplicationCommandInteractionDataBasicOption; + | APIApplicationCommandInteractionDataSubcommandOption; /** * @deprecated API and gateway v8 are deprecated and the types will not receive further updates, please update to v10. */ export type APIApplicationCommandInteractionDataBasicOption = - | APIApplicationCommandInteractionDataStringOption - | APIApplicationCommandInteractionDataIntegerOption + | APIApplicationCommandInteractionDataAttachmentOption | APIApplicationCommandInteractionDataBooleanOption - | APIApplicationCommandInteractionDataUserOption | APIApplicationCommandInteractionDataChannelOption - | APIApplicationCommandInteractionDataRoleOption + | APIApplicationCommandInteractionDataIntegerOption | APIApplicationCommandInteractionDataMentionableOption | APIApplicationCommandInteractionDataNumberOption - | APIApplicationCommandInteractionDataAttachmentOption; + | APIApplicationCommandInteractionDataRoleOption + | APIApplicationCommandInteractionDataStringOption + | APIApplicationCommandInteractionDataUserOption; /** * https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-interaction-data-structure diff --git a/payloads/v8/_interactions/_applicationCommands/contextMenu.ts b/payloads/v8/_interactions/_applicationCommands/contextMenu.ts index c9f7092a..145c3fc6 100644 --- a/payloads/v8/_interactions/_applicationCommands/contextMenu.ts +++ b/payloads/v8/_interactions/_applicationCommands/contextMenu.ts @@ -56,8 +56,8 @@ export interface APIMessageApplicationCommandInteractionDataResolved { * @deprecated API and gateway v8 are deprecated and the types will not receive further updates, please update to v10. */ export type APIContextMenuInteractionData = - | APIUserApplicationCommandInteractionData - | APIMessageApplicationCommandInteractionData; + | APIMessageApplicationCommandInteractionData + | APIUserApplicationCommandInteractionData; /** * https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object @@ -111,7 +111,7 @@ export type APIMessageApplicationCommandGuildInteraction = * * @deprecated API and gateway v8 are deprecated and the types will not receive further updates, please update to v10. */ -export type APIContextMenuInteraction = APIUserApplicationCommandInteraction | APIMessageApplicationCommandInteraction; +export type APIContextMenuInteraction = APIMessageApplicationCommandInteraction | APIUserApplicationCommandInteraction; /** * https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object @@ -119,8 +119,8 @@ export type APIContextMenuInteraction = APIUserApplicationCommandInteraction | A * @deprecated API and gateway v8 are deprecated and the types will not receive further updates, please update to v10. */ export type APIContextMenuDMInteraction = - | APIUserApplicationCommandDMInteraction - | APIMessageApplicationCommandDMInteraction; + | APIMessageApplicationCommandDMInteraction + | APIUserApplicationCommandDMInteraction; /** * https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object @@ -128,5 +128,5 @@ export type APIContextMenuDMInteraction = * @deprecated API and gateway v8 are deprecated and the types will not receive further updates, please update to v10. */ export type APIContextMenuGuildInteraction = - | APIUserApplicationCommandGuildInteraction - | APIMessageApplicationCommandGuildInteraction; + | APIMessageApplicationCommandGuildInteraction + | APIUserApplicationCommandGuildInteraction; diff --git a/payloads/v8/_interactions/applicationCommands.ts b/payloads/v8/_interactions/applicationCommands.ts index 129220d4..c8e75138 100644 --- a/payloads/v8/_interactions/applicationCommands.ts +++ b/payloads/v8/_interactions/applicationCommands.ts @@ -101,7 +101,7 @@ export interface APIInteractionDataResolvedChannel extends Required { +export interface APIInteractionDataResolvedGuildMember extends Omit { permissions: Permissions; } diff --git a/payloads/v8/_interactions/base.ts b/payloads/v8/_interactions/base.ts index f95b7f5e..ee917443 100644 --- a/payloads/v8/_interactions/base.ts +++ b/payloads/v8/_interactions/base.ts @@ -10,15 +10,15 @@ import type { InteractionType } from './responses'; */ export type PartialAPIMessageInteractionGuildMember = Pick< APIGuildMember, - | 'roles' - | 'premium_since' - | 'pending' - | 'nick' - | 'mute' - | 'joined_at' - | 'deaf' - | 'communication_disabled_until' | 'avatar' + | 'communication_disabled_until' + | 'deaf' + | 'joined_at' + | 'mute' + | 'nick' + | 'pending' + | 'premium_since' + | 'roles' >; /** @@ -128,7 +128,7 @@ export interface APIBaseInteraction { */ export type APIDMInteractionWrapper> = Omit< Original, - 'member' | 'guild_id' + 'guild_id' | 'member' > & Required>; @@ -139,4 +139,4 @@ export type APIGuildInteractionWrapper & - Required>; + Required>; diff --git a/payloads/v8/_interactions/responses.ts b/payloads/v8/_interactions/responses.ts index fee5d0c3..68eec8be 100644 --- a/payloads/v8/_interactions/responses.ts +++ b/payloads/v8/_interactions/responses.ts @@ -22,12 +22,12 @@ export enum InteractionType { * @deprecated API and gateway v8 are deprecated and the types will not receive further updates, please update to v10. */ export type APIInteractionResponse = - | APIInteractionResponsePong + | APIApplicationCommandAutocompleteResponse | APIInteractionResponseChannelMessageWithSource | APIInteractionResponseDeferredChannelMessageWithSource | APIInteractionResponseDeferredMessageUpdate + | APIInteractionResponsePong | APIInteractionResponseUpdateMessage - | APIApplicationCommandAutocompleteResponse | APIModalInteractionResponse; /** @@ -127,7 +127,7 @@ export enum InteractionResponseType { */ export type APIInteractionResponseCallbackData = Omit< RESTPostAPIWebhookWithTokenJSONBody, - 'username' | 'avatar_url' + 'avatar_url' | 'username' > & { flags?: MessageFlags }; /** diff --git a/payloads/v9/_interactions/_applicationCommands/_chatInput/shared.ts b/payloads/v9/_interactions/_applicationCommands/_chatInput/shared.ts index 506ff407..e9048e2a 100644 --- a/payloads/v9/_interactions/_applicationCommands/_chatInput/shared.ts +++ b/payloads/v9/_interactions/_applicationCommands/_chatInput/shared.ts @@ -20,7 +20,7 @@ export enum ApplicationCommandOptionType { /** * https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-option-choice-structure */ -export interface APIApplicationCommandOptionChoice { +export interface APIApplicationCommandOptionChoice { name: string; name_localizations?: LocalizationMap | null; value: ValueType; diff --git a/payloads/v9/_interactions/_applicationCommands/chatInput.ts b/payloads/v9/_interactions/_applicationCommands/chatInput.ts index 7f1f1eea..f1ae3148 100644 --- a/payloads/v9/_interactions/_applicationCommands/chatInput.ts +++ b/payloads/v9/_interactions/_applicationCommands/chatInput.ts @@ -65,42 +65,42 @@ export * from './_chatInput/user'; * https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-option-structure */ export type APIApplicationCommandBasicOption = - | APIApplicationCommandStringOption - | APIApplicationCommandIntegerOption + | APIApplicationCommandAttachmentOption | APIApplicationCommandBooleanOption - | APIApplicationCommandUserOption | APIApplicationCommandChannelOption - | APIApplicationCommandRoleOption + | APIApplicationCommandIntegerOption | APIApplicationCommandMentionableOption | APIApplicationCommandNumberOption - | APIApplicationCommandAttachmentOption; + | APIApplicationCommandRoleOption + | APIApplicationCommandStringOption + | APIApplicationCommandUserOption; /** * https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-option-structure */ export type APIApplicationCommandOption = - | APIApplicationCommandSubcommandOption + | APIApplicationCommandBasicOption | APIApplicationCommandSubcommandGroupOption - | APIApplicationCommandBasicOption; + | APIApplicationCommandSubcommandOption; /** * https://discord.com/developers/docs/interactions/application-commands#application-command-object-application-command-interaction-data-option-structure */ export type APIApplicationCommandInteractionDataOption = - | APIApplicationCommandInteractionDataSubcommandOption + | APIApplicationCommandInteractionDataBasicOption | APIApplicationCommandInteractionDataSubcommandGroupOption - | APIApplicationCommandInteractionDataBasicOption; + | APIApplicationCommandInteractionDataSubcommandOption; export type APIApplicationCommandInteractionDataBasicOption = - | APIApplicationCommandInteractionDataStringOption - | APIApplicationCommandInteractionDataIntegerOption + | APIApplicationCommandInteractionDataAttachmentOption | APIApplicationCommandInteractionDataBooleanOption - | APIApplicationCommandInteractionDataUserOption | APIApplicationCommandInteractionDataChannelOption - | APIApplicationCommandInteractionDataRoleOption + | APIApplicationCommandInteractionDataIntegerOption | APIApplicationCommandInteractionDataMentionableOption | APIApplicationCommandInteractionDataNumberOption - | APIApplicationCommandInteractionDataAttachmentOption; + | APIApplicationCommandInteractionDataRoleOption + | APIApplicationCommandInteractionDataStringOption + | APIApplicationCommandInteractionDataUserOption; /** * https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-interaction-data diff --git a/payloads/v9/_interactions/_applicationCommands/contextMenu.ts b/payloads/v9/_interactions/_applicationCommands/contextMenu.ts index 7305a40b..5f1f6bbc 100644 --- a/payloads/v9/_interactions/_applicationCommands/contextMenu.ts +++ b/payloads/v9/_interactions/_applicationCommands/contextMenu.ts @@ -33,8 +33,8 @@ export interface APIMessageApplicationCommandInteractionDataResolved { * https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object-interaction-data */ export type APIContextMenuInteractionData = - | APIUserApplicationCommandInteractionData - | APIMessageApplicationCommandInteractionData; + | APIMessageApplicationCommandInteractionData + | APIUserApplicationCommandInteractionData; /** * https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object @@ -74,18 +74,18 @@ export type APIMessageApplicationCommandGuildInteraction = /** * https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object */ -export type APIContextMenuInteraction = APIUserApplicationCommandInteraction | APIMessageApplicationCommandInteraction; +export type APIContextMenuInteraction = APIMessageApplicationCommandInteraction | APIUserApplicationCommandInteraction; /** * https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object */ export type APIContextMenuDMInteraction = - | APIUserApplicationCommandDMInteraction - | APIMessageApplicationCommandDMInteraction; + | APIMessageApplicationCommandDMInteraction + | APIUserApplicationCommandDMInteraction; /** * https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-object */ export type APIContextMenuGuildInteraction = - | APIUserApplicationCommandGuildInteraction - | APIMessageApplicationCommandGuildInteraction; + | APIMessageApplicationCommandGuildInteraction + | APIUserApplicationCommandGuildInteraction; diff --git a/payloads/v9/_interactions/_applicationCommands/permissions.ts b/payloads/v9/_interactions/_applicationCommands/permissions.ts index 5aac8511..7642503b 100644 --- a/payloads/v9/_interactions/_applicationCommands/permissions.ts +++ b/payloads/v9/_interactions/_applicationCommands/permissions.ts @@ -54,6 +54,6 @@ export enum ApplicationCommandPermissionType { */ export const APIApplicationCommandPermissionsConstant = { // eslint-disable-next-line unicorn/prefer-native-coercion-functions - Everyone: (guildId: string | bigint): Snowflake => String(guildId), - AllChannels: (guildId: string | bigint): Snowflake => String(BigInt(guildId) - 1n), + Everyone: (guildId: bigint | string): Snowflake => String(guildId), + AllChannels: (guildId: bigint | string): Snowflake => String(BigInt(guildId) - 1n), }; diff --git a/payloads/v9/_interactions/applicationCommands.ts b/payloads/v9/_interactions/applicationCommands.ts index 86fdccaf..2ade8d3c 100644 --- a/payloads/v9/_interactions/applicationCommands.ts +++ b/payloads/v9/_interactions/applicationCommands.ts @@ -118,7 +118,7 @@ export type APIApplicationCommandInteractionWrapper, - 'channel' | 'channel_id' | 'data' | 'app_permissions' + 'app_permissions' | 'channel_id' | 'channel' | 'data' > >; diff --git a/payloads/v9/_interactions/base.ts b/payloads/v9/_interactions/base.ts index 1f96b564..230033cb 100644 --- a/payloads/v9/_interactions/base.ts +++ b/payloads/v9/_interactions/base.ts @@ -16,15 +16,15 @@ import type { InteractionType } from './responses'; export type PartialAPIMessageInteractionGuildMember = Pick< APIGuildMember, - | 'roles' - | 'premium_since' - | 'pending' - | 'nick' - | 'mute' - | 'joined_at' - | 'deaf' - | 'communication_disabled_until' | 'avatar' + | 'communication_disabled_until' + | 'deaf' + | 'joined_at' + | 'mute' + | 'nick' + | 'pending' + | 'premium_since' + | 'roles' >; /** @@ -139,7 +139,7 @@ export interface APIBaseInteraction { export type APIDMInteractionWrapper> = Omit< Original, - 'member' | 'guild_id' + 'guild_id' | 'member' > & Required>; @@ -147,7 +147,7 @@ export type APIGuildInteractionWrapper & - Required>; + Required>; export interface APIInteractionDataResolvedChannelBase extends Required { type: T; @@ -160,12 +160,12 @@ export interface APIInteractionDataResolvedChannelBase ex export type APIInteractionDataResolvedChannel = | APIInteractionDataResolvedChannelBase> | (APIInteractionDataResolvedChannelBase & - Pick); + Pick); /** * https://discord.com/developers/docs/resources/guild#guild-member-object */ -export interface APIInteractionDataResolvedGuildMember extends Omit { +export interface APIInteractionDataResolvedGuildMember extends Omit { permissions: Permissions; } @@ -188,8 +188,8 @@ export type APIChatInputApplicationCommandInteractionDataResolved = APIInteracti /** * `users` and optional `members` from APIInteractionDataResolved, for user commands and user selects */ -export type APIUserInteractionDataResolved = Required> & - Pick; +export type APIUserInteractionDataResolved = Pick & + Required>; /** * @deprecated Renamed to `APIUserInteractionDataResolved` diff --git a/payloads/v9/_interactions/messageComponents.ts b/payloads/v9/_interactions/messageComponents.ts index d1968ee5..ad4ce9f9 100644 --- a/payloads/v9/_interactions/messageComponents.ts +++ b/payloads/v9/_interactions/messageComponents.ts @@ -15,7 +15,7 @@ export type APIMessageComponentInteraction = APIBaseInteraction< Required< Pick< APIBaseInteraction, - 'channel' | 'channel_id' | 'data' | 'app_permissions' | 'message' + 'app_permissions' | 'channel_id' | 'channel' | 'data' | 'message' > >; @@ -26,7 +26,7 @@ export type APIMessageComponentButtonInteraction = APIBaseInteraction< Required< Pick< APIBaseInteraction, - 'channel' | 'channel_id' | 'data' | 'app_permissions' | 'message' + 'app_permissions' | 'channel_id' | 'channel' | 'data' | 'message' > >; @@ -37,7 +37,7 @@ export type APIMessageComponentSelectMenuInteraction = APIBaseInteraction< Required< Pick< APIBaseInteraction, - 'channel' | 'channel_id' | 'data' | 'app_permissions' | 'message' + 'app_permissions' | 'channel_id' | 'channel' | 'data' | 'message' > >; @@ -76,7 +76,7 @@ export interface APIMessageRoleSelectInteractionData export interface APIMessageMentionableSelectInteractionData extends APIMessageComponentBaseInteractionData { values: Snowflake[]; - resolved: Pick; + resolved: Pick; } export interface APIMessageChannelSelectInteractionData @@ -86,11 +86,11 @@ export interface APIMessageChannelSelectInteractionData } export type APIMessageSelectMenuInteractionData = - | APIMessageStringSelectInteractionData - | APIMessageUserSelectInteractionData - | APIMessageRoleSelectInteractionData + | APIMessageChannelSelectInteractionData | APIMessageMentionableSelectInteractionData - | APIMessageChannelSelectInteractionData; + | APIMessageRoleSelectInteractionData + | APIMessageStringSelectInteractionData + | APIMessageUserSelectInteractionData; export type APIMessageComponentDMInteraction = APIDMInteractionWrapper; diff --git a/payloads/v9/_interactions/responses.ts b/payloads/v9/_interactions/responses.ts index 65fe01d4..b70fd69b 100644 --- a/payloads/v9/_interactions/responses.ts +++ b/payloads/v9/_interactions/responses.ts @@ -18,12 +18,12 @@ export enum InteractionType { * https://discord.com/developers/docs/interactions/receiving-and-responding#interaction-response-object */ export type APIInteractionResponse = - | APIInteractionResponsePong + | APIApplicationCommandAutocompleteResponse | APIInteractionResponseChannelMessageWithSource | APIInteractionResponseDeferredChannelMessageWithSource | APIInteractionResponseDeferredMessageUpdate + | APIInteractionResponsePong | APIInteractionResponseUpdateMessage - | APIApplicationCommandAutocompleteResponse | APIModalInteractionResponse | APIPremiumRequiredInteractionResponse; @@ -107,7 +107,7 @@ export enum InteractionResponseType { */ export type APIInteractionResponseCallbackData = Omit< RESTPostAPIWebhookWithTokenJSONBody, - 'username' | 'avatar_url' + 'avatar_url' | 'username' > & { flags?: MessageFlags }; export interface APICommandAutocompleteInteractionResponseCallbackData { diff --git a/scripts/actions/create-pr.mjs b/scripts/actions/create-pr.mjs index 9df9f765..53dbfc41 100644 --- a/scripts/actions/create-pr.mjs +++ b/scripts/actions/create-pr.mjs @@ -1,7 +1,7 @@ /* eslint-disable @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-assignment, @typescript-eslint/restrict-template-expressions */ import { readFile } from 'node:fs/promises'; -import process from "node:process"; -import { URL } from "node:url"; +import process from 'node:process'; +import { URL } from 'node:url'; import { Octokit } from '@octokit/action'; const packageJson = JSON.parse(await readFile(new URL('../../package.json', import.meta.url), { encoding: 'utf8' })); diff --git a/scripts/actions/create-release.mjs b/scripts/actions/create-release.mjs index 57cf24f9..13c251c5 100644 --- a/scripts/actions/create-release.mjs +++ b/scripts/actions/create-release.mjs @@ -1,7 +1,7 @@ /* eslint-disable @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-assignment, @typescript-eslint/restrict-template-expressions */ import { readFile } from 'node:fs/promises'; -import process from "node:process"; -import { URL } from "node:url"; +import process from 'node:process'; +import { URL } from 'node:url'; import { Octokit } from '@octokit/action'; const packageJson = JSON.parse(await readFile(new URL('../../package.json', import.meta.url), { encoding: 'utf8' })); diff --git a/scripts/actions/report-deno-not-ran.mjs b/scripts/actions/report-deno-not-ran.mjs index 1c8d52b4..16bca2c5 100644 --- a/scripts/actions/report-deno-not-ran.mjs +++ b/scripts/actions/report-deno-not-ran.mjs @@ -1,7 +1,7 @@ /* eslint-disable @typescript-eslint/restrict-template-expressions */ import { execSync } from 'node:child_process'; import { readFile } from 'node:fs/promises'; -import process from "node:process"; +import process from 'node:process'; import { Octokit } from '@octokit/action'; const octokit = new Octokit(); @@ -62,8 +62,10 @@ const messageBody = [ for (const file of diff) { messageBody.push( - `- [Node: \`${file.slice(5)}\`](https://github.com/${process.env.GITHUB_REPOSITORY}/blob/${process.env.GITHUB_SHA - }/${file.slice(5)}) - [Deno: \`${file}\`](https://github.com/${process.env.GITHUB_REPOSITORY}/blob/${process.env.GITHUB_SHA + `- [Node: \`${file.slice(5)}\`](https://github.com/${process.env.GITHUB_REPOSITORY}/blob/${ + process.env.GITHUB_SHA + }/${file.slice(5)}) - [Deno: \`${file}\`](https://github.com/${process.env.GITHUB_REPOSITORY}/blob/${ + process.env.GITHUB_SHA }/${file})`, ); } diff --git a/scripts/bump-version.mjs b/scripts/bump-version.mjs index 4aef9a15..ed51b2d2 100644 --- a/scripts/bump-version.mjs +++ b/scripts/bump-version.mjs @@ -1,5 +1,6 @@ /* eslint-disable @typescript-eslint/restrict-template-expressions, @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access */ import { execSync } from 'node:child_process'; +import process from 'node:process'; import { promisify } from 'node:util'; import { Octokit } from '@octokit/action'; import conventionalRecommendedBump from 'conventional-recommended-bump'; @@ -17,10 +18,9 @@ const conventionalReleaseTypesTo0Ver = new Map([ ['patch', 'patch'], ]); -/** @type {(options: import('conventional-recommended-bump').Options) => Promise} */ const asyncConventionalRecommendBump = promisify(conventionalRecommendedBump); -const result = await asyncConventionalRecommendBump({ preset: 'angular' }); +const result = await asyncConventionalRecommendBump({ preset: 'angular' }, undefined); if (!result.releaseType) { throw new Error('No recommended bump level found'); diff --git a/scripts/bump-website-version.mjs b/scripts/bump-website-version.mjs index 9e221906..f3b513ca 100644 --- a/scripts/bump-website-version.mjs +++ b/scripts/bump-website-version.mjs @@ -1,6 +1,7 @@ /* eslint-disable @typescript-eslint/restrict-template-expressions, @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access */ import { execSync } from 'node:child_process'; import { readFile, rm, writeFile } from 'node:fs/promises'; +import { URL } from 'node:url'; const cwd = new URL('../website/', import.meta.url); const json = JSON.parse(await readFile(new URL('../package.json', import.meta.url), { encoding: 'utf8' })); diff --git a/scripts/deno.mjs b/scripts/deno.mjs index 6ea16f6a..f8aaf7f8 100644 --- a/scripts/deno.mjs +++ b/scripts/deno.mjs @@ -1,5 +1,6 @@ /* eslint-disable @typescript-eslint/restrict-template-expressions */ import { copyFile, mkdir, opendir, readFile, rm, writeFile } from 'node:fs/promises'; +import { URL } from 'node:url'; const baseDirectory = new URL('../', import.meta.url); const denoPath = new URL('deno/', baseDirectory); @@ -16,16 +17,18 @@ await mkdir(denoPath); * @param {string} source The raw source */ function convertImports(source) { - return source.replace( + return source.replaceAll( /from '(.*)'/g, /** + * @param _ Something * @param {string} importPath The path to import from */ (_, importPath) => { - if (importPath === '..' || importPath === '../') importPath = '../mod.ts'; - if (importPath.includes('index')) importPath = importPath.replace('index', 'mod'); - if (!importPath.endsWith('.ts')) importPath += '.ts'; + let actualImportPath = importPath; + if (importPath === '..' || importPath === '../') actualImportPath = '../mod.ts'; + if (importPath.includes('index')) actualImportPath = importPath.replace('index', 'mod'); + if (!importPath.endsWith('.ts')) actualImportPath += '.ts'; - return `from '${importPath}'`; + return `from '${actualImportPath}'`; }, ); } diff --git a/scripts/versions.mjs b/scripts/versions.mjs index 928c2490..b75bd497 100644 --- a/scripts/versions.mjs +++ b/scripts/versions.mjs @@ -24,23 +24,21 @@ await Promise.allSettled( // Voice 'v4', - ] - .map((version) => [ - fileToESMWrapperCall('gateway', version), - fileToESMWrapperCall(`payloads/${version}`, 'index'), - fileToESMWrapperCall(`rest/${version}`, 'index'), + ].flatMap((version) => [ + fileToESMWrapperCall('gateway', version), + fileToESMWrapperCall(`payloads/${version}`, 'index'), + fileToESMWrapperCall(`rest/${version}`, 'index'), - // Voice - fileToESMWrapperCall('voice', version), + // Voice + fileToESMWrapperCall('voice', version), - // RPC - fileToESMWrapperCall('rpc', version), + // RPC + fileToESMWrapperCall('rpc', version), - // Utils - fileToESMWrapperCall('utils', version), + // Utils + fileToESMWrapperCall('utils', version), - // Shortcuts - fileToESMWrapperCall('', version), - ]) - .flat(), + // Shortcuts + fileToESMWrapperCall('', version), + ]), );