mirror of
https://github.com/discordjs/discord-api-types.git
synced 2026-09-18 09:17:25 +00:00
fix: remove options and handler respectively (#1793)
This commit is contained in:
Generated
+6
@@ -1,11 +1,13 @@
|
||||
import type { Snowflake } from '../../globals.ts';
|
||||
import type {
|
||||
APIApplicationCommand,
|
||||
APIApplicationCommandOption,
|
||||
APIApplicationCommandPermission,
|
||||
APIGuildApplicationCommandPermissions,
|
||||
APIInteractionResponse,
|
||||
APIInteractionResponseCallbackData,
|
||||
ApplicationCommandType,
|
||||
EntryPointCommandHandlerType,
|
||||
InteractionResponseType,
|
||||
APIMessage,
|
||||
InteractionType,
|
||||
@@ -58,9 +60,11 @@ export interface RESTPostAPIBaseApplicationCommandsJSONBody
|
||||
| 'description_localized'
|
||||
| 'description'
|
||||
| 'guild_id'
|
||||
| 'handler'
|
||||
| 'id'
|
||||
| 'integration_types'
|
||||
| 'name_localized'
|
||||
| 'options'
|
||||
| 'type'
|
||||
| 'version'
|
||||
>
|
||||
@@ -78,6 +82,7 @@ export interface RESTPostAPIBaseApplicationCommandsJSONBody
|
||||
export interface RESTPostAPIChatInputApplicationCommandsJSONBody extends RESTPostAPIBaseApplicationCommandsJSONBody {
|
||||
type?: ApplicationCommandType.ChatInput | undefined;
|
||||
description: string;
|
||||
options?: APIApplicationCommandOption[] | undefined;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -93,6 +98,7 @@ export interface RESTPostAPIContextMenuApplicationCommandsJSONBody extends RESTP
|
||||
export interface RESTPostAPIPrimaryEntryPointApplicationCommandJSONBody extends RESTPostAPIBaseApplicationCommandsJSONBody {
|
||||
type: ApplicationCommandType.PrimaryEntryPoint;
|
||||
description?: string | undefined;
|
||||
handler?: EntryPointCommandHandlerType | undefined;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Generated
+6
@@ -1,11 +1,13 @@
|
||||
import type { Snowflake } from '../../globals.ts';
|
||||
import type {
|
||||
APIApplicationCommand,
|
||||
APIApplicationCommandOption,
|
||||
APIApplicationCommandPermission,
|
||||
APIGuildApplicationCommandPermissions,
|
||||
APIInteractionResponse,
|
||||
APIInteractionResponseCallbackData,
|
||||
ApplicationCommandType,
|
||||
EntryPointCommandHandlerType,
|
||||
InteractionResponseType,
|
||||
APIMessage,
|
||||
InteractionType,
|
||||
@@ -58,9 +60,11 @@ export interface RESTPostAPIBaseApplicationCommandsJSONBody
|
||||
| 'description_localized'
|
||||
| 'description'
|
||||
| 'guild_id'
|
||||
| 'handler'
|
||||
| 'id'
|
||||
| 'integration_types'
|
||||
| 'name_localized'
|
||||
| 'options'
|
||||
| 'type'
|
||||
| 'version'
|
||||
>
|
||||
@@ -78,6 +82,7 @@ export interface RESTPostAPIBaseApplicationCommandsJSONBody
|
||||
export interface RESTPostAPIChatInputApplicationCommandsJSONBody extends RESTPostAPIBaseApplicationCommandsJSONBody {
|
||||
type?: ApplicationCommandType.ChatInput | undefined;
|
||||
description: string;
|
||||
options?: APIApplicationCommandOption[] | undefined;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -93,6 +98,7 @@ export interface RESTPostAPIContextMenuApplicationCommandsJSONBody extends RESTP
|
||||
export interface RESTPostAPIPrimaryEntryPointApplicationCommandJSONBody extends RESTPostAPIBaseApplicationCommandsJSONBody {
|
||||
type: ApplicationCommandType.PrimaryEntryPoint;
|
||||
description?: string | undefined;
|
||||
handler?: EntryPointCommandHandlerType | undefined;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
import type { Snowflake } from '../../globals';
|
||||
import type {
|
||||
APIApplicationCommand,
|
||||
APIApplicationCommandOption,
|
||||
APIApplicationCommandPermission,
|
||||
APIGuildApplicationCommandPermissions,
|
||||
APIInteractionResponse,
|
||||
APIInteractionResponseCallbackData,
|
||||
ApplicationCommandType,
|
||||
EntryPointCommandHandlerType,
|
||||
InteractionResponseType,
|
||||
APIMessage,
|
||||
InteractionType,
|
||||
@@ -58,9 +60,11 @@ export interface RESTPostAPIBaseApplicationCommandsJSONBody
|
||||
| 'description_localized'
|
||||
| 'description'
|
||||
| 'guild_id'
|
||||
| 'handler'
|
||||
| 'id'
|
||||
| 'integration_types'
|
||||
| 'name_localized'
|
||||
| 'options'
|
||||
| 'type'
|
||||
| 'version'
|
||||
>
|
||||
@@ -78,6 +82,7 @@ export interface RESTPostAPIBaseApplicationCommandsJSONBody
|
||||
export interface RESTPostAPIChatInputApplicationCommandsJSONBody extends RESTPostAPIBaseApplicationCommandsJSONBody {
|
||||
type?: ApplicationCommandType.ChatInput | undefined;
|
||||
description: string;
|
||||
options?: APIApplicationCommandOption[] | undefined;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -93,6 +98,7 @@ export interface RESTPostAPIContextMenuApplicationCommandsJSONBody extends RESTP
|
||||
export interface RESTPostAPIPrimaryEntryPointApplicationCommandJSONBody extends RESTPostAPIBaseApplicationCommandsJSONBody {
|
||||
type: ApplicationCommandType.PrimaryEntryPoint;
|
||||
description?: string | undefined;
|
||||
handler?: EntryPointCommandHandlerType | undefined;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
import type { Snowflake } from '../../globals';
|
||||
import type {
|
||||
APIApplicationCommand,
|
||||
APIApplicationCommandOption,
|
||||
APIApplicationCommandPermission,
|
||||
APIGuildApplicationCommandPermissions,
|
||||
APIInteractionResponse,
|
||||
APIInteractionResponseCallbackData,
|
||||
ApplicationCommandType,
|
||||
EntryPointCommandHandlerType,
|
||||
InteractionResponseType,
|
||||
APIMessage,
|
||||
InteractionType,
|
||||
@@ -58,9 +60,11 @@ export interface RESTPostAPIBaseApplicationCommandsJSONBody
|
||||
| 'description_localized'
|
||||
| 'description'
|
||||
| 'guild_id'
|
||||
| 'handler'
|
||||
| 'id'
|
||||
| 'integration_types'
|
||||
| 'name_localized'
|
||||
| 'options'
|
||||
| 'type'
|
||||
| 'version'
|
||||
>
|
||||
@@ -78,6 +82,7 @@ export interface RESTPostAPIBaseApplicationCommandsJSONBody
|
||||
export interface RESTPostAPIChatInputApplicationCommandsJSONBody extends RESTPostAPIBaseApplicationCommandsJSONBody {
|
||||
type?: ApplicationCommandType.ChatInput | undefined;
|
||||
description: string;
|
||||
options?: APIApplicationCommandOption[] | undefined;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -93,6 +98,7 @@ export interface RESTPostAPIContextMenuApplicationCommandsJSONBody extends RESTP
|
||||
export interface RESTPostAPIPrimaryEntryPointApplicationCommandJSONBody extends RESTPostAPIBaseApplicationCommandsJSONBody {
|
||||
type: ApplicationCommandType.PrimaryEntryPoint;
|
||||
description?: string | undefined;
|
||||
handler?: EntryPointCommandHandlerType | undefined;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
import type {
|
||||
RESTPatchAPIApplicationCommandJSONBody,
|
||||
RESTPostAPIApplicationCommandsJSONBody,
|
||||
RESTPostAPIBaseApplicationCommandsJSONBody,
|
||||
RESTPostAPIApplicationGuildCommandsJSONBody,
|
||||
RESTPostAPIChatInputApplicationCommandsJSONBody,
|
||||
RESTPostAPIContextMenuApplicationCommandsJSONBody,
|
||||
RESTPostAPIPrimaryEntryPointApplicationCommandJSONBody,
|
||||
RESTPutAPIApplicationCommandsJSONBody,
|
||||
RESTPutAPIApplicationGuildCommandsJSONBody,
|
||||
} from '../../v10';
|
||||
import { ApplicationCommandType, EntryPointCommandHandlerType } from '../../v10';
|
||||
import { expectAssignable } from '../__utils__/type-assertions';
|
||||
|
||||
const chatInputCommand = {
|
||||
name: 'Chat input',
|
||||
description: 'description',
|
||||
options: [],
|
||||
};
|
||||
|
||||
const contextMenuCommand = {
|
||||
type: ApplicationCommandType.User as const,
|
||||
name: 'Context menu',
|
||||
};
|
||||
|
||||
const primaryEntryPointCommand = {
|
||||
type: ApplicationCommandType.PrimaryEntryPoint as const,
|
||||
name: 'Entry point',
|
||||
handler: EntryPointCommandHandlerType.DiscordLaunchActivity,
|
||||
};
|
||||
|
||||
expectAssignable<RESTPostAPIApplicationCommandsJSONBody>(chatInputCommand);
|
||||
expectAssignable<RESTPostAPIApplicationCommandsJSONBody>(contextMenuCommand);
|
||||
expectAssignable<RESTPostAPIApplicationCommandsJSONBody>(primaryEntryPointCommand);
|
||||
expectAssignable<RESTPutAPIApplicationCommandsJSONBody>([
|
||||
chatInputCommand,
|
||||
contextMenuCommand,
|
||||
primaryEntryPointCommand,
|
||||
]);
|
||||
expectAssignable<RESTPostAPIApplicationGuildCommandsJSONBody>(chatInputCommand);
|
||||
expectAssignable<RESTPutAPIApplicationGuildCommandsJSONBody>([chatInputCommand, contextMenuCommand]);
|
||||
expectAssignable<RESTPatchAPIApplicationCommandJSONBody>({ options: [] });
|
||||
expectAssignable<RESTPatchAPIApplicationCommandJSONBody>({
|
||||
handler: EntryPointCommandHandlerType.AppHandler,
|
||||
});
|
||||
|
||||
// @ts-expect-error - Options are not on all types.
|
||||
expectAssignable<keyof RESTPostAPIBaseApplicationCommandsJSONBody>('options');
|
||||
expectAssignable<keyof RESTPostAPIChatInputApplicationCommandsJSONBody>('options');
|
||||
|
||||
// @ts-expect-error - Options are only valid for chat input commands.
|
||||
expectAssignable<keyof RESTPostAPIContextMenuApplicationCommandsJSONBody>('options');
|
||||
// @ts-expect-error - Options are only valid for chat input commands.
|
||||
expectAssignable<keyof RESTPostAPIPrimaryEntryPointApplicationCommandJSONBody>('options');
|
||||
|
||||
// @ts-expect-error - Handler is not on all types.
|
||||
expectAssignable<keyof RESTPostAPIBaseApplicationCommandsJSONBody>('handler');
|
||||
|
||||
// @ts-expect-error - Handler is only valid for primary entry point commands.
|
||||
expectAssignable<keyof RESTPostAPIChatInputApplicationCommandsJSONBody>('handler');
|
||||
// @ts-expect-error - Handler is only valid for primary entry point commands.
|
||||
expectAssignable<keyof RESTPostAPIContextMenuApplicationCommandsJSONBody>('handler');
|
||||
expectAssignable<keyof RESTPostAPIPrimaryEntryPointApplicationCommandJSONBody>('handler');
|
||||
Reference in New Issue
Block a user