mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-17 20:13:30 +01:00
types(InteractionCallbackResponse): add missing InGuild generic (#10767)
Co-authored-by: TÆMBØ <TAEMBO@users.noreply.github.com> Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
This commit is contained in:
78
packages/discord.js/typings/index.d.ts
vendored
78
packages/discord.js/typings/index.d.ts
vendored
@@ -571,27 +571,31 @@ export abstract class CommandInteraction<Cached extends CacheType = CacheType> e
|
|||||||
public inRawGuild(): this is CommandInteraction<'raw'>;
|
public inRawGuild(): this is CommandInteraction<'raw'>;
|
||||||
public deferReply(
|
public deferReply(
|
||||||
options: InteractionDeferReplyOptions & { withResponse: true },
|
options: InteractionDeferReplyOptions & { withResponse: true },
|
||||||
): Promise<InteractionCallbackResponse>;
|
): Promise<InteractionCallbackResponse<BooleanCache<Cached>>>;
|
||||||
public deferReply(options?: InteractionDeferReplyOptions & { withResponse: false }): Promise<undefined>;
|
public deferReply(options?: InteractionDeferReplyOptions & { withResponse: false }): Promise<undefined>;
|
||||||
public deferReply(options?: InteractionDeferReplyOptions): Promise<InteractionCallbackResponse | undefined>;
|
public deferReply(
|
||||||
|
options?: InteractionDeferReplyOptions,
|
||||||
|
): Promise<InteractionCallbackResponse<BooleanCache<Cached>> | undefined>;
|
||||||
public deleteReply(message?: MessageResolvable | '@original'): Promise<void>;
|
public deleteReply(message?: MessageResolvable | '@original'): Promise<void>;
|
||||||
public editReply(
|
public editReply(
|
||||||
options: string | MessagePayload | InteractionEditReplyOptions,
|
options: string | MessagePayload | InteractionEditReplyOptions,
|
||||||
): Promise<Message<BooleanCache<Cached>>>;
|
): Promise<Message<BooleanCache<Cached>>>;
|
||||||
public fetchReply(message?: Snowflake | '@original'): Promise<Message<BooleanCache<Cached>>>;
|
public fetchReply(message?: Snowflake | '@original'): Promise<Message<BooleanCache<Cached>>>;
|
||||||
public followUp(options: string | MessagePayload | InteractionReplyOptions): Promise<Message<BooleanCache<Cached>>>;
|
public followUp(options: string | MessagePayload | InteractionReplyOptions): Promise<Message<BooleanCache<Cached>>>;
|
||||||
public reply(options: InteractionReplyOptions & { withResponse: true }): Promise<InteractionCallbackResponse>;
|
public reply(
|
||||||
|
options: InteractionReplyOptions & { withResponse: true },
|
||||||
|
): Promise<InteractionCallbackResponse<BooleanCache<Cached>>>;
|
||||||
public reply(options: InteractionReplyOptions & { withResponse: false }): Promise<undefined>;
|
public reply(options: InteractionReplyOptions & { withResponse: false }): Promise<undefined>;
|
||||||
public reply(
|
public reply(
|
||||||
options: string | MessagePayload | InteractionReplyOptions,
|
options: string | MessagePayload | InteractionReplyOptions,
|
||||||
): Promise<InteractionCallbackResponse | undefined>;
|
): Promise<InteractionCallbackResponse<BooleanCache<Cached>> | undefined>;
|
||||||
public showModal(
|
public showModal(
|
||||||
modal:
|
modal:
|
||||||
| JSONEncodable<APIModalInteractionResponseCallbackData>
|
| JSONEncodable<APIModalInteractionResponseCallbackData>
|
||||||
| ModalComponentData
|
| ModalComponentData
|
||||||
| APIModalInteractionResponseCallbackData,
|
| APIModalInteractionResponseCallbackData,
|
||||||
options: ShowModalOptions & { withResponse: true },
|
options: ShowModalOptions & { withResponse: true },
|
||||||
): Promise<InteractionCallbackResponse>;
|
): Promise<InteractionCallbackResponse<BooleanCache<Cached>>>;
|
||||||
public showModal(
|
public showModal(
|
||||||
modal:
|
modal:
|
||||||
| JSONEncodable<APIModalInteractionResponseCallbackData>
|
| JSONEncodable<APIModalInteractionResponseCallbackData>
|
||||||
@@ -605,7 +609,7 @@ export abstract class CommandInteraction<Cached extends CacheType = CacheType> e
|
|||||||
| ModalComponentData
|
| ModalComponentData
|
||||||
| APIModalInteractionResponseCallbackData,
|
| APIModalInteractionResponseCallbackData,
|
||||||
options?: ShowModalOptions,
|
options?: ShowModalOptions,
|
||||||
): Promise<InteractionCallbackResponse | undefined>;
|
): Promise<InteractionCallbackResponse<BooleanCache<Cached>> | undefined>;
|
||||||
public awaitModalSubmit(
|
public awaitModalSubmit(
|
||||||
options: AwaitModalSubmitOptions<ModalSubmitInteraction>,
|
options: AwaitModalSubmitOptions<ModalSubmitInteraction>,
|
||||||
): Promise<ModalSubmitInteraction<Cached>>;
|
): Promise<ModalSubmitInteraction<Cached>>;
|
||||||
@@ -1952,17 +1956,17 @@ export class InteractionCallback {
|
|||||||
public type: InteractionType;
|
public type: InteractionType;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class InteractionCallbackResponse {
|
export class InteractionCallbackResponse<InGuild extends boolean = boolean> {
|
||||||
private constructor(client: Client<true>, data: RESTPostAPIInteractionCallbackWithResponseResult);
|
private constructor(client: Client<true>, data: RESTPostAPIInteractionCallbackWithResponseResult);
|
||||||
public readonly client: Client<true>;
|
public readonly client: Client<true>;
|
||||||
public interaction: InteractionCallback;
|
public interaction: InteractionCallback;
|
||||||
public resource: InteractionCallbackResource | null;
|
public resource: InteractionCallbackResource<InGuild> | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class InteractionCallbackResource {
|
export class InteractionCallbackResource<InGuild extends boolean = boolean> {
|
||||||
private constructor(client: Client<true>, data: RESTAPIInteractionCallbackResourceObject);
|
private constructor(client: Client<true>, data: RESTAPIInteractionCallbackResourceObject);
|
||||||
public activityInstance: RESTAPIInteractionCallbackActivityInstanceResource | null;
|
public activityInstance: RESTAPIInteractionCallbackActivityInstanceResource | null;
|
||||||
public message: Message | null;
|
public message: Message<InGuild> | null;
|
||||||
public type: InteractionResponseType;
|
public type: InteractionResponseType;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2265,37 +2269,45 @@ export class MessageComponentInteraction<Cached extends CacheType = CacheType> e
|
|||||||
public inRawGuild(): this is MessageComponentInteraction<'raw'>;
|
public inRawGuild(): this is MessageComponentInteraction<'raw'>;
|
||||||
public deferReply(
|
public deferReply(
|
||||||
options: InteractionDeferReplyOptions & { withResponse: true },
|
options: InteractionDeferReplyOptions & { withResponse: true },
|
||||||
): Promise<InteractionCallbackResponse>;
|
): Promise<InteractionCallbackResponse<BooleanCache<Cached>>>;
|
||||||
public deferReply(options?: InteractionDeferReplyOptions & { withResponse: false }): Promise<undefined>;
|
public deferReply(options?: InteractionDeferReplyOptions & { withResponse: false }): Promise<undefined>;
|
||||||
public deferReply(options?: InteractionDeferReplyOptions): Promise<InteractionCallbackResponse | undefined>;
|
public deferReply(
|
||||||
|
options?: InteractionDeferReplyOptions,
|
||||||
|
): Promise<InteractionCallbackResponse<BooleanCache<Cached>> | undefined>;
|
||||||
public deferUpdate(
|
public deferUpdate(
|
||||||
options: InteractionDeferUpdateOptions & { withResponse: true },
|
options: InteractionDeferUpdateOptions & { withResponse: true },
|
||||||
): Promise<InteractionCallbackResponse>;
|
): Promise<InteractionCallbackResponse<BooleanCache<Cached>>>;
|
||||||
public deferUpdate(options?: InteractionDeferUpdateOptions & { withResponse: false }): Promise<undefined>;
|
public deferUpdate(options?: InteractionDeferUpdateOptions & { withResponse: false }): Promise<undefined>;
|
||||||
public deferUpdate(options?: InteractionDeferUpdateOptions): Promise<InteractionCallbackResponse | undefined>;
|
public deferUpdate(
|
||||||
|
options?: InteractionDeferUpdateOptions,
|
||||||
|
): Promise<InteractionCallbackResponse<BooleanCache<Cached>> | undefined>;
|
||||||
public deleteReply(message?: MessageResolvable | '@original'): Promise<void>;
|
public deleteReply(message?: MessageResolvable | '@original'): Promise<void>;
|
||||||
public editReply(
|
public editReply(
|
||||||
options: string | MessagePayload | InteractionEditReplyOptions,
|
options: string | MessagePayload | InteractionEditReplyOptions,
|
||||||
): Promise<Message<BooleanCache<Cached>>>;
|
): Promise<Message<BooleanCache<Cached>>>;
|
||||||
public fetchReply(message?: Snowflake | '@original'): Promise<Message<BooleanCache<Cached>>>;
|
public fetchReply(message?: Snowflake | '@original'): Promise<Message<BooleanCache<Cached>>>;
|
||||||
public followUp(options: string | MessagePayload | InteractionReplyOptions): Promise<Message<BooleanCache<Cached>>>;
|
public followUp(options: string | MessagePayload | InteractionReplyOptions): Promise<Message<BooleanCache<Cached>>>;
|
||||||
public reply(options: InteractionReplyOptions & { withResponse: true }): Promise<InteractionCallbackResponse>;
|
public reply(
|
||||||
|
options: InteractionReplyOptions & { withResponse: true },
|
||||||
|
): Promise<InteractionCallbackResponse<BooleanCache<Cached>>>;
|
||||||
public reply(options: InteractionReplyOptions & { withResponse: false }): Promise<undefined>;
|
public reply(options: InteractionReplyOptions & { withResponse: false }): Promise<undefined>;
|
||||||
public reply(
|
public reply(
|
||||||
options: string | MessagePayload | InteractionReplyOptions,
|
options: string | MessagePayload | InteractionReplyOptions,
|
||||||
): Promise<InteractionCallbackResponse | undefined>;
|
): Promise<InteractionCallbackResponse<BooleanCache<Cached>> | undefined>;
|
||||||
public update(options: InteractionUpdateOptions & { withResponse: true }): Promise<InteractionCallbackResponse>;
|
public update(
|
||||||
|
options: InteractionUpdateOptions & { withResponse: true },
|
||||||
|
): Promise<InteractionCallbackResponse<BooleanCache<Cached>>>;
|
||||||
public update(options: InteractionUpdateOptions & { withResponse: false }): Promise<undefined>;
|
public update(options: InteractionUpdateOptions & { withResponse: false }): Promise<undefined>;
|
||||||
public update(
|
public update(
|
||||||
options: string | MessagePayload | InteractionUpdateOptions,
|
options: string | MessagePayload | InteractionUpdateOptions,
|
||||||
): Promise<InteractionCallbackResponse | undefined>;
|
): Promise<InteractionCallbackResponse<BooleanCache<Cached>> | undefined>;
|
||||||
public showModal(
|
public showModal(
|
||||||
modal:
|
modal:
|
||||||
| JSONEncodable<APIModalInteractionResponseCallbackData>
|
| JSONEncodable<APIModalInteractionResponseCallbackData>
|
||||||
| ModalComponentData
|
| ModalComponentData
|
||||||
| APIModalInteractionResponseCallbackData,
|
| APIModalInteractionResponseCallbackData,
|
||||||
options: ShowModalOptions & { withResponse: true },
|
options: ShowModalOptions & { withResponse: true },
|
||||||
): Promise<InteractionCallbackResponse>;
|
): Promise<InteractionCallbackResponse<BooleanCache<Cached>>>;
|
||||||
public showModal(
|
public showModal(
|
||||||
modal:
|
modal:
|
||||||
| JSONEncodable<APIModalInteractionResponseCallbackData>
|
| JSONEncodable<APIModalInteractionResponseCallbackData>
|
||||||
@@ -2309,7 +2321,7 @@ export class MessageComponentInteraction<Cached extends CacheType = CacheType> e
|
|||||||
| ModalComponentData
|
| ModalComponentData
|
||||||
| APIModalInteractionResponseCallbackData,
|
| APIModalInteractionResponseCallbackData,
|
||||||
options?: ShowModalOptions,
|
options?: ShowModalOptions,
|
||||||
): Promise<InteractionCallbackResponse | undefined>;
|
): Promise<InteractionCallbackResponse<BooleanCache<Cached>> | undefined>;
|
||||||
public awaitModalSubmit(
|
public awaitModalSubmit(
|
||||||
options: AwaitModalSubmitOptions<ModalSubmitInteraction>,
|
options: AwaitModalSubmitOptions<ModalSubmitInteraction>,
|
||||||
): Promise<ModalSubmitInteraction<Cached>>;
|
): Promise<ModalSubmitInteraction<Cached>>;
|
||||||
@@ -2477,9 +2489,13 @@ export interface ModalMessageModalSubmitInteraction<Cached extends CacheType = C
|
|||||||
extends ModalSubmitInteraction<Cached> {
|
extends ModalSubmitInteraction<Cached> {
|
||||||
message: Message<BooleanCache<Cached>>;
|
message: Message<BooleanCache<Cached>>;
|
||||||
channelId: Snowflake;
|
channelId: Snowflake;
|
||||||
update(options: InteractionUpdateOptions & { withResponse: true }): Promise<InteractionCallbackResponse>;
|
update(
|
||||||
|
options: InteractionUpdateOptions & { withResponse: true },
|
||||||
|
): Promise<InteractionCallbackResponse<BooleanCache<Cached>>>;
|
||||||
update(options: InteractionUpdateOptions & { withResponse: false }): Promise<undefined>;
|
update(options: InteractionUpdateOptions & { withResponse: false }): Promise<undefined>;
|
||||||
update(options: string | MessagePayload | InteractionUpdateOptions): Promise<InteractionCallbackResponse | undefined>;
|
update(
|
||||||
|
options: string | MessagePayload | InteractionUpdateOptions,
|
||||||
|
): Promise<InteractionCallbackResponse<BooleanCache<Cached>> | undefined>;
|
||||||
inGuild(): this is ModalMessageModalSubmitInteraction<'raw' | 'cached'>;
|
inGuild(): this is ModalMessageModalSubmitInteraction<'raw' | 'cached'>;
|
||||||
inCachedGuild(): this is ModalMessageModalSubmitInteraction<'cached'>;
|
inCachedGuild(): this is ModalMessageModalSubmitInteraction<'cached'>;
|
||||||
inRawGuild(): this is ModalMessageModalSubmitInteraction<'raw'>;
|
inRawGuild(): this is ModalMessageModalSubmitInteraction<'raw'>;
|
||||||
@@ -2496,27 +2512,33 @@ export class ModalSubmitInteraction<Cached extends CacheType = CacheType> extend
|
|||||||
public message: Message<BooleanCache<Cached>> | null;
|
public message: Message<BooleanCache<Cached>> | null;
|
||||||
public replied: boolean;
|
public replied: boolean;
|
||||||
public readonly webhook: InteractionWebhook;
|
public readonly webhook: InteractionWebhook;
|
||||||
public reply(options: InteractionReplyOptions & { withResponse: true }): Promise<InteractionCallbackResponse>;
|
public reply(
|
||||||
|
options: InteractionReplyOptions & { withResponse: true },
|
||||||
|
): Promise<InteractionCallbackResponse<BooleanCache<Cached>>>;
|
||||||
public reply(options: InteractionReplyOptions & { withResponse: false }): Promise<undefined>;
|
public reply(options: InteractionReplyOptions & { withResponse: false }): Promise<undefined>;
|
||||||
public reply(
|
public reply(
|
||||||
options: string | MessagePayload | InteractionReplyOptions,
|
options: string | MessagePayload | InteractionReplyOptions,
|
||||||
): Promise<InteractionCallbackResponse | undefined>;
|
): Promise<InteractionCallbackResponse<BooleanCache<Cached>> | undefined>;
|
||||||
public deleteReply(message?: MessageResolvable | '@original'): Promise<void>;
|
public deleteReply(message?: MessageResolvable | '@original'): Promise<void>;
|
||||||
public editReply(
|
public editReply(
|
||||||
options: string | MessagePayload | InteractionEditReplyOptions,
|
options: string | MessagePayload | InteractionEditReplyOptions,
|
||||||
): Promise<Message<BooleanCache<Cached>>>;
|
): Promise<Message<BooleanCache<Cached>>>;
|
||||||
public deferReply(
|
public deferReply(
|
||||||
options: InteractionDeferReplyOptions & { withResponse: true },
|
options: InteractionDeferReplyOptions & { withResponse: true },
|
||||||
): Promise<InteractionCallbackResponse>;
|
): Promise<InteractionCallbackResponse<BooleanCache<Cached>>>;
|
||||||
public deferReply(options?: InteractionDeferReplyOptions & { withResponse: false }): Promise<undefined>;
|
public deferReply(options?: InteractionDeferReplyOptions & { withResponse: false }): Promise<undefined>;
|
||||||
public deferReply(options?: InteractionDeferReplyOptions): Promise<InteractionCallbackResponse | undefined>;
|
public deferReply(
|
||||||
|
options?: InteractionDeferReplyOptions,
|
||||||
|
): Promise<InteractionCallbackResponse<BooleanCache<Cached>> | undefined>;
|
||||||
public fetchReply(message?: Snowflake | '@original'): Promise<Message<BooleanCache<Cached>>>;
|
public fetchReply(message?: Snowflake | '@original'): Promise<Message<BooleanCache<Cached>>>;
|
||||||
public followUp(options: string | MessagePayload | InteractionReplyOptions): Promise<Message<BooleanCache<Cached>>>;
|
public followUp(options: string | MessagePayload | InteractionReplyOptions): Promise<Message<BooleanCache<Cached>>>;
|
||||||
public deferUpdate(
|
public deferUpdate(
|
||||||
options: InteractionDeferUpdateOptions & { withResponse: true },
|
options: InteractionDeferUpdateOptions & { withResponse: true },
|
||||||
): Promise<InteractionCallbackResponse>;
|
): Promise<InteractionCallbackResponse<BooleanCache<Cached>>>;
|
||||||
public deferUpdate(options?: InteractionDeferUpdateOptions & { withResponse: false }): Promise<undefined>;
|
public deferUpdate(options?: InteractionDeferUpdateOptions & { withResponse: false }): Promise<undefined>;
|
||||||
public deferUpdate(options?: InteractionDeferUpdateOptions): Promise<InteractionCallbackResponse | undefined>;
|
public deferUpdate(
|
||||||
|
options?: InteractionDeferUpdateOptions,
|
||||||
|
): Promise<InteractionCallbackResponse<BooleanCache<Cached>> | undefined>;
|
||||||
public inGuild(): this is ModalSubmitInteraction<'raw' | 'cached'>;
|
public inGuild(): this is ModalSubmitInteraction<'raw' | 'cached'>;
|
||||||
public inCachedGuild(): this is ModalSubmitInteraction<'cached'>;
|
public inCachedGuild(): this is ModalSubmitInteraction<'cached'>;
|
||||||
public inRawGuild(): this is ModalSubmitInteraction<'raw'>;
|
public inRawGuild(): this is ModalSubmitInteraction<'raw'>;
|
||||||
|
|||||||
@@ -450,7 +450,7 @@ client.on('messageCreate', async message => {
|
|||||||
expectAssignable<Message<true>>(message);
|
expectAssignable<Message<true>>(message);
|
||||||
const component = await message.awaitMessageComponent({ componentType: ComponentType.Button });
|
const component = await message.awaitMessageComponent({ componentType: ComponentType.Button });
|
||||||
expectType<ButtonInteraction<'cached'>>(component);
|
expectType<ButtonInteraction<'cached'>>(component);
|
||||||
expectType<InteractionCallbackResponse>(await component.reply({ withResponse: true }));
|
expectType<InteractionCallbackResponse<true>>(await component.reply({ withResponse: true }));
|
||||||
|
|
||||||
const buttonCollector = message.createMessageComponentCollector({ componentType: ComponentType.Button });
|
const buttonCollector = message.createMessageComponentCollector({ componentType: ComponentType.Button });
|
||||||
expectType<InteractionCollector<ButtonInteraction<'cached'>>>(buttonCollector);
|
expectType<InteractionCollector<ButtonInteraction<'cached'>>>(buttonCollector);
|
||||||
@@ -1878,21 +1878,21 @@ client.on('interactionCreate', async interaction => {
|
|||||||
expectType<MessageActionRowComponent>(interaction.component);
|
expectType<MessageActionRowComponent>(interaction.component);
|
||||||
expectType<Message<true>>(interaction.message);
|
expectType<Message<true>>(interaction.message);
|
||||||
expectType<Guild>(interaction.guild);
|
expectType<Guild>(interaction.guild);
|
||||||
expectType<Promise<InteractionCallbackResponse>>(interaction.reply({ content: 'a', withResponse: true }));
|
expectType<Promise<InteractionCallbackResponse<true>>>(interaction.reply({ content: 'a', withResponse: true }));
|
||||||
expectType<Promise<InteractionCallbackResponse>>(interaction.deferReply({ withResponse: true }));
|
expectType<Promise<InteractionCallbackResponse<true>>>(interaction.deferReply({ withResponse: true }));
|
||||||
expectType<Promise<undefined>>(interaction.deferReply());
|
expectType<Promise<undefined>>(interaction.deferReply());
|
||||||
expectType<Promise<undefined>>(interaction.reply({ content: 'a', withResponse: false }));
|
expectType<Promise<undefined>>(interaction.reply({ content: 'a', withResponse: false }));
|
||||||
expectType<Promise<undefined>>(interaction.deferReply({ withResponse: false }));
|
expectType<Promise<undefined>>(interaction.deferReply({ withResponse: false }));
|
||||||
expectType<Promise<InteractionCallbackResponse | undefined>>(
|
expectType<Promise<InteractionCallbackResponse<true> | undefined>>(
|
||||||
interaction.reply({ content: 'a', withResponse: booleanValue }),
|
interaction.reply({ content: 'a', withResponse: booleanValue }),
|
||||||
);
|
);
|
||||||
expectType<Promise<InteractionCallbackResponse | undefined>>(
|
expectType<Promise<InteractionCallbackResponse<true> | undefined>>(
|
||||||
interaction.deferReply({ withResponse: booleanValue }),
|
interaction.deferReply({ withResponse: booleanValue }),
|
||||||
);
|
);
|
||||||
expectType<Promise<Message<true>>>(interaction.editReply({ content: 'a' }));
|
expectType<Promise<Message<true>>>(interaction.editReply({ content: 'a' }));
|
||||||
expectType<Promise<Message<true>>>(interaction.fetchReply());
|
expectType<Promise<Message<true>>>(interaction.fetchReply());
|
||||||
expectType<Promise<InteractionCallbackResponse>>(interaction.update({ content: 'a', withResponse: true }));
|
expectType<Promise<InteractionCallbackResponse<true>>>(interaction.update({ content: 'a', withResponse: true }));
|
||||||
expectType<Promise<InteractionCallbackResponse>>(interaction.deferUpdate({ withResponse: true }));
|
expectType<Promise<InteractionCallbackResponse<true>>>(interaction.deferUpdate({ withResponse: true }));
|
||||||
expectType<Promise<undefined>>(interaction.deferUpdate());
|
expectType<Promise<undefined>>(interaction.deferUpdate());
|
||||||
expectType<Promise<Message<true>>>(interaction.followUp({ content: 'a' }));
|
expectType<Promise<Message<true>>>(interaction.followUp({ content: 'a' }));
|
||||||
} else if (interaction.inRawGuild()) {
|
} else if (interaction.inRawGuild()) {
|
||||||
@@ -1900,25 +1900,25 @@ client.on('interactionCreate', async interaction => {
|
|||||||
expectType<APIButtonComponent | APISelectMenuComponent>(interaction.component);
|
expectType<APIButtonComponent | APISelectMenuComponent>(interaction.component);
|
||||||
expectType<Message<false>>(interaction.message);
|
expectType<Message<false>>(interaction.message);
|
||||||
expectType<null>(interaction.guild);
|
expectType<null>(interaction.guild);
|
||||||
expectType<Promise<InteractionCallbackResponse>>(interaction.reply({ content: 'a', withResponse: true }));
|
expectType<Promise<InteractionCallbackResponse<false>>>(interaction.reply({ content: 'a', withResponse: true }));
|
||||||
expectType<Promise<InteractionCallbackResponse>>(interaction.deferReply({ withResponse: true }));
|
expectType<Promise<InteractionCallbackResponse<false>>>(interaction.deferReply({ withResponse: true }));
|
||||||
expectType<Promise<undefined>>(interaction.reply({ content: 'a', withResponse: false }));
|
expectType<Promise<undefined>>(interaction.reply({ content: 'a', withResponse: false }));
|
||||||
expectType<Promise<undefined>>(interaction.deferReply({ withResponse: false }));
|
expectType<Promise<undefined>>(interaction.deferReply({ withResponse: false }));
|
||||||
expectType<Promise<undefined>>(interaction.deferReply());
|
expectType<Promise<undefined>>(interaction.deferReply());
|
||||||
expectType<Promise<InteractionCallbackResponse | undefined>>(
|
expectType<Promise<InteractionCallbackResponse<false> | undefined>>(
|
||||||
interaction.reply({ content: 'a', withResponse: booleanValue }),
|
interaction.reply({ content: 'a', withResponse: booleanValue }),
|
||||||
);
|
);
|
||||||
expectType<Promise<InteractionCallbackResponse | undefined>>(
|
expectType<Promise<InteractionCallbackResponse<false> | undefined>>(
|
||||||
interaction.deferReply({ withResponse: booleanValue }),
|
interaction.deferReply({ withResponse: booleanValue }),
|
||||||
);
|
);
|
||||||
expectType<Promise<Message<false>>>(interaction.editReply({ content: 'a' }));
|
expectType<Promise<Message<false>>>(interaction.editReply({ content: 'a' }));
|
||||||
expectType<Promise<Message<false>>>(interaction.fetchReply());
|
expectType<Promise<Message<false>>>(interaction.fetchReply());
|
||||||
expectType<Promise<InteractionCallbackResponse>>(interaction.update({ content: 'a', withResponse: true }));
|
expectType<Promise<InteractionCallbackResponse<false>>>(interaction.update({ content: 'a', withResponse: true }));
|
||||||
expectType<Promise<undefined>>(interaction.update({ content: 'a', withResponse: false }));
|
expectType<Promise<undefined>>(interaction.update({ content: 'a', withResponse: false }));
|
||||||
expectType<Promise<InteractionCallbackResponse | undefined>>(
|
expectType<Promise<InteractionCallbackResponse<false> | undefined>>(
|
||||||
interaction.update({ content: 'a', withResponse: booleanValue }),
|
interaction.update({ content: 'a', withResponse: booleanValue }),
|
||||||
);
|
);
|
||||||
expectType<Promise<InteractionCallbackResponse>>(interaction.deferUpdate({ withResponse: true }));
|
expectType<Promise<InteractionCallbackResponse<false>>>(interaction.deferUpdate({ withResponse: true }));
|
||||||
expectType<Promise<undefined>>(interaction.deferUpdate());
|
expectType<Promise<undefined>>(interaction.deferUpdate());
|
||||||
expectType<Promise<Message<false>>>(interaction.followUp({ content: 'a' }));
|
expectType<Promise<Message<false>>>(interaction.followUp({ content: 'a' }));
|
||||||
} else if (interaction.inGuild()) {
|
} else if (interaction.inGuild()) {
|
||||||
@@ -1979,15 +1979,15 @@ client.on('interactionCreate', async interaction => {
|
|||||||
expectAssignable<ContextMenuCommandInteraction>(interaction);
|
expectAssignable<ContextMenuCommandInteraction>(interaction);
|
||||||
expectAssignable<Guild>(interaction.guild);
|
expectAssignable<Guild>(interaction.guild);
|
||||||
expectAssignable<CommandInteraction<'cached'>>(interaction);
|
expectAssignable<CommandInteraction<'cached'>>(interaction);
|
||||||
expectType<Promise<InteractionCallbackResponse>>(interaction.reply({ content: 'a', withResponse: true }));
|
expectType<Promise<InteractionCallbackResponse<true>>>(interaction.reply({ content: 'a', withResponse: true }));
|
||||||
expectType<Promise<InteractionCallbackResponse>>(interaction.deferReply({ withResponse: true }));
|
expectType<Promise<InteractionCallbackResponse<true>>>(interaction.deferReply({ withResponse: true }));
|
||||||
expectType<Promise<undefined>>(interaction.deferReply());
|
expectType<Promise<undefined>>(interaction.deferReply());
|
||||||
expectType<Promise<undefined>>(interaction.reply({ content: 'a', withResponse: false }));
|
expectType<Promise<undefined>>(interaction.reply({ content: 'a', withResponse: false }));
|
||||||
expectType<Promise<undefined>>(interaction.deferReply({ withResponse: false }));
|
expectType<Promise<undefined>>(interaction.deferReply({ withResponse: false }));
|
||||||
expectType<Promise<InteractionCallbackResponse | undefined>>(
|
expectType<Promise<InteractionCallbackResponse<true> | undefined>>(
|
||||||
interaction.reply({ content: 'a', withResponse: booleanValue }),
|
interaction.reply({ content: 'a', withResponse: booleanValue }),
|
||||||
);
|
);
|
||||||
expectType<Promise<InteractionCallbackResponse | undefined>>(
|
expectType<Promise<InteractionCallbackResponse<true> | undefined>>(
|
||||||
interaction.deferReply({ withResponse: booleanValue }),
|
interaction.deferReply({ withResponse: booleanValue }),
|
||||||
);
|
);
|
||||||
expectType<Promise<Message<true>>>(interaction.editReply({ content: 'a' }));
|
expectType<Promise<Message<true>>>(interaction.editReply({ content: 'a' }));
|
||||||
@@ -1996,15 +1996,15 @@ client.on('interactionCreate', async interaction => {
|
|||||||
} else if (interaction.inRawGuild()) {
|
} else if (interaction.inRawGuild()) {
|
||||||
expectAssignable<ContextMenuCommandInteraction>(interaction);
|
expectAssignable<ContextMenuCommandInteraction>(interaction);
|
||||||
expectType<null>(interaction.guild);
|
expectType<null>(interaction.guild);
|
||||||
expectType<Promise<InteractionCallbackResponse>>(interaction.reply({ content: 'a', withResponse: true }));
|
expectType<Promise<InteractionCallbackResponse<false>>>(interaction.reply({ content: 'a', withResponse: true }));
|
||||||
expectType<Promise<InteractionCallbackResponse>>(interaction.deferReply({ withResponse: true }));
|
expectType<Promise<InteractionCallbackResponse<false>>>(interaction.deferReply({ withResponse: true }));
|
||||||
expectType<Promise<undefined>>(interaction.deferReply());
|
expectType<Promise<undefined>>(interaction.deferReply());
|
||||||
expectType<Promise<undefined>>(interaction.reply({ content: 'a', withResponse: false }));
|
expectType<Promise<undefined>>(interaction.reply({ content: 'a', withResponse: false }));
|
||||||
expectType<Promise<undefined>>(interaction.deferReply({ withResponse: false }));
|
expectType<Promise<undefined>>(interaction.deferReply({ withResponse: false }));
|
||||||
expectType<Promise<InteractionCallbackResponse | undefined>>(
|
expectType<Promise<InteractionCallbackResponse<false> | undefined>>(
|
||||||
interaction.reply({ content: 'a', withResponse: booleanValue }),
|
interaction.reply({ content: 'a', withResponse: booleanValue }),
|
||||||
);
|
);
|
||||||
expectType<Promise<InteractionCallbackResponse | undefined>>(
|
expectType<Promise<InteractionCallbackResponse<false> | undefined>>(
|
||||||
interaction.deferReply({ withResponse: booleanValue }),
|
interaction.deferReply({ withResponse: booleanValue }),
|
||||||
);
|
);
|
||||||
expectType<Promise<Message<false>>>(interaction.editReply({ content: 'a' }));
|
expectType<Promise<Message<false>>>(interaction.editReply({ content: 'a' }));
|
||||||
@@ -2077,13 +2077,13 @@ client.on('interactionCreate', async interaction => {
|
|||||||
expectType<ButtonComponent>(interaction.component);
|
expectType<ButtonComponent>(interaction.component);
|
||||||
expectType<Message<true>>(interaction.message);
|
expectType<Message<true>>(interaction.message);
|
||||||
expectType<Guild>(interaction.guild);
|
expectType<Guild>(interaction.guild);
|
||||||
expectType<Promise<InteractionCallbackResponse>>(interaction.reply({ withResponse: true }));
|
expectType<Promise<InteractionCallbackResponse<true>>>(interaction.reply({ withResponse: true }));
|
||||||
} else if (interaction.inRawGuild()) {
|
} else if (interaction.inRawGuild()) {
|
||||||
expectAssignable<ButtonInteraction>(interaction);
|
expectAssignable<ButtonInteraction>(interaction);
|
||||||
expectType<APIButtonComponent>(interaction.component);
|
expectType<APIButtonComponent>(interaction.component);
|
||||||
expectType<Message<false>>(interaction.message);
|
expectType<Message<false>>(interaction.message);
|
||||||
expectType<null>(interaction.guild);
|
expectType<null>(interaction.guild);
|
||||||
expectType<Promise<InteractionCallbackResponse>>(interaction.reply({ withResponse: true }));
|
expectType<Promise<InteractionCallbackResponse<false>>>(interaction.reply({ withResponse: true }));
|
||||||
} else if (interaction.inGuild()) {
|
} else if (interaction.inGuild()) {
|
||||||
expectAssignable<ButtonInteraction>(interaction);
|
expectAssignable<ButtonInteraction>(interaction);
|
||||||
expectType<ButtonComponent | APIButtonComponent>(interaction.component);
|
expectType<ButtonComponent | APIButtonComponent>(interaction.component);
|
||||||
@@ -2105,13 +2105,13 @@ client.on('interactionCreate', async interaction => {
|
|||||||
expectType<StringSelectMenuComponent>(interaction.component);
|
expectType<StringSelectMenuComponent>(interaction.component);
|
||||||
expectType<Message<true>>(interaction.message);
|
expectType<Message<true>>(interaction.message);
|
||||||
expectType<Guild>(interaction.guild);
|
expectType<Guild>(interaction.guild);
|
||||||
expectType<Promise<InteractionCallbackResponse>>(interaction.reply({ withResponse: true }));
|
expectType<Promise<InteractionCallbackResponse<true>>>(interaction.reply({ withResponse: true }));
|
||||||
} else if (interaction.inRawGuild()) {
|
} else if (interaction.inRawGuild()) {
|
||||||
expectAssignable<StringSelectMenuInteraction>(interaction);
|
expectAssignable<StringSelectMenuInteraction>(interaction);
|
||||||
expectType<APIStringSelectComponent>(interaction.component);
|
expectType<APIStringSelectComponent>(interaction.component);
|
||||||
expectType<Message<false>>(interaction.message);
|
expectType<Message<false>>(interaction.message);
|
||||||
expectType<null>(interaction.guild);
|
expectType<null>(interaction.guild);
|
||||||
expectType<Promise<InteractionCallbackResponse>>(interaction.reply({ withResponse: true }));
|
expectType<Promise<InteractionCallbackResponse<false>>>(interaction.reply({ withResponse: true }));
|
||||||
} else if (interaction.inGuild()) {
|
} else if (interaction.inGuild()) {
|
||||||
expectAssignable<StringSelectMenuInteraction>(interaction);
|
expectAssignable<StringSelectMenuInteraction>(interaction);
|
||||||
expectType<StringSelectMenuComponent | APIStringSelectComponent>(interaction.component);
|
expectType<StringSelectMenuComponent | APIStringSelectComponent>(interaction.component);
|
||||||
@@ -2128,7 +2128,7 @@ client.on('interactionCreate', async interaction => {
|
|||||||
if (interaction.inRawGuild()) {
|
if (interaction.inRawGuild()) {
|
||||||
expectNotAssignable<Interaction<'cached'>>(interaction);
|
expectNotAssignable<Interaction<'cached'>>(interaction);
|
||||||
expectAssignable<ChatInputCommandInteraction>(interaction);
|
expectAssignable<ChatInputCommandInteraction>(interaction);
|
||||||
expectType<Promise<InteractionCallbackResponse>>(interaction.reply({ withResponse: true }));
|
expectType<Promise<InteractionCallbackResponse<false>>>(interaction.reply({ withResponse: true }));
|
||||||
expectType<APIInteractionDataResolvedGuildMember | null>(interaction.options.getMember('test'));
|
expectType<APIInteractionDataResolvedGuildMember | null>(interaction.options.getMember('test'));
|
||||||
|
|
||||||
expectType<APIInteractionDataResolvedChannel>(interaction.options.getChannel('test', true));
|
expectType<APIInteractionDataResolvedChannel>(interaction.options.getChannel('test', true));
|
||||||
@@ -2136,7 +2136,7 @@ client.on('interactionCreate', async interaction => {
|
|||||||
} else if (interaction.inCachedGuild()) {
|
} else if (interaction.inCachedGuild()) {
|
||||||
expectType<GuildMember | null>(interaction.options.getMember('test'));
|
expectType<GuildMember | null>(interaction.options.getMember('test'));
|
||||||
expectAssignable<ChatInputCommandInteraction>(interaction);
|
expectAssignable<ChatInputCommandInteraction>(interaction);
|
||||||
expectType<Promise<InteractionCallbackResponse>>(interaction.reply({ withResponse: true }));
|
expectType<Promise<InteractionCallbackResponse<true>>>(interaction.reply({ withResponse: true }));
|
||||||
|
|
||||||
expectType<GuildBasedChannel>(interaction.options.getChannel('test', true));
|
expectType<GuildBasedChannel>(interaction.options.getChannel('test', true));
|
||||||
expectType<Role>(interaction.options.getRole('test', true));
|
expectType<Role>(interaction.options.getRole('test', true));
|
||||||
@@ -2215,23 +2215,23 @@ client.on('interactionCreate', async interaction => {
|
|||||||
if (interaction.inCachedGuild()) {
|
if (interaction.inCachedGuild()) {
|
||||||
expectAssignable<ModalSubmitInteraction>(interaction);
|
expectAssignable<ModalSubmitInteraction>(interaction);
|
||||||
expectType<Guild>(interaction.guild);
|
expectType<Guild>(interaction.guild);
|
||||||
expectType<Promise<InteractionCallbackResponse>>(interaction.reply({ content: 'a', withResponse: true }));
|
expectType<Promise<InteractionCallbackResponse<true>>>(interaction.reply({ content: 'a', withResponse: true }));
|
||||||
expectType<Promise<InteractionCallbackResponse>>(interaction.deferReply({ withResponse: true }));
|
expectType<Promise<InteractionCallbackResponse<true>>>(interaction.deferReply({ withResponse: true }));
|
||||||
expectType<Promise<undefined>>(interaction.deferReply());
|
expectType<Promise<undefined>>(interaction.deferReply());
|
||||||
expectType<Promise<Message<true>>>(interaction.editReply({ content: 'a' }));
|
expectType<Promise<Message<true>>>(interaction.editReply({ content: 'a' }));
|
||||||
expectType<Promise<Message<true>>>(interaction.fetchReply());
|
expectType<Promise<Message<true>>>(interaction.fetchReply());
|
||||||
expectType<Promise<InteractionCallbackResponse>>(interaction.deferUpdate({ withResponse: true }));
|
expectType<Promise<InteractionCallbackResponse<true>>>(interaction.deferUpdate({ withResponse: true }));
|
||||||
expectType<Promise<undefined>>(interaction.deferUpdate());
|
expectType<Promise<undefined>>(interaction.deferUpdate());
|
||||||
expectType<Promise<Message<true>>>(interaction.followUp({ content: 'a' }));
|
expectType<Promise<Message<true>>>(interaction.followUp({ content: 'a' }));
|
||||||
} else if (interaction.inRawGuild()) {
|
} else if (interaction.inRawGuild()) {
|
||||||
expectAssignable<ModalSubmitInteraction>(interaction);
|
expectAssignable<ModalSubmitInteraction>(interaction);
|
||||||
expectType<null>(interaction.guild);
|
expectType<null>(interaction.guild);
|
||||||
expectType<Promise<InteractionCallbackResponse>>(interaction.reply({ content: 'a', withResponse: true }));
|
expectType<Promise<InteractionCallbackResponse<false>>>(interaction.reply({ content: 'a', withResponse: true }));
|
||||||
expectType<Promise<InteractionCallbackResponse>>(interaction.deferReply({ withResponse: true }));
|
expectType<Promise<InteractionCallbackResponse<false>>>(interaction.deferReply({ withResponse: true }));
|
||||||
expectType<Promise<undefined>>(interaction.deferReply());
|
expectType<Promise<undefined>>(interaction.deferReply());
|
||||||
expectType<Promise<Message<false>>>(interaction.editReply({ content: 'a' }));
|
expectType<Promise<Message<false>>>(interaction.editReply({ content: 'a' }));
|
||||||
expectType<Promise<Message<false>>>(interaction.fetchReply());
|
expectType<Promise<Message<false>>>(interaction.fetchReply());
|
||||||
expectType<Promise<InteractionCallbackResponse>>(interaction.deferUpdate({ withResponse: true }));
|
expectType<Promise<InteractionCallbackResponse<false>>>(interaction.deferUpdate({ withResponse: true }));
|
||||||
expectType<Promise<undefined>>(interaction.deferUpdate());
|
expectType<Promise<undefined>>(interaction.deferUpdate());
|
||||||
expectType<Promise<Message<false>>>(interaction.followUp({ content: 'a' }));
|
expectType<Promise<Message<false>>>(interaction.followUp({ content: 'a' }));
|
||||||
} else if (interaction.inGuild()) {
|
} else if (interaction.inGuild()) {
|
||||||
|
|||||||
Reference in New Issue
Block a user