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 GitHub
parent b3d4259f8a
commit 1cfc835e97

View File

@@ -159,7 +159,7 @@ export class InteractionsAPI {
interactionToken: string, interactionToken: string,
body: RESTPostAPIInteractionCallbackQuery & { with_response: true }, body: RESTPostAPIInteractionCallbackQuery & { with_response: true },
options?: Pick<RequestData, 'signal'>, options?: Pick<RequestData, 'signal'>,
): Promise<undefined>; ): Promise<RESTPostAPIInteractionCallbackWithResponseResult>;
/** /**
* Defers an update from a message component interaction * Defers an update from a message component interaction
@@ -175,7 +175,7 @@ export class InteractionsAPI {
interactionToken: string, interactionToken: string,
body?: RESTPostAPIInteractionCallbackQuery & { with_response?: false }, body?: RESTPostAPIInteractionCallbackQuery & { with_response?: false },
options?: Pick<RequestData, 'signal'>, options?: Pick<RequestData, 'signal'>,
): Promise<RESTPostAPIInteractionCallbackWithResponseResult>; ): Promise<undefined>;
public async deferMessageUpdate( public async deferMessageUpdate(
interactionId: Snowflake, interactionId: Snowflake,
@@ -316,6 +316,7 @@ export class InteractionsAPI {
{ signal }: Pick<RequestData, 'signal'> = {}, { signal }: Pick<RequestData, 'signal'> = {},
) { ) {
const response = await this.rest.post(Routes.interactionCallback(interactionId, interactionToken), { const response = await this.rest.post(Routes.interactionCallback(interactionId, interactionToken), {
query: makeURLSearchParams({ with_response }),
files, files,
auth: false, auth: false,
body: { body: {
@@ -342,7 +343,7 @@ export class InteractionsAPI {
interactionToken: string, interactionToken: string,
callbackData: CreateAutocompleteResponseOptions & { with_response: true }, callbackData: CreateAutocompleteResponseOptions & { with_response: true },
options?: Pick<RequestData, 'signal'>, options?: Pick<RequestData, 'signal'>,
): Promise<APICommandAutocompleteInteractionResponseCallbackData>; ): Promise<RESTPostAPIInteractionCallbackWithResponseResult>;
/** /**
* Sends an autocomplete response to an interaction * Sends an autocomplete response to an interaction
@@ -367,6 +368,7 @@ export class InteractionsAPI {
{ signal }: Pick<RequestData, 'signal'> = {}, { signal }: Pick<RequestData, 'signal'> = {},
) { ) {
const response = await this.rest.post(Routes.interactionCallback(interactionId, interactionToken), { const response = await this.rest.post(Routes.interactionCallback(interactionId, interactionToken), {
query: makeURLSearchParams({ with_response }),
auth: false, auth: false,
body: { body: {
type: InteractionResponseType.ApplicationCommandAutocompleteResult, type: InteractionResponseType.ApplicationCommandAutocompleteResult,
@@ -417,6 +419,7 @@ export class InteractionsAPI {
{ signal }: Pick<RequestData, 'signal'> = {}, { signal }: Pick<RequestData, 'signal'> = {},
) { ) {
const response = await this.rest.post(Routes.interactionCallback(interactionId, interactionToken), { const response = await this.rest.post(Routes.interactionCallback(interactionId, interactionToken), {
query: makeURLSearchParams({ with_response }),
auth: false, auth: false,
body: { body: {
type: InteractionResponseType.Modal, type: InteractionResponseType.Modal,