fix(APIInteractionResponse): data should not always be present (#100)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
This commit is contained in:
Advaith
2021-03-27 15:40:52 -07:00
committed by GitHub
parent 2636bd0949
commit ffcd95d597
2 changed files with 22 additions and 28 deletions

View File

@@ -238,14 +238,19 @@ export type APIInteractionResponse =
| APIInteractionResponseChannelMessageWithSource
| APIInteractionResponseDeferredChannelMessageWithSource;
export type APIInteractionResponsePong = InteractionResponsePayload<InteractionResponseType.Pong>;
export interface APIInteractionResponsePong {
type: InteractionResponseType.Pong;
}
export type APIInteractionResponseChannelMessageWithSource = InteractionResponsePayload<
InteractionResponseType.ChannelMessageWithSource,
true
>;
export interface APIInteractionResponseChannelMessageWithSource {
type: InteractionResponseType.ChannelMessageWithSource;
data: APIInteractionApplicationCommandCallbackData;
}
export type APIInteractionResponseDeferredChannelMessageWithSource = InteractionResponsePayload<InteractionResponseType.DeferredChannelMessageWithSource>;
export interface APIInteractionResponseDeferredChannelMessageWithSource {
type: InteractionResponseType.DeferredChannelMessageWithSource;
data?: Pick<APIInteractionApplicationCommandCallbackData, 'flags'>;
}
/**
* https://discord.com/developers/docs/interactions/slash-commands#interaction-response-interactionresponsetype
@@ -295,14 +300,6 @@ export interface APIMessageInteraction {
user: APIUser;
}
/**
* @internal
*/
interface InteractionResponsePayload<T extends InteractionResponseType, D = false> {
type: T;
data: D extends true ? APIInteractionApplicationCommandCallbackData : never;
}
/**
* @internal
*/

View File

@@ -238,14 +238,19 @@ export type APIInteractionResponse =
| APIInteractionResponseChannelMessageWithSource
| APIInteractionResponseDeferredChannelMessageWithSource;
export type APIInteractionResponsePong = InteractionResponsePayload<InteractionResponseType.Pong>;
export interface APIInteractionResponsePong {
type: InteractionResponseType.Pong;
}
export type APIInteractionResponseChannelMessageWithSource = InteractionResponsePayload<
InteractionResponseType.ChannelMessageWithSource,
true
>;
export interface APIInteractionResponseChannelMessageWithSource {
type: InteractionResponseType.ChannelMessageWithSource;
data: APIInteractionApplicationCommandCallbackData;
}
export type APIInteractionResponseDeferredChannelMessageWithSource = InteractionResponsePayload<InteractionResponseType.DeferredChannelMessageWithSource>;
export interface APIInteractionResponseDeferredChannelMessageWithSource {
type: InteractionResponseType.DeferredChannelMessageWithSource;
data?: Pick<APIInteractionApplicationCommandCallbackData, 'flags'>;
}
/**
* https://discord.com/developers/docs/interactions/slash-commands#interaction-response-interactionresponsetype
@@ -295,14 +300,6 @@ export interface APIMessageInteraction {
user: APIUser;
}
/**
* @internal
*/
interface InteractionResponsePayload<T extends InteractionResponseType, D = false> {
type: T;
data: D extends true ? APIInteractionApplicationCommandCallbackData : never;
}
/**
* @internal
*/