Skip to content

Commit 19e74b1

Browse files
authored
types(InteractionCallbackResponse): add missing InGuild generic (#10963)
1 parent de22a10 commit 19e74b1

File tree

2 files changed

+86
-64
lines changed

2 files changed

+86
-64
lines changed

packages/discord.js/typings/index.d.ts

Lines changed: 45 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -599,7 +599,7 @@ export abstract class CommandInteraction<Cached extends CacheType = CacheType> e
599599
public inRawGuild(): this is CommandInteraction<'raw'>;
600600
public deferReply(
601601
options: InteractionDeferReplyOptions & { withResponse: true },
602-
): Promise<InteractionCallbackResponse>;
602+
): Promise<InteractionCallbackResponse<BooleanCache<Cached>>>;
603603
/** @deprecated `fetchReply` is deprecated. Use `withResponse` instead or fetch the response after using the method. */
604604
public deferReply(
605605
options: InteractionDeferReplyOptions & { fetchReply: true },
@@ -611,29 +611,35 @@ export abstract class CommandInteraction<Cached extends CacheType = CacheType> e
611611
): Promise<Message<BooleanCache<Cached>>>;
612612
public fetchReply(message?: Snowflake | '@original'): Promise<Message<BooleanCache<Cached>>>;
613613
public followUp(options: string | MessagePayload | InteractionReplyOptions): Promise<Message<BooleanCache<Cached>>>;
614-
public reply(options: InteractionReplyOptions & { withResponse: true }): Promise<InteractionCallbackResponse>;
614+
public reply(
615+
options: InteractionReplyOptions & { withResponse: true },
616+
): Promise<InteractionCallbackResponse<BooleanCache<Cached>>>;
615617
/** @deprecated `fetchReply` is deprecated. Use `withResponse` instead or fetch the response after using the method. */
616618
public reply(options: InteractionReplyOptions & { fetchReply: true }): Promise<Message<BooleanCache<Cached>>>;
617619
public reply(
618620
options: string | MessagePayload | InteractionReplyOptions,
619621
): Promise<InteractionResponse<BooleanCache<Cached>>>;
620-
public launchActivity(options: LaunchActivityOptions & { withResponse: true }): Promise<InteractionCallbackResponse>;
622+
public launchActivity(
623+
options: LaunchActivityOptions & { withResponse: true },
624+
): Promise<InteractionCallbackResponse<BooleanCache<Cached>>>;
621625
public launchActivity(options?: LaunchActivityOptions & { withResponse?: false }): Promise<undefined>;
622-
public launchActivity(options?: LaunchActivityOptions): Promise<InteractionCallbackResponse | undefined>;
626+
public launchActivity(
627+
options?: LaunchActivityOptions,
628+
): Promise<InteractionCallbackResponse<BooleanCache<Cached>> | undefined>;
623629
public showModal(
624630
modal:
625631
| JSONEncodable<APIModalInteractionResponseCallbackData>
626632
| ModalComponentData
627633
| APIModalInteractionResponseCallbackData,
628634
options: ShowModalOptions & { withResponse: true },
629-
): Promise<InteractionCallbackResponse>;
635+
): Promise<InteractionCallbackResponse<BooleanCache<Cached>>>;
630636
public showModal(
631637
modal:
632638
| JSONEncodable<APIModalInteractionResponseCallbackData>
633639
| ModalComponentData
634640
| APIModalInteractionResponseCallbackData,
635641
options?: ShowModalOptions & { withResponse: true },
636-
): Promise<InteractionCallbackResponse>;
642+
): Promise<InteractionCallbackResponse<BooleanCache<Cached>>>;
637643
public showModal(
638644
modal:
639645
| JSONEncodable<APIModalInteractionResponseCallbackData>
@@ -2159,17 +2165,17 @@ export class InteractionCallback {
21592165
public type: InteractionType;
21602166
}
21612167

2162-
export class InteractionCallbackResponse {
2168+
export class InteractionCallbackResponse<InGuild extends boolean = boolean> {
21632169
private constructor(client: Client<true>, data: RESTPostAPIInteractionCallbackWithResponseResult);
21642170
public readonly client: Client<true>;
21652171
public interaction: InteractionCallback;
2166-
public resource: InteractionCallbackResource | null;
2172+
public resource: InteractionCallbackResource<InGuild> | null;
21672173
}
21682174

2169-
export class InteractionCallbackResource {
2175+
export class InteractionCallbackResource<InGuild extends boolean = boolean> {
21702176
private constructor(client: Client<true>, data: RESTAPIInteractionCallbackResourceObject);
21712177
public activityInstance: RESTAPIInteractionCallbackActivityInstanceResource | null;
2172-
public message: Message | null;
2178+
public message: Message<InGuild> | null;
21732179
public type: InteractionResponseType;
21742180
}
21752181

@@ -2526,15 +2532,15 @@ export class MessageComponentInteraction<Cached extends CacheType = CacheType> e
25262532
public inRawGuild(): this is MessageComponentInteraction<'raw'>;
25272533
public deferReply(
25282534
options: InteractionDeferReplyOptions & { withResponse: true },
2529-
): Promise<InteractionCallbackResponse>;
2535+
): Promise<InteractionCallbackResponse<BooleanCache<Cached>>>;
25302536
/** @deprecated `fetchReply` is deprecated. Use `withResponse` instead or fetch the response after using the method. */
25312537
public deferReply(
25322538
options: InteractionDeferReplyOptions & { fetchReply: true },
25332539
): Promise<Message<BooleanCache<Cached>>>;
25342540
public deferReply(options?: InteractionDeferReplyOptions): Promise<InteractionResponse<BooleanCache<Cached>>>;
25352541
public deferUpdate(
25362542
options: InteractionDeferUpdateOptions & { withResponse: true },
2537-
): Promise<InteractionCallbackResponse>;
2543+
): Promise<InteractionCallbackResponse<BooleanCache<Cached>>>;
25382544
/** @deprecated `fetchReply` is deprecated. Use `withResponse` instead or fetch the response after using the method. */
25392545
public deferUpdate(
25402546
options: InteractionDeferUpdateOptions & { fetchReply: true },
@@ -2546,28 +2552,36 @@ export class MessageComponentInteraction<Cached extends CacheType = CacheType> e
25462552
): Promise<Message<BooleanCache<Cached>>>;
25472553
public fetchReply(message?: Snowflake | '@original'): Promise<Message<BooleanCache<Cached>>>;
25482554
public followUp(options: string | MessagePayload | InteractionReplyOptions): Promise<Message<BooleanCache<Cached>>>;
2549-
public reply(options: InteractionReplyOptions & { withResponse: true }): Promise<InteractionCallbackResponse>;
2555+
public reply(
2556+
options: InteractionReplyOptions & { withResponse: true },
2557+
): Promise<InteractionCallbackResponse<BooleanCache<Cached>>>;
25502558
/** @deprecated `fetchReply` is deprecated. Use `withResponse` instead or fetch the response after using the method. */
25512559
public reply(options: InteractionReplyOptions & { fetchReply: true }): Promise<Message<BooleanCache<Cached>>>;
25522560
public reply(
25532561
options: string | MessagePayload | InteractionReplyOptions,
25542562
): Promise<InteractionResponse<BooleanCache<Cached>>>;
2555-
public update(options: InteractionUpdateOptions & { withResponse: true }): Promise<InteractionCallbackResponse>;
2563+
public update(
2564+
options: InteractionUpdateOptions & { withResponse: true },
2565+
): Promise<InteractionCallbackResponse<BooleanCache<Cached>>>;
25562566
/** @deprecated `fetchReply` is deprecated. Use `withResponse` instead or fetch the response after using the method. */
25572567
public update(options: InteractionUpdateOptions & { fetchReply: true }): Promise<Message<BooleanCache<Cached>>>;
25582568
public update(
25592569
options: string | MessagePayload | InteractionUpdateOptions,
25602570
): Promise<InteractionResponse<BooleanCache<Cached>>>;
2561-
public launchActivity(options: LaunchActivityOptions & { withResponse: true }): Promise<InteractionCallbackResponse>;
2571+
public launchActivity(
2572+
options: LaunchActivityOptions & { withResponse: true },
2573+
): Promise<InteractionCallbackResponse<BooleanCache<Cached>>>;
25622574
public launchActivity(options?: LaunchActivityOptions & { withResponse?: false }): Promise<undefined>;
2563-
public launchActivity(options?: LaunchActivityOptions): Promise<InteractionCallbackResponse | undefined>;
2575+
public launchActivity(
2576+
options?: LaunchActivityOptions,
2577+
): Promise<InteractionCallbackResponse<BooleanCache<Cached>> | undefined>;
25642578
public showModal(
25652579
modal:
25662580
| JSONEncodable<APIModalInteractionResponseCallbackData>
25672581
| ModalComponentData
25682582
| APIModalInteractionResponseCallbackData,
25692583
options: ShowModalOptions & { withResponse: true },
2570-
): Promise<InteractionCallbackResponse>;
2584+
): Promise<InteractionCallbackResponse<BooleanCache<Cached>>>;
25712585
public showModal(
25722586
modal:
25732587
| JSONEncodable<APIModalInteractionResponseCallbackData>
@@ -2755,7 +2769,9 @@ export interface ModalMessageModalSubmitInteraction<Cached extends CacheType = C
27552769
extends ModalSubmitInteraction<Cached> {
27562770
message: Message<BooleanCache<Cached>>;
27572771
channelId: Snowflake;
2758-
update(options: InteractionUpdateOptions & { withResponse: true }): Promise<InteractionCallbackResponse>;
2772+
update(
2773+
options: InteractionUpdateOptions & { withResponse: true },
2774+
): Promise<InteractionCallbackResponse<BooleanCache<Cached>>>;
27592775
/** @deprecated `fetchReply` is deprecated. Use `withResponse` instead or fetch the response after using the method. */
27602776
update(options: InteractionUpdateOptions & { fetchReply: true }): Promise<Message>;
27612777
update(
@@ -2777,7 +2793,9 @@ export class ModalSubmitInteraction<Cached extends CacheType = CacheType> extend
27772793
public message: Message<BooleanCache<Cached>> | null;
27782794
public replied: boolean;
27792795
public readonly webhook: InteractionWebhook;
2780-
public reply(options: InteractionReplyOptions & { withResponse: true }): Promise<InteractionCallbackResponse>;
2796+
public reply(
2797+
options: InteractionReplyOptions & { withResponse: true },
2798+
): Promise<InteractionCallbackResponse<BooleanCache<Cached>>>;
27812799
/** @deprecated `fetchReply` is deprecated. Use `withResponse` instead or fetch the response after using the method. */
27822800
public reply(options: InteractionReplyOptions & { fetchReply: true }): Promise<Message<BooleanCache<Cached>>>;
27832801
public reply(
@@ -2789,7 +2807,7 @@ export class ModalSubmitInteraction<Cached extends CacheType = CacheType> extend
27892807
): Promise<Message<BooleanCache<Cached>>>;
27902808
public deferReply(
27912809
options: InteractionDeferReplyOptions & { withResponse: true },
2792-
): Promise<InteractionCallbackResponse>;
2810+
): Promise<InteractionCallbackResponse<BooleanCache<Cached>>>;
27932811
/** @deprecated `fetchReply` is deprecated. Use `withResponse` instead or fetch the response after using the method. */
27942812
public deferReply(
27952813
options: InteractionDeferReplyOptions & { fetchReply: true },
@@ -2799,17 +2817,21 @@ export class ModalSubmitInteraction<Cached extends CacheType = CacheType> extend
27992817
public followUp(options: string | MessagePayload | InteractionReplyOptions): Promise<Message<BooleanCache<Cached>>>;
28002818
public deferUpdate(
28012819
options: InteractionDeferUpdateOptions & { withResponse: true },
2802-
): Promise<InteractionCallbackResponse>;
2820+
): Promise<InteractionCallbackResponse<BooleanCache<Cached>>>;
28032821
/** @deprecated `fetchReply` is deprecated. Use `withResponse` instead or fetch the response after using the method. */
28042822
public deferUpdate(
28052823
options: InteractionDeferUpdateOptions & { fetchReply: true },
28062824
): Promise<Message<BooleanCache<Cached>>>;
28072825
public deferUpdate(options?: InteractionDeferUpdateOptions): Promise<InteractionResponse<BooleanCache<Cached>>>;
28082826
/** @deprecated Sending a premium-style button is the new Discord behaviour. */
28092827
public sendPremiumRequired(): Promise<void>;
2810-
public launchActivity(options: LaunchActivityOptions & { withResponse: true }): Promise<InteractionCallbackResponse>;
2828+
public launchActivity(
2829+
options: LaunchActivityOptions & { withResponse: true },
2830+
): Promise<InteractionCallbackResponse<BooleanCache<Cached>>>;
28112831
public launchActivity(options?: LaunchActivityOptions & { withResponse?: false }): Promise<undefined>;
2812-
public launchActivity(options?: LaunchActivityOptions): Promise<InteractionCallbackResponse | undefined>;
2832+
public launchActivity(
2833+
options?: LaunchActivityOptions,
2834+
): Promise<InteractionCallbackResponse<BooleanCache<Cached>> | undefined>;
28132835
public inGuild(): this is ModalSubmitInteraction<'raw' | 'cached'>;
28142836
public inCachedGuild(): this is ModalSubmitInteraction<'cached'>;
28152837
public inRawGuild(): this is ModalSubmitInteraction<'raw'>;

0 commit comments

Comments
 (0)