feat(InteractionResponse): add new methods (#9132)

* feat(InteractionResponse): add new methods

* types: fix options parameter type

Co-authored-by: Jaworek <jaworekwiadomosci@gmail.com>

* Update packages/discord.js/src/structures/InteractionResponse.js

Co-authored-by: Vlad Frangu <kingdgrizzle@gmail.com>

* Update packages/discord.js/src/structures/InteractionResponse.js

Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>

* docs: add description for edit

---------

Co-authored-by: Jaworek <jaworekwiadomosci@gmail.com>
Co-authored-by: Vlad Frangu <kingdgrizzle@gmail.com>
Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
This commit is contained in:
MrMythicalYT
2023-02-17 16:56:18 -05:00
committed by GitHub
parent da23cd5d69
commit dc9924fb5f
2 changed files with 28 additions and 0 deletions

View File

@@ -70,6 +70,31 @@ class InteractionResponse {
interactionType: InteractionType.MessageComponent,
});
}
/**
* Fetches the response as a {@link Message} object.
* @returns {Promise<Message>}
*/
fetch() {
return this.interaction.fetchReply();
}
/**
* Deletes the response.
* @returns {Promise<void>}
*/
delete() {
return this.interaction.deleteReply();
}
/**
* Edits the response.
* @param {string|MessagePayload|WebhookMessageEditOptions} options The new options for the response.
* @returns {Promise<Message>}
*/
edit(options) {
return this.interaction.editReply(options);
}
}
// eslint-disable-next-line import/order

View File

@@ -580,6 +580,9 @@ export class InteractionResponse<Cached extends boolean = boolean> {
public createMessageComponentCollector<T extends MessageComponentType>(
options?: MessageCollectorOptionsParams<T, Cached>,
): InteractionCollector<MappedInteractionTypes<Cached>[T]>;
public delete(): Promise<void>;
public edit(options: string | MessagePayload | WebhookMessageEditOptions): Promise<Message>;
public fetch(): Promise<Message>;
}
export abstract class BaseGuild extends Base {