mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-09 16:13:31 +01:00
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:
@@ -70,6 +70,31 @@ class InteractionResponse {
|
|||||||
interactionType: InteractionType.MessageComponent,
|
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
|
// eslint-disable-next-line import/order
|
||||||
|
|||||||
3
packages/discord.js/typings/index.d.ts
vendored
3
packages/discord.js/typings/index.d.ts
vendored
@@ -580,6 +580,9 @@ export class InteractionResponse<Cached extends boolean = boolean> {
|
|||||||
public createMessageComponentCollector<T extends MessageComponentType>(
|
public createMessageComponentCollector<T extends MessageComponentType>(
|
||||||
options?: MessageCollectorOptionsParams<T, Cached>,
|
options?: MessageCollectorOptionsParams<T, Cached>,
|
||||||
): InteractionCollector<MappedInteractionTypes<Cached>[T]>;
|
): 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 {
|
export abstract class BaseGuild extends Base {
|
||||||
|
|||||||
Reference in New Issue
Block a user