fix(interactions): wrong return type and missing implementation of with_response in core (#10644)

* fix(types): wrong return type with with_response

* fix: missing implementation of with_response

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
This commit is contained in:
Naiyar
2024-12-09 14:10:35 +05:30
committed by Jiralite
parent 62f2ca5fbb
commit 6f05c96ab4

View File

@@ -150,7 +150,7 @@ export class InteractionsAPI {
interactionToken: string,
body: RESTPostAPIInteractionCallbackQuery & { with_response: true },
options?: Pick<RequestData, 'signal'>,
): Promise<undefined>;
): Promise<RESTPostAPIInteractionCallbackWithResponseResult>;
/**
* Defers an update from a message component interaction
@@ -166,7 +166,7 @@ export class InteractionsAPI {
interactionToken: string,
body?: RESTPostAPIInteractionCallbackQuery & { with_response?: false },
options?: Pick<RequestData, 'signal'>,
): Promise<RESTPostAPIInteractionCallbackWithResponseResult>;
): Promise<undefined>;
public async deferMessageUpdate(
interactionId: Snowflake,
@@ -313,6 +313,7 @@ export class InteractionsAPI {
{ signal }: Pick<RequestData, 'signal'> = {},
) {
const response = await this.rest.post(Routes.interactionCallback(interactionId, interactionToken), {
query: makeURLSearchParams({ with_response }),
files,
auth: false,
body: {
@@ -340,7 +341,7 @@ export class InteractionsAPI {
callbackData: APICommandAutocompleteInteractionResponseCallbackData &
RESTPostAPIInteractionCallbackQuery & { with_response: true },
options?: Pick<RequestData, 'signal'>,
): Promise<APICommandAutocompleteInteractionResponseCallbackData>;
): Promise<RESTPostAPIInteractionCallbackWithResponseResult>;
/**
* Sends an autocomplete response to an interaction
@@ -369,6 +370,7 @@ export class InteractionsAPI {
{ signal }: Pick<RequestData, 'signal'> = {},
) {
const response = await this.rest.post(Routes.interactionCallback(interactionId, interactionToken), {
query: makeURLSearchParams({ with_response }),
auth: false,
body: {
type: InteractionResponseType.ApplicationCommandAutocompleteResult,
@@ -421,6 +423,7 @@ export class InteractionsAPI {
{ signal }: Pick<RequestData, 'signal'> = {},
) {
const response = await this.rest.post(Routes.interactionCallback(interactionId, interactionToken), {
query: makeURLSearchParams({ with_response }),
auth: false,
body: {
type: InteractionResponseType.Modal,