mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-19 04:53:30 +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>;
|
deferReply(options?: InteractionDeferReplyOptions): Promise<void>;
|
||||||
fetchReply(): Promise<GuildCacheMessage<Cached>>;
|
fetchReply(): Promise<GuildCacheMessage<Cached>>;
|
||||||
followUp(options: string | MessagePayload | InteractionReplyOptions): 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> {
|
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 followUp(options: string | MessagePayload | InteractionReplyOptions): Promise<GuildCacheMessage<Cached>>;
|
||||||
public reply(options: InteractionReplyOptions & { fetchReply: true }): Promise<GuildCacheMessage<Cached>>;
|
public reply(options: InteractionReplyOptions & { fetchReply: true }): Promise<GuildCacheMessage<Cached>>;
|
||||||
public reply(options: string | MessagePayload | InteractionReplyOptions): Promise<void>;
|
public reply(options: string | MessagePayload | InteractionReplyOptions): Promise<void>;
|
||||||
public showModal(modal: Modal): Promise<void>;
|
public showModal(modal: Modal | ModalData | APIModalInteractionResponseCallbackData): Promise<void>;
|
||||||
private transformOption(
|
private transformOption(
|
||||||
option: APIApplicationCommandOption,
|
option: APIApplicationCommandOption,
|
||||||
resolved: APIApplicationCommandInteractionData['resolved'],
|
resolved: APIApplicationCommandInteractionData['resolved'],
|
||||||
@@ -1647,7 +1647,7 @@ export class MessageComponentInteraction<Cached extends CacheType = CacheType> e
|
|||||||
public reply(options: string | MessagePayload | InteractionReplyOptions): Promise<void>;
|
public reply(options: string | MessagePayload | InteractionReplyOptions): Promise<void>;
|
||||||
public update(options: InteractionUpdateOptions & { fetchReply: true }): Promise<GuildCacheMessage<Cached>>;
|
public update(options: InteractionUpdateOptions & { fetchReply: true }): Promise<GuildCacheMessage<Cached>>;
|
||||||
public update(options: string | MessagePayload | InteractionUpdateOptions): Promise<void>;
|
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<
|
export class MessageContextMenuCommandInteraction<
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ import {
|
|||||||
PermissionFlagsBits,
|
PermissionFlagsBits,
|
||||||
AuditLogEvent,
|
AuditLogEvent,
|
||||||
ButtonStyle,
|
ButtonStyle,
|
||||||
|
TextInputStyle,
|
||||||
} from 'discord-api-types/v9';
|
} from 'discord-api-types/v9';
|
||||||
import {
|
import {
|
||||||
ApplicationCommand,
|
ApplicationCommand,
|
||||||
@@ -58,6 +59,7 @@ import {
|
|||||||
MessageCollector,
|
MessageCollector,
|
||||||
MessageComponentInteraction,
|
MessageComponentInteraction,
|
||||||
MessageReaction,
|
MessageReaction,
|
||||||
|
Modal,
|
||||||
NewsChannel,
|
NewsChannel,
|
||||||
Options,
|
Options,
|
||||||
PartialTextBasedChannelFields,
|
PartialTextBasedChannelFields,
|
||||||
@@ -1353,3 +1355,25 @@ declare const chatInputInteraction: ChatInputCommandInteraction;
|
|||||||
|
|
||||||
expectType<MessageAttachment>(chatInputInteraction.options.getAttachment('attachment', true));
|
expectType<MessageAttachment>(chatInputInteraction.options.getAttachment('attachment', true));
|
||||||
expectType<MessageAttachment | null>(chatInputInteraction.options.getAttachment('attachment'));
|
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