diff --git a/README.md b/README.md index 649d63d..427f1a5 100644 --- a/README.md +++ b/README.md @@ -168,7 +168,7 @@ including the invoking `user`, server (`guild_id`) and continuation `token`. ```tsx import { CommandHandler, createElement, createHandler, useDescription, useNumber } from "slshx"; -import type { APIChatInputApplicationCommandInteraction } from "discord-api-types/v9"; +import type { APIChatInputApplicationCommandInteraction } from "discord-api-types/v10"; type Env = { KV_NAMESPACE: KVNamespace; SECRET: string }; @@ -221,7 +221,7 @@ Some types have additional optional fields that control acceptable values. ```tsx import { ChannelType } from "slshx"; -import type { APIUser, APIInteractionDataResolvedChannel, APIRole, APIAttachment } from "discord-api-types/v9"; +import type { APIUser, APIInteractionDataResolvedChannel, APIRole, APIAttachment } from "discord-api-types/v10"; function cmd(): CommandHandler { useDescription("Command demonstrating option types"); @@ -309,7 +309,7 @@ suggestions. Similarly to choices, you can optionally provide a `name` for the suggestion, which will be displayed instead. ```tsx -import type { APIApplicationCommandAutocompleteInteraction } from "discord-api-types/payloads/v9/_interactions/autocomplete"; // 🙁 +import type { APIApplicationCommandAutocompleteInteraction } from "discord-api-types/payloads/v10/_interactions/autocomplete"; // 🙁 type Env = { SONG_NAMESPACE: KVNamespace }; @@ -418,7 +418,7 @@ responses. ```tsx import { Message, UserCommandHandler, createElement, createHandler } from "slshx"; -import type { APIUser, APIUserApplicationCommandInteraction } from "discord-api-types/v9"; +import type { APIUser, APIUserApplicationCommandInteraction } from "discord-api-types/v10"; function greet(): UserCommandHandler { return (interaction, env, ctx, user) => { @@ -451,7 +451,7 @@ the command was invoked on. ```tsx import { Message, MessageCommand, createElement, createHandler } from "slshx"; -import type { APIMessage, APIMessageApplicationCommandInteraction } from "discord-api-types/v9"; +import type { APIMessage, APIMessageApplicationCommandInteraction } from "discord-api-types/v10"; type Env = { BOOKMARKS_NAMESPACE: KVNamespace }; @@ -808,7 +808,7 @@ to a component interaction: ```tsx import { CommandHandler, useButton, APIMessageComponentInteraction } from "slshx"; - import type { APIMessageButtonInteractionData } from "discord-api-types/v9"; + import type { APIMessageButtonInteractionData } from "discord-api-types/v10"; function cmd(): CommandHandler { const buttonId = useButton((interaction, env, ctx) => { @@ -1081,7 +1081,7 @@ the `default` option. ```tsx import { ComponentType, createElement, Message, Select, Option, $update, useSelectMenu, CommandHandler, APIMessageComponentInteraction } from "slshx"; -import type { APIMessageSelectMenuInteractionData } from "discord-api-types/v9"; +import type { APIMessageSelectMenuInteractionData } from "discord-api-types/v10"; function selects(): CommandHandler { // ... @@ -1385,7 +1385,7 @@ If an API does not have Slshx bindings, you can use the `call(method, path, body?, auth?)` function: - `method` must be a standard HTTP method -- `path` will be appended to `https://discord.com/api/v9` to form the endpoint +- `path` will be appended to `https://discord.com/api/v10` to form the endpoint URL - `body` can be an instance of `FormData` (sent as `multipart/form-data`), `URLSearchParams` (sent as `application/x-www-form-urlencoded`), or an diff --git a/package-lock.json b/package-lock.json index d6274da..43b0a7a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,15 +1,15 @@ { "name": "slshx", - "version": "0.2.0", + "version": "0.3.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "slshx", - "version": "0.2.0", + "version": "0.3.0", "license": "MIT", "dependencies": { - "discord-api-types": "^0.27.0" + "discord-api-types": "^0.37.5" }, "devDependencies": { "@ava/typescript": "^3.0.1", @@ -1543,12 +1543,10 @@ } }, "node_modules/discord-api-types": { - "version": "0.27.0", - "resolved": "https://registry.npmjs.org/discord-api-types/-/discord-api-types-0.27.0.tgz", - "integrity": "sha512-l7AnQKffohJTembJRN4Bz54R/esSn+WmulWE7bDIHVcuCLdsUhlvt+4tns8ox+wsEPVlT+gEEko2BF5AL8/zjw==", - "engines": { - "node": ">=12" - } + "version": "0.37.5", + "resolved": "https://roxi.cloudflare.community/discord-api-types/-/discord-api-types-0.37.5.tgz", + "integrity": "sha512-RhzoX02jw2M+n/AU5K74KTM4J8Sn3ZImUJvoA4lh+SDcrqi1ddSjrafciF4bECj4rPc2vHwoyyTNgbUwE8vbpA==", + "license": "MIT" }, "node_modules/doctrine": { "version": "3.0.0", @@ -6030,9 +6028,9 @@ } }, "discord-api-types": { - "version": "0.27.0", - "resolved": "https://registry.npmjs.org/discord-api-types/-/discord-api-types-0.27.0.tgz", - "integrity": "sha512-l7AnQKffohJTembJRN4Bz54R/esSn+WmulWE7bDIHVcuCLdsUhlvt+4tns8ox+wsEPVlT+gEEko2BF5AL8/zjw==" + "version": "0.37.5", + "resolved": "https://roxi.cloudflare.community/discord-api-types/-/discord-api-types-0.37.5.tgz", + "integrity": "sha512-RhzoX02jw2M+n/AU5K74KTM4J8Sn3ZImUJvoA4lh+SDcrqi1ddSjrafciF4bECj4rPc2vHwoyyTNgbUwE8vbpA==" }, "doctrine": { "version": "3.0.0", diff --git a/package.json b/package.json index 71c9d98..6ca2301 100644 --- a/package.json +++ b/package.json @@ -54,6 +54,9 @@ "typescript": "^4.5.4" }, "dependencies": { - "discord-api-types": "^0.27.0" + "discord-api-types": "^0.37.5" + }, + "volta": { + "node": "17.9.1" } } diff --git a/src/api/commands.ts b/src/api/commands.ts index 9ee9e55..49e7dcb 100644 --- a/src/api/commands.ts +++ b/src/api/commands.ts @@ -16,7 +16,7 @@ import type { RESTPutAPIApplicationGuildCommandsJSONBody, RESTPutAPIApplicationGuildCommandsResult, Snowflake, -} from "discord-api-types/v9"; +} from "discord-api-types/v10"; import { APIBearerAuth, call } from "./helpers"; /** @see https://discord.com/developers/docs/interactions/application-commands#get-global-application-commands */ diff --git a/src/api/helpers.ts b/src/api/helpers.ts index 0c34a3c..b83cef0 100644 --- a/src/api/helpers.ts +++ b/src/api/helpers.ts @@ -1,7 +1,7 @@ import type { RESTPostOAuth2ClientCredentialsResult, Snowflake, -} from "discord-api-types/v9"; +} from "discord-api-types/v10"; import { log } from "../helpers"; export interface APIBasicAuth { @@ -40,7 +40,7 @@ export async function call( body?: Body, auth?: APIAuth ): Promise { - const url = `https://discord.com/api/v9${path}`; + const url = `https://discord.com/api/v10${path}`; const headers: HeadersInit = {}; const init: RequestInit = { method, headers }; diff --git a/src/api/interactions.ts b/src/api/interactions.ts index fdb66ab..c3992cd 100644 --- a/src/api/interactions.ts +++ b/src/api/interactions.ts @@ -7,7 +7,7 @@ import type { RESTPostAPIInteractionFollowupJSONBody, RESTPostAPIInteractionFollowupResult, Snowflake, -} from "discord-api-types/v9"; +} from "discord-api-types/v10"; import { WithFileAttachments, extractAttachments, diff --git a/src/api/permissions.ts b/src/api/permissions.ts index 2e04d04..f6eb031 100644 --- a/src/api/permissions.ts +++ b/src/api/permissions.ts @@ -4,7 +4,7 @@ import type { RESTPutAPIApplicationCommandPermissionsJSONBody, RESTPutAPIApplicationCommandPermissionsResult, Snowflake, -} from "discord-api-types/v9"; +} from "discord-api-types/v10"; import { APIBearerAuth, call } from "./helpers"; /** @see https://discord.com/developers/docs/interactions/application-commands#get-guild-application-command-permissions */ diff --git a/src/commands/handlers.ts b/src/commands/handlers.ts index e216580..64ddfd1 100644 --- a/src/commands/handlers.ts +++ b/src/commands/handlers.ts @@ -1,7 +1,7 @@ import type { APIApplicationCommandInteractionDataBasicOption, APIChatInputApplicationCommandInteractionDataResolved, -} from "discord-api-types/v9"; +} from "discord-api-types/v10"; import { AutocompleteHandler } from "./hooks"; import { STATE } from "./state"; import { diff --git a/src/commands/hooks.ts b/src/commands/hooks.ts index 1ee3b1d..beec5eb 100644 --- a/src/commands/hooks.ts +++ b/src/commands/hooks.ts @@ -1,4 +1,4 @@ -import type { APIApplicationCommandAutocompleteInteraction } from "discord-api-types/payloads/v9/_interactions/autocomplete"; +import type { APIApplicationCommandAutocompleteInteraction } from "discord-api-types/payloads/v10/_interactions/autocomplete"; import type { APIApplicationCommandOptionChoice, APIAttachment, @@ -8,7 +8,7 @@ import type { APIRole, APIUser, ChannelType, -} from "discord-api-types/v9"; +} from "discord-api-types/v10"; import { ApplicationCommandOptionType } from "../api"; import { Awaitable, ValueOf } from "../helpers"; import { STATE } from "./state"; diff --git a/src/commands/recorders.ts b/src/commands/recorders.ts index 6a3ba2a..a2c5a6f 100644 --- a/src/commands/recorders.ts +++ b/src/commands/recorders.ts @@ -4,7 +4,7 @@ import type { RESTPostAPIApplicationCommandsJSONBody, RESTPostAPIChatInputApplicationCommandsJSONBody, RESTPostAPIContextMenuApplicationCommandsJSONBody, -} from "discord-api-types/v9"; +} from "discord-api-types/v10"; import { ApplicationCommandOptionType, ApplicationCommandType } from "../api"; import { PREFIX } from "../helpers"; import { Options } from "../options"; diff --git a/src/commands/state.ts b/src/commands/state.ts index 776e538..5071e3d 100644 --- a/src/commands/state.ts +++ b/src/commands/state.ts @@ -2,7 +2,7 @@ import type { APIApplicationCommandInteractionDataBasicOption, APIApplicationCommandOption, APIChatInputApplicationCommandInteractionDataResolved, -} from "discord-api-types/v9"; +} from "discord-api-types/v10"; import { AutocompleteHandler } from "./hooks"; import { ComponentHandler, ModalHandler } from "./types"; diff --git a/src/commands/types.ts b/src/commands/types.ts index 35accbf..62749aa 100644 --- a/src/commands/types.ts +++ b/src/commands/types.ts @@ -9,7 +9,7 @@ import type { APIModalSubmitInteraction, APIUser, APIUserApplicationCommandInteraction, -} from "discord-api-types/v9"; +} from "discord-api-types/v10"; import { InteractionType } from "../api"; import { Awaitable, AwaitableGenerator, WithFileAttachments } from "../helpers"; diff --git a/src/helpers.ts b/src/helpers.ts index fa596b7..a541fb7 100644 --- a/src/helpers.ts +++ b/src/helpers.ts @@ -1,4 +1,4 @@ -import type { APIInteractionResponseCallbackData } from "discord-api-types/v9"; +import type { APIInteractionResponseCallbackData } from "discord-api-types/v10"; export const PREFIX = "slshx"; diff --git a/src/interactions/autocomplete.ts b/src/interactions/autocomplete.ts index eab1922..cc1c809 100644 --- a/src/interactions/autocomplete.ts +++ b/src/interactions/autocomplete.ts @@ -1,5 +1,5 @@ -import type { APIApplicationCommandAutocompleteInteraction } from "discord-api-types/payloads/v9/_interactions/autocomplete"; -import type { APIApplicationCommandAutocompleteResponse } from "discord-api-types/v9"; +import type { APIApplicationCommandAutocompleteInteraction } from "discord-api-types/payloads/v10/_interactions/autocomplete"; +import type { APIApplicationCommandAutocompleteResponse } from "discord-api-types/v10"; import { InteractionResponseType } from "../api"; import { instantiateAutocompleteHandler, normaliseChoices } from "../commands"; import { jsonResponse } from "../helpers"; diff --git a/src/interactions/command.ts b/src/interactions/command.ts index e5bc56c..1563946 100644 --- a/src/interactions/command.ts +++ b/src/interactions/command.ts @@ -3,7 +3,7 @@ import type { APIChatInputApplicationCommandInteractionDataResolved, APIMessage, APIUser, -} from "discord-api-types/v9"; +} from "discord-api-types/v10"; import { ApplicationCommandType } from "../api"; import { instantiateCommandHandler } from "../commands"; import { HandlerOptions } from "../options"; diff --git a/src/interactions/component.ts b/src/interactions/component.ts index 2e72ce4..e8e66be 100644 --- a/src/interactions/component.ts +++ b/src/interactions/component.ts @@ -1,4 +1,4 @@ -import type { APIMessageComponentInteraction } from "discord-api-types/v9"; +import type { APIMessageComponentInteraction } from "discord-api-types/v10"; import { instantiateComponentHandler } from "../commands"; import { HandlerOptions } from "../options"; import { matchCustomId } from "./matchers"; diff --git a/src/interactions/matchers.ts b/src/interactions/matchers.ts index 5cf76c4..94dae49 100644 --- a/src/interactions/matchers.ts +++ b/src/interactions/matchers.ts @@ -1,9 +1,9 @@ -import type { APIApplicationCommandAutocompleteInteraction } from "discord-api-types/payloads/v9/_interactions/autocomplete"; +import type { APIApplicationCommandAutocompleteInteraction } from "discord-api-types/payloads/v10/_interactions/autocomplete"; import type { APIApplicationCommandInteraction, APIApplicationCommandInteractionDataBasicOption, APIApplicationCommandInteractionDataOption, -} from "discord-api-types/v9"; +} from "discord-api-types/v10"; import { ApplicationCommandType } from "../api"; import { AnyCommand, diff --git a/src/interactions/modal.ts b/src/interactions/modal.ts index 72f761d..e30a130 100644 --- a/src/interactions/modal.ts +++ b/src/interactions/modal.ts @@ -1,4 +1,4 @@ -import type { APIModalSubmitInteraction } from "discord-api-types/v9"; +import type { APIModalSubmitInteraction } from "discord-api-types/v10"; import { ComponentType } from "../api"; import { instantiateModalHandler } from "../commands"; import { HandlerOptions } from "../options"; diff --git a/src/interactions/ping.ts b/src/interactions/ping.ts index 2b1a2ca..281ed57 100644 --- a/src/interactions/ping.ts +++ b/src/interactions/ping.ts @@ -1,4 +1,4 @@ -import type { APIInteractionResponsePong } from "discord-api-types/v9"; +import type { APIInteractionResponsePong } from "discord-api-types/v10"; import { InteractionResponseType } from "../api"; import { jsonResponse } from "../helpers"; diff --git a/src/interactions/response.ts b/src/interactions/response.ts index 39233eb..4c0ca60 100644 --- a/src/interactions/response.ts +++ b/src/interactions/response.ts @@ -6,7 +6,7 @@ import type { APIInteractionResponseUpdateMessage, APIModalInteractionResponse, APIModalSubmitInteraction, -} from "discord-api-types/v9"; +} from "discord-api-types/v10"; import { InteractionResponseType, createFollowupMessage, diff --git a/src/interactions/validate.ts b/src/interactions/validate.ts index 7134175..388765d 100644 --- a/src/interactions/validate.ts +++ b/src/interactions/validate.ts @@ -1,7 +1,7 @@ import type { APIInteraction, APIModalSubmitInteraction, -} from "discord-api-types/v9"; +} from "discord-api-types/v10"; import { hexDecode } from "../helpers"; const ENCODER = /* @__PURE__ */ new TextEncoder(); diff --git a/src/jsx/Message.ts b/src/jsx/Message.ts index d48bf10..5e45dc1 100644 --- a/src/jsx/Message.ts +++ b/src/jsx/Message.ts @@ -3,10 +3,10 @@ import type { APIButtonComponent, APIEmbed, APIInteractionResponseCallbackData, - APIMessageComponent, + APIMessageActionRowComponent, APISelectMenuComponent, Snowflake, -} from "discord-api-types/v9"; +} from "discord-api-types/v10"; import { AllowedMentionsTypes, ComponentType } from "../api"; import { $update } from "../commands"; import { ValueOf, WithFileAttachments } from "../helpers"; @@ -30,7 +30,7 @@ export interface MessageProps { children?: ( | Child | (APIEmbed & { [$embed]: true }) - | (APIActionRowComponent & { [$actionRow]: true }) + | (APIActionRowComponent & { [$actionRow]: true }) | (APIButtonComponent & { [$actionRowChild]: true }) | (APISelectMenuComponent & { [$actionRowChild]: true }) )[]; @@ -44,7 +44,7 @@ export function Message( // Sort children into correct slots let content = undefined; const embeds: APIEmbed[] = []; - const components: APIActionRowComponent[] = []; + const components: APIActionRowComponent[] = []; for (const child of props.children?.flat(Infinity) ?? []) { if (isEmptyChild(child)) continue; if ((child as any)[$embed]) { diff --git a/src/jsx/Modal.ts b/src/jsx/Modal.ts index 7b1de25..02ff988 100644 --- a/src/jsx/Modal.ts +++ b/src/jsx/Modal.ts @@ -1,8 +1,8 @@ import type { APIActionRowComponent, - APIModalComponent, + APIModalActionRowComponent, APITextInputComponent, -} from "discord-api-types/v9"; +} from "discord-api-types/v10"; import { ComponentType } from "../api"; import { $modal, ModalResponse } from "../commands"; import { $actionRow, $actionRowChild } from "./components"; @@ -12,13 +12,13 @@ export interface ModalProps { id: string; title: string; children?: ( - | (APIActionRowComponent & { [$actionRow]: true }) + | (APIActionRowComponent & { [$actionRow]: true }) | (APITextInputComponent & { [$actionRowChild]: true }) )[]; } export function Modal(props: ModalProps): ModalResponse { - const components: APIActionRowComponent[] = []; + const components: APIActionRowComponent[] = []; for (const child of props.children?.flat(Infinity) ?? []) { if (isEmptyChild(child)) continue; if ((child as any)[$actionRow]) { diff --git a/src/jsx/components/Button.ts b/src/jsx/components/Button.ts index 63e1b16..80eb5d3 100644 --- a/src/jsx/components/Button.ts +++ b/src/jsx/components/Button.ts @@ -1,7 +1,7 @@ import type { APIButtonComponent, APIMessageComponentEmoji, -} from "discord-api-types/v9"; +} from "discord-api-types/v10"; import { ButtonStyle, ComponentType } from "../../api"; import { Child, childrenContent } from "../helpers"; import { $actionRowChild } from "./Row"; diff --git a/src/jsx/components/Input.ts b/src/jsx/components/Input.ts index c348968..ca711f3 100644 --- a/src/jsx/components/Input.ts +++ b/src/jsx/components/Input.ts @@ -1,4 +1,4 @@ -import type { APITextInputComponent } from "discord-api-types/v9"; +import type { APITextInputComponent } from "discord-api-types/v10"; import { ComponentType, TextInputStyle } from "../../api"; import { $actionRowChild } from "./Row"; diff --git a/src/jsx/components/Option.ts b/src/jsx/components/Option.ts index 7e4a7ce..1cca052 100644 --- a/src/jsx/components/Option.ts +++ b/src/jsx/components/Option.ts @@ -1,7 +1,7 @@ import type { APIMessageComponentEmoji, APISelectMenuOption, -} from "discord-api-types/v9"; +} from "discord-api-types/v10"; import { Child, childrenContent } from "../helpers"; export interface OptionProps { diff --git a/src/jsx/components/Row.ts b/src/jsx/components/Row.ts index 51c9bd7..c147372 100644 --- a/src/jsx/components/Row.ts +++ b/src/jsx/components/Row.ts @@ -2,7 +2,7 @@ import type { APIActionRowComponent, APIActionRowComponentTypes, APIMessageComponent, -} from "discord-api-types/v9"; +} from "discord-api-types/v10"; import { ComponentType } from "../../api"; export const $actionRow = /* @__PURE__ */ Symbol("$actionRow"); diff --git a/src/jsx/components/Select.ts b/src/jsx/components/Select.ts index ed37fd6..cdb9cc9 100644 --- a/src/jsx/components/Select.ts +++ b/src/jsx/components/Select.ts @@ -1,7 +1,7 @@ import type { APISelectMenuComponent, APISelectMenuOption, -} from "discord-api-types/v9"; +} from "discord-api-types/v10"; import { ComponentType } from "../../api"; import { $actionRowChild } from "./Row"; diff --git a/src/jsx/embeds/Embed.ts b/src/jsx/embeds/Embed.ts index ad8db0c..d88020d 100644 --- a/src/jsx/embeds/Embed.ts +++ b/src/jsx/embeds/Embed.ts @@ -5,7 +5,7 @@ import type { APIEmbedFooter, APIEmbedImage, APIEmbedProvider, -} from "discord-api-types/v9"; +} from "discord-api-types/v10"; import { Child, isEmptyChild } from "../helpers"; import { $field } from "./Field"; diff --git a/src/jsx/embeds/Field.ts b/src/jsx/embeds/Field.ts index 3449a85..fd7b815 100644 --- a/src/jsx/embeds/Field.ts +++ b/src/jsx/embeds/Field.ts @@ -1,4 +1,4 @@ -import type { APIEmbedField } from "discord-api-types/v9"; +import type { APIEmbedField } from "discord-api-types/v10"; import { Child, childrenContent } from "../helpers"; export const $field = /* @__PURE__ */ Symbol("$field"); diff --git a/src/options.ts b/src/options.ts index b30d429..2f38a2b 100644 --- a/src/options.ts +++ b/src/options.ts @@ -1,4 +1,4 @@ -import type { Snowflake } from "discord-api-types/v9"; +import type { Snowflake } from "discord-api-types/v10"; import type { ChatInputCommands, MessageCommands, diff --git a/test/integration/attachments.spec.ts b/test/integration/attachments.spec.ts index 5aa1e20..cf57684 100644 --- a/test/integration/attachments.spec.ts +++ b/test/integration/attachments.spec.ts @@ -7,7 +7,7 @@ import type { APIApplicationCommandInteraction, APIInteractionResponseChannelMessageWithSource, RESTPostAPIInteractionFollowupJSONBody, -} from "discord-api-types/v9"; +} from "discord-api-types/v10"; import { Console, INTERACTION, dispatchInteraction, ignite } from "./helpers"; test("responds with file attachments", async (t) => { @@ -15,7 +15,7 @@ test("responds with file attachments", async (t) => { // Check followup message with files is also handled correctly t.is( request.url, - `https://discord.com/api/v9/webhooks/app_id/${INTERACTION.token}` + `https://discord.com/api/v10/webhooks/app_id/${INTERACTION.token}` ); const body = await request.formData(); diff --git a/test/integration/autocomplete.spec.ts b/test/integration/autocomplete.spec.ts index af5e4ae..910e9c3 100644 --- a/test/integration/autocomplete.spec.ts +++ b/test/integration/autocomplete.spec.ts @@ -1,6 +1,6 @@ import test from "ava"; -import type { APIApplicationCommandAutocompleteInteraction } from "discord-api-types/payloads/v9/_interactions/autocomplete"; -import type { APIApplicationCommandAutocompleteResponse } from "discord-api-types/v9"; +import type { APIApplicationCommandAutocompleteInteraction } from "discord-api-types/payloads/v10/_interactions/autocomplete"; +import type { APIApplicationCommandAutocompleteResponse } from "discord-api-types/v10"; import { INTERACTION, dispatchInteraction, ignite } from "./helpers"; test("responds with APPLICATION_COMMAND_AUTOCOMPLETE_RESULT", async (t) => { diff --git a/test/integration/chatinput.spec.ts b/test/integration/chatinput.spec.ts index 44f4ed0..8b8b691 100644 --- a/test/integration/chatinput.spec.ts +++ b/test/integration/chatinput.spec.ts @@ -7,7 +7,7 @@ import type { APIInteractionResponsePong, APIPingInteraction, RESTPostAPIInteractionFollowupJSONBody, -} from "discord-api-types/v9"; +} from "discord-api-types/v10"; import { ATTACHMENT, CHANNEL, @@ -58,7 +58,7 @@ test("responds with DEFERRED_CHANNEL_MESSAGE_WITH_SOURCE", async (t) => { const fetch = async (request: Request) => { t.is( request.url, - `https://discord.com/api/v9/webhooks/app_id/${INTERACTION.token}` + `https://discord.com/api/v10/webhooks/app_id/${INTERACTION.token}` ); const body = await request.json(); t.deepEqual(body, { content: "5 - 2 = 7" }); diff --git a/test/integration/components.spec.ts b/test/integration/components.spec.ts index de0c721..8d84f11 100644 --- a/test/integration/components.spec.ts +++ b/test/integration/components.spec.ts @@ -8,7 +8,7 @@ import type { APIInteractionResponseUpdateMessage, APIMessageComponentInteraction, RESTPostAPIInteractionFollowupJSONBody, -} from "discord-api-types/v9"; +} from "discord-api-types/v10"; import { Console, INTERACTION, @@ -136,7 +136,7 @@ test("responds with DEFERRED_CHANNEL_MESSAGE_WITH_SOURCE in response to button p const fetch = async (request: Request) => { t.is( request.url, - `https://discord.com/api/v9/webhooks/app_id/${INTERACTION.token}` + `https://discord.com/api/v10/webhooks/app_id/${INTERACTION.token}` ); const body = await request.json(); t.deepEqual(body, { content: "Deferred new button clicked" }); @@ -169,7 +169,7 @@ test("responds with DEFERRED_MESSAGE_UPDATE in response to button press", async const fetch = async (request: Request) => { t.is( request.url, - `https://discord.com/api/v9/webhooks/app_id/${INTERACTION.token}/messages/@original` + `https://discord.com/api/v10/webhooks/app_id/${INTERACTION.token}/messages/@original` ); const body = await request.json(); t.deepEqual(body, { content: "Deferred update button clicked" }); diff --git a/test/integration/contextmenu.spec.ts b/test/integration/contextmenu.spec.ts index 522a3e2..fe24457 100644 --- a/test/integration/contextmenu.spec.ts +++ b/test/integration/contextmenu.spec.ts @@ -5,7 +5,7 @@ import type { APIMessageApplicationCommandInteraction, APIMessageComponentInteraction, APIUserApplicationCommandInteraction, -} from "discord-api-types/v9"; +} from "discord-api-types/v10"; import { INTERACTION, MESSAGE, diff --git a/test/integration/deploy.spec.ts b/test/integration/deploy.spec.ts index 27bd1ee..0bc4ae8 100644 --- a/test/integration/deploy.spec.ts +++ b/test/integration/deploy.spec.ts @@ -18,7 +18,7 @@ test("auto-deploys commands to test guild", async (t) => { // token that expires 1 hour from now if ( request.method === "POST" && - request.url === "https://discord.com/api/v9/oauth2/token" + request.url === "https://discord.com/api/v10/oauth2/token" ) { const [type, auth] = request.headers.get("Authorization")!.split(" "); t.is(type, "Basic"); @@ -44,7 +44,7 @@ test("auto-deploys commands to test guild", async (t) => { if ( request.method === "PUT" && request.url === - "https://discord.com/api/v9/applications/app_id/guilds/guild/commands" + "https://discord.com/api/v10/applications/app_id/guilds/guild/commands" ) { t.is(request.headers.get("Authorization"), `Bearer access token`); t.deepEqual(await request.json(), expectedCommands); @@ -67,7 +67,7 @@ test("auto-deploys commands to test guild", async (t) => { t.is(await c.next(), "[slshx] Building and deploying commands..."); t.is(await c.next(), "[slshx] Refreshing access token..."); t.is(await c.next(), "[slshx] POST /oauth2/token: 200"); - t.deepEqual(requests, ["POST https://discord.com/api/v9/oauth2/token"]); + t.deepEqual(requests, ["POST https://discord.com/api/v10/oauth2/token"]); t.is(await c.next(), `[slshx] Deploying ${n} commands to server guild...`); t.not(CACHE.bearerAuth, undefined); // Commands cache shouldn't be updated until successful deploy @@ -77,8 +77,8 @@ test("auto-deploys commands to test guild", async (t) => { "[slshx] PUT /applications/app_id/guilds/guild/commands: 204" ); t.deepEqual(requests, [ - "POST https://discord.com/api/v9/oauth2/token", - "PUT https://discord.com/api/v9/applications/app_id/guilds/guild/commands", + "POST https://discord.com/api/v10/oauth2/token", + "PUT https://discord.com/api/v10/applications/app_id/guilds/guild/commands", ]); t.is(await c.next(), `[slshx] Deployed ${n} commands to server guild!`); t.deepEqual(JSON.parse(CACHE.jsonCommands!), expectedCommands); diff --git a/test/integration/errors.spec.ts b/test/integration/errors.spec.ts index dac9e28..639f522 100644 --- a/test/integration/errors.spec.ts +++ b/test/integration/errors.spec.ts @@ -6,7 +6,7 @@ import type { APIInteractionResponseChannelMessageWithSource, APIMessageComponentInteraction, APIModalSubmitInteraction, -} from "discord-api-types/v9"; +} from "discord-api-types/v10"; import { INTERACTION, MESSAGE, dispatchInteraction, ignite } from "./helpers"; const ERROR: Partial = { diff --git a/test/integration/helpers.ts b/test/integration/helpers.ts index 7bd21bf..3a31b45 100644 --- a/test/integration/helpers.ts +++ b/test/integration/helpers.ts @@ -17,7 +17,7 @@ import type { APIRole, APIUser, RESTPostAPIApplicationCommandsJSONBody, -} from "discord-api-types/v9"; +} from "discord-api-types/v10"; import { Miniflare, MiniflareOptions } from "miniflare"; const __filename = fileURLToPath(import.meta.url); diff --git a/test/integration/landing.spec.ts b/test/integration/landing.spec.ts index 8618cce..2445a17 100644 --- a/test/integration/landing.spec.ts +++ b/test/integration/landing.spec.ts @@ -61,7 +61,7 @@ test("deploys commands globally", async (t) => { // token that expires 1 hour from now if ( request.method === "POST" && - request.url === "https://discord.com/api/v9/oauth2/token" + request.url === "https://discord.com/api/v10/oauth2/token" ) { const [type, auth] = request.headers.get("Authorization")!.split(" "); t.is(type, "Basic"); @@ -86,7 +86,7 @@ test("deploys commands globally", async (t) => { // return nothing: the result should be ignored if successful if ( request.method === "PUT" && - request.url === "https://discord.com/api/v9/applications/app_id/commands" + request.url === "https://discord.com/api/v10/applications/app_id/commands" ) { t.is(request.headers.get("Authorization"), `Bearer access token`); t.deepEqual(await request.json(), EXPECTED_COMMANDS); @@ -116,8 +116,8 @@ test("deploys commands globally", async (t) => { t.regex(body, /\(changes may take up to an hour to propagate\)/); t.deepEqual(requests, [ - "POST https://discord.com/api/v9/oauth2/token", - "PUT https://discord.com/api/v9/applications/app_id/commands", + "POST https://discord.com/api/v10/oauth2/token", + "PUT https://discord.com/api/v10/applications/app_id/commands", ]); const n = EXPECTED_COMMANDS.length; t.is(await c.next(), "[slshx] Building and deploying commands..."); @@ -133,9 +133,9 @@ test("deploys commands globally", async (t) => { }); t.is(res.status, 200); t.deepEqual(requests, [ - "POST https://discord.com/api/v9/oauth2/token", - "PUT https://discord.com/api/v9/applications/app_id/commands", - "PUT https://discord.com/api/v9/applications/app_id/commands", + "POST https://discord.com/api/v10/oauth2/token", + "PUT https://discord.com/api/v10/applications/app_id/commands", + "PUT https://discord.com/api/v10/applications/app_id/commands", ]); // Check doesn't deploy when deployed :D diff --git a/test/integration/modals.spec.ts b/test/integration/modals.spec.ts index 0defd34..71594d0 100644 --- a/test/integration/modals.spec.ts +++ b/test/integration/modals.spec.ts @@ -4,7 +4,7 @@ import type { APIInteractionResponseChannelMessageWithSource, APIModalInteractionResponse, APIModalSubmitInteraction, -} from "discord-api-types/v9"; +} from "discord-api-types/v10"; import { INTERACTION, dispatchInteraction, ignite } from "./helpers"; test("responds with MODAL", async (t) => { diff --git a/test/integration/validate.spec.ts b/test/integration/validate.spec.ts index 3180d1d..31b4466 100644 --- a/test/integration/validate.spec.ts +++ b/test/integration/validate.spec.ts @@ -3,7 +3,7 @@ import test from "ava"; import type { APIInteractionResponsePong, APIPingInteraction, -} from "discord-api-types/v9"; +} from "discord-api-types/v10"; import { INTERACTION, algorithm, diff --git a/test/jsx/Modal.spec.tsx b/test/jsx/Modal.spec.tsx index 99305a3..5a81087 100644 --- a/test/jsx/Modal.spec.tsx +++ b/test/jsx/Modal.spec.tsx @@ -1,5 +1,5 @@ import test from "ava"; -import type { APIModalInteractionResponseCallbackData } from "discord-api-types/v9"; +import type { APIModalInteractionResponseCallbackData } from "discord-api-types/v10"; import { $actionRow, $actionRowChild, diff --git a/test/jsx/components/Button.spec.tsx b/test/jsx/components/Button.spec.tsx index d35e581..3d73bc9 100644 --- a/test/jsx/components/Button.spec.tsx +++ b/test/jsx/components/Button.spec.tsx @@ -2,7 +2,7 @@ import test from "ava"; import type { APIButtonComponent, APIMessageComponentEmoji, -} from "discord-api-types/v9"; +} from "discord-api-types/v10"; import { $actionRowChild, Button, diff --git a/test/jsx/components/Input.spec.tsx b/test/jsx/components/Input.spec.tsx index 163c6d7..0224b8b 100644 --- a/test/jsx/components/Input.spec.tsx +++ b/test/jsx/components/Input.spec.tsx @@ -1,5 +1,5 @@ import test from "ava"; -import type { APITextInputComponent } from "discord-api-types/v9"; +import type { APITextInputComponent } from "discord-api-types/v10"; import { $actionRowChild, ComponentType, diff --git a/test/jsx/components/Row.spec.tsx b/test/jsx/components/Row.spec.tsx index e8ae079..7253243 100644 --- a/test/jsx/components/Row.spec.tsx +++ b/test/jsx/components/Row.spec.tsx @@ -2,7 +2,7 @@ import test from "ava"; import type { APIActionRowComponent, APIActionRowComponentTypes, -} from "discord-api-types/v9"; +} from "discord-api-types/v10"; import { $actionRow, $actionRowChild, diff --git a/test/jsx/components/Select.spec.tsx b/test/jsx/components/Select.spec.tsx index 56fe44b..00a24dc 100644 --- a/test/jsx/components/Select.spec.tsx +++ b/test/jsx/components/Select.spec.tsx @@ -2,7 +2,7 @@ import test from "ava"; import type { APIMessageComponentEmoji, APISelectMenuComponent, -} from "discord-api-types/v9"; +} from "discord-api-types/v10"; import { $actionRowChild, ComponentType, diff --git a/test/jsx/embeds/Embed.spec.tsx b/test/jsx/embeds/Embed.spec.tsx index 45dd202..04a5bff 100644 --- a/test/jsx/embeds/Embed.spec.tsx +++ b/test/jsx/embeds/Embed.spec.tsx @@ -1,5 +1,5 @@ import test from "ava"; -import type { APIEmbed } from "discord-api-types/v9"; +import type { APIEmbed } from "discord-api-types/v10"; import { $embed, $field, Embed, Field, createElement } from "../../../src"; import { emptyEmbed } from "../helpers"; diff --git a/test/jsx/helpers.ts b/test/jsx/helpers.ts index a839c4e..99e3adb 100644 --- a/test/jsx/helpers.ts +++ b/test/jsx/helpers.ts @@ -1,7 +1,7 @@ import type { APIEmbed, APIInteractionResponseCallbackData, -} from "discord-api-types/v9"; +} from "discord-api-types/v10"; import { $update, WithFileAttachments } from "../../src"; export type APIMessage = diff --git a/test/jsx/misc.spec.tsx b/test/jsx/misc.spec.tsx index d7d03f5..e0e1bef 100644 --- a/test/jsx/misc.spec.tsx +++ b/test/jsx/misc.spec.tsx @@ -3,7 +3,7 @@ import type { APIActionRowComponent, APIActionRowComponentTypes, APIButtonComponent, -} from "discord-api-types/v9"; +} from "discord-api-types/v10"; // noinspection ES6UnusedImports import { $actionRow,