types(showModal): align types with the documentation (#7600)

This commit is contained in:
Almeida
2022-03-06 15:25:56 +00:00
committed by GitHub
parent fac55bcfd1
commit 0d7e4edd96
2 changed files with 27 additions and 3 deletions

View File

@@ -352,7 +352,7 @@ export interface InteractionResponseFields<Cached extends CacheType = CacheType>
deferReply(options?: InteractionDeferReplyOptions): Promise<void>;
fetchReply(): Promise<GuildCacheMessage<Cached>>;
followUp(options: string | MessagePayload | InteractionReplyOptions): Promise<GuildCacheMessage<Cached>>;
showModal(modal: Modal): Promise<void>;
showModal(modal: Modal | ModalData | APIModalInteractionResponseCallbackData): Promise<void>;
}
export abstract class CommandInteraction<Cached extends CacheType = CacheType> extends Interaction<Cached> {
@@ -391,7 +391,7 @@ export abstract class CommandInteraction<Cached extends CacheType = CacheType> e
public followUp(options: string | MessagePayload | InteractionReplyOptions): Promise<GuildCacheMessage<Cached>>;
public reply(options: InteractionReplyOptions & { fetchReply: true }): Promise<GuildCacheMessage<Cached>>;
public reply(options: string | MessagePayload | InteractionReplyOptions): Promise<void>;
public showModal(modal: Modal): Promise<void>;
public showModal(modal: Modal | ModalData | APIModalInteractionResponseCallbackData): Promise<void>;
private transformOption(
option: APIApplicationCommandOption,
resolved: APIApplicationCommandInteractionData['resolved'],
@@ -1647,7 +1647,7 @@ export class MessageComponentInteraction<Cached extends CacheType = CacheType> e
public reply(options: string | MessagePayload | InteractionReplyOptions): Promise<void>;
public update(options: InteractionUpdateOptions & { fetchReply: true }): Promise<GuildCacheMessage<Cached>>;
public update(options: string | MessagePayload | InteractionUpdateOptions): Promise<void>;
public showModal(modal: Modal): Promise<void>;
public showModal(modal: Modal | ModalData | APIModalInteractionResponseCallbackData): Promise<void>;
}
export class MessageContextMenuCommandInteraction<

View File

@@ -19,6 +19,7 @@ import {
PermissionFlagsBits,
AuditLogEvent,
ButtonStyle,
TextInputStyle,
} from 'discord-api-types/v9';
import {
ApplicationCommand,
@@ -58,6 +59,7 @@ import {
MessageCollector,
MessageComponentInteraction,
MessageReaction,
Modal,
NewsChannel,
Options,
PartialTextBasedChannelFields,
@@ -1353,3 +1355,25 @@ declare const chatInputInteraction: ChatInputCommandInteraction;
expectType<MessageAttachment>(chatInputInteraction.options.getAttachment('attachment', true));
expectType<MessageAttachment | null>(chatInputInteraction.options.getAttachment('attachment'));
declare const modal: Modal;
chatInputInteraction.showModal(modal);
chatInputInteraction.showModal({
title: 'abc',
custom_id: 'abc',
components: [
{
components: [
{
custom_id: 'aa',
label: 'label',
style: TextInputStyle.Short,
type: ComponentType.TextInput,
},
],
type: ComponentType.ActionRow,
},
],
});