types(modal): fix showModal() typings (#8014)

This commit is contained in:
Suneet Tipirneni
2022-06-05 17:28:28 -04:00
committed by GitHub
parent 0a7953e463
commit 0ccc243c8f
2 changed files with 20 additions and 5 deletions

View File

@@ -8,10 +8,10 @@ const InteractionResponse = require('../InteractionResponse');
const MessagePayload = require('../MessagePayload');
/**
* @typedef {Object} ModalData
* @typedef {Object} ModalComponentData
* @property {string} title The title of the modal
* @property {string} customId The custom id of the modal
* @property {ActionRowData[]} components The components within this modal
* @property {ActionRow[]} components The components within this modal
*/
/**

View File

@@ -400,7 +400,10 @@ export interface InteractionResponseFields<Cached extends CacheType = CacheType>
fetchReply(): Promise<Message>;
followUp(options: string | MessagePayload | InteractionReplyOptions): Promise<Message>;
showModal(
modal: JSONEncodable<APIModalInteractionResponseCallbackData> | ModalData | APIModalInteractionResponseCallbackData,
modal:
| JSONEncodable<APIModalInteractionResponseCallbackData>
| ModalComponentData
| APIModalInteractionResponseCallbackData,
): Promise<void>;
awaitModalSubmit(options: AwaitModalSubmitOptions<ModalSubmitInteraction>): Promise<ModalSubmitInteraction<Cached>>;
}
@@ -448,7 +451,10 @@ export abstract class CommandInteraction<Cached extends CacheType = CacheType> e
options: string | MessagePayload | InteractionReplyOptions,
): Promise<InteractionResponse<BooleanCache<Cached>>>;
public showModal(
modal: JSONEncodable<APIModalInteractionResponseCallbackData> | ModalData | APIModalInteractionResponseCallbackData,
modal:
| JSONEncodable<APIModalInteractionResponseCallbackData>
| ModalComponentData
| APIModalInteractionResponseCallbackData,
): Promise<void>;
public awaitModalSubmit(
options: AwaitModalSubmitOptions<ModalSubmitInteraction>,
@@ -1787,7 +1793,10 @@ export class MessageComponentInteraction<Cached extends CacheType = CacheType> e
options: string | MessagePayload | InteractionUpdateOptions,
): Promise<InteractionResponse<BooleanCache<Cached>>>;
public showModal(
modal: JSONEncodable<APIModalInteractionResponseCallbackData> | ModalData | APIModalInteractionResponseCallbackData,
modal:
| JSONEncodable<APIModalInteractionResponseCallbackData>
| ModalComponentData
| APIModalInteractionResponseCallbackData,
): Promise<void>;
public awaitModalSubmit(
options: AwaitModalSubmitOptions<ModalSubmitInteraction>,
@@ -1882,6 +1891,12 @@ export class MessageReaction {
public toJSON(): unknown;
}
export interface ModalComponentData {
customId: string;
title: string;
components: (ActionRow<ModalActionRowComponent> | ActionRowData<ModalActionRowComponentData>)[];
}
export interface BaseModalData {
customId: string;
type: ComponentType;