feat(Interactions): option to auto-fetch replies (#5831)

This commit is contained in:
monbrey
2021-06-30 07:32:33 +10:00
committed by GitHub
parent 5dfd7dd1bf
commit 5e28ff83cb
4 changed files with 50 additions and 14 deletions

24
typings/index.d.ts vendored
View File

@@ -558,11 +558,14 @@ declare module 'discord.js' {
public options: Collection<string, CommandInteractionOption>;
public replied: boolean;
public webhook: InteractionWebhook;
public defer(options?: InteractionDeferOptions & { fetchReply: true }): Promise<Message | RawMessage>;
public defer(options?: InteractionDeferOptions): Promise<void>;
public deleteReply(): Promise<void>;
public editReply(options: string | MessagePayload | WebhookEditMessageOptions): Promise<Message | APIMessage>;
public fetchReply(): Promise<Message | APIMessage>;
public followUp(options: string | MessagePayload | InteractionReplyOptions): Promise<Message | APIMessage>;
public reply(
options: string | MessagePayload | (InteractionReplyOptions & { fetchReply: true }),
): Promise<Message | APIMessage>;
public reply(options: string | MessagePayload | InteractionReplyOptions): Promise<void>;
private transformOption(option: unknown, resolved: unknown): CommandInteractionOption;
private _createOptionsCollection(options: unknown, resolved: unknown): Collection<string, CommandInteractionOption>;
@@ -1417,14 +1420,23 @@ declare module 'discord.js' {
public message: Message | APIMessage;
public replied: boolean;
public webhook: InteractionWebhook;
public defer(options?: InteractionDeferOptions & { fetchReply: true }): Promise<Message | RawMessage>;
public defer(options?: InteractionDeferOptions): Promise<void>;
public deferUpdate(): Promise<void>;
public deferUpdate(options?: InteractionDeferUpdateOptions & { fetchReply: true }): Promise<Message | RawMessage>;
public deferUpdate(options?: InteractionDeferUpdateOptions): Promise<void>;
public deleteReply(): Promise<void>;
public editReply(options: string | MessagePayload | WebhookEditMessageOptions): Promise<Message | APIMessage>;
public fetchReply(): Promise<Message | APIMessage>;
public followUp(options: string | MessagePayload | InteractionReplyOptions): Promise<Message | APIMessage>;
public reply(
options: string | MessagePayload | (InteractionReplyOptions & { fetchReply: true }),
): Promise<Message | APIMessage>;
public reply(options: string | MessagePayload | InteractionReplyOptions): Promise<void>;
public update(content: string | MessagePayload | WebhookEditMessageOptions): Promise<void>;
public update(
content: string | MessagePayload | (InteractionUpdateOptions & { fetchReply: true }),
): Promise<Message | APIMessage>;
public update(content: string | MessagePayload | InteractionUpdateOptions): Promise<void>;
public static resolveType(type: MessageComponentTypeResolvable): MessageComponentType;
}
@@ -3609,16 +3621,22 @@ declare module 'discord.js' {
interface InteractionDeferOptions {
ephemeral?: boolean;
fetchReply?: boolean;
}
interface InteractionDeferUpdateOptions extends Omit<InteractionDeferOptions, 'ephemeral'> {}
interface InteractionReplyOptions extends Omit<WebhookMessageOptions, 'username' | 'avatarURL'> {
ephemeral?: boolean;
fetchReply?: boolean;
}
type InteractionResponseType = keyof typeof InteractionResponseTypes;
type InteractionType = keyof typeof InteractionTypes;
interface InteractionUpdateOptions extends Omit<InteractionReplyOptions, 'ephemeral'> {}
type IntentsString =
| 'GUILDS'
| 'GUILD_MEMBERS'