mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-09 16:13:31 +01:00
types(showModal): align types with the documentation (#7600)
This commit is contained in:
6
packages/discord.js/typings/index.d.ts
vendored
6
packages/discord.js/typings/index.d.ts
vendored
@@ -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<
|
||||
|
||||
@@ -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,
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user