parent
b6d290d545
commit
69c5eb94d2
@ -114,50 +114,57 @@ class InteractionResponses {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fetches the initial reply to this interaction.
|
* Fetches a reply to this interaction.
|
||||||
* @see Webhook#fetchMessage
|
* @see Webhook#fetchMessage
|
||||||
|
* @param {MessageResolvable|'@original'} [message='@original'] The response to fetch
|
||||||
* @returns {Promise<Message|APIMessage>}
|
* @returns {Promise<Message|APIMessage>}
|
||||||
* @example
|
* @example
|
||||||
* // Fetch the reply to this interaction
|
* // Fetch the initial reply to this interaction
|
||||||
* interaction.fetchReply()
|
* interaction.fetchReply()
|
||||||
* .then(reply => console.log(`Replied with ${reply.content}`))
|
* .then(reply => console.log(`Replied with ${reply.content}`))
|
||||||
* .catch(console.error);
|
* .catch(console.error);
|
||||||
*/
|
*/
|
||||||
fetchReply() {
|
fetchReply(message = '@original') {
|
||||||
return this.webhook.fetchMessage('@original');
|
return this.webhook.fetchMessage(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Edits the initial reply to this interaction.
|
* Options that can be passed into {@link InteractionResponses#editReply}.
|
||||||
|
* @typedef {WebhookEditMessageOptions} InteractionEditReplyOptions
|
||||||
|
* @property {MessageResolvable|'@original'} [message='@original'] The response to edit
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Edits a reply to this interaction.
|
||||||
* @see Webhook#editMessage
|
* @see Webhook#editMessage
|
||||||
* @param {string|MessagePayload|WebhookEditMessageOptions} options The new options for the message
|
* @param {string|MessagePayload|InteractionEditReplyOptions} options The new options for the message
|
||||||
* @returns {Promise<Message|APIMessage>}
|
* @returns {Promise<Message|APIMessage>}
|
||||||
* @example
|
* @example
|
||||||
* // Edit the reply to this interaction
|
* // Edit the initial reply to this interaction
|
||||||
* interaction.editReply('New content')
|
* interaction.editReply('New content')
|
||||||
* .then(console.log)
|
* .then(console.log)
|
||||||
* .catch(console.error);
|
* .catch(console.error);
|
||||||
*/
|
*/
|
||||||
async editReply(options) {
|
async editReply(options) {
|
||||||
if (!this.deferred && !this.replied) throw new Error('INTERACTION_NOT_REPLIED');
|
if (!this.deferred && !this.replied) throw new Error('INTERACTION_NOT_REPLIED');
|
||||||
const message = await this.webhook.editMessage('@original', options);
|
const message = await this.webhook.editMessage(options.messsage ?? '@original', options);
|
||||||
this.replied = true;
|
this.replied = true;
|
||||||
return message;
|
return message;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Deletes the initial reply to this interaction.
|
* Deletes a reply to this interaction.
|
||||||
* @see Webhook#deleteMessage
|
* @see Webhook#deleteMessage
|
||||||
|
* @param {MessageResolvable|'@original'} [message='@original'] The response to delete
|
||||||
* @returns {Promise<void>}
|
* @returns {Promise<void>}
|
||||||
* @example
|
* @example
|
||||||
* // Delete the reply to this interaction
|
* // Delete the initial reply to this interaction
|
||||||
* interaction.deleteReply()
|
* interaction.deleteReply()
|
||||||
* .then(console.log)
|
* .then(console.log)
|
||||||
* .catch(console.error);
|
* .catch(console.error);
|
||||||
*/
|
*/
|
||||||
async deleteReply() {
|
async deleteReply(message = '@original') {
|
||||||
if (this.ephemeral) throw new Error('INTERACTION_EPHEMERAL_REPLIED');
|
await this.webhook.deleteMessage(message);
|
||||||
await this.webhook.deleteMessage('@original');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -110,6 +110,7 @@ exports.HypeSquadType = createEnum(['LEAVE', 'HOUSE_BRAVERY', 'HOUSE_BRILLIANCE'
|
|||||||
* * `TAIWAN_CHINESE`
|
* * `TAIWAN_CHINESE`
|
||||||
* * `KOREAN`
|
* * `KOREAN`
|
||||||
* @typedef {Object<string, string>} localeSetting
|
* @typedef {Object<string, string>} localeSetting
|
||||||
|
* @see {@link https://discord.com/developers/docs/reference#locales}
|
||||||
*/
|
*/
|
||||||
exports.localeSetting = {
|
exports.localeSetting = {
|
||||||
da: 'DANISH',
|
da: 'DANISH',
|
||||||
|
28
typings/index.d.ts
vendored
28
typings/index.d.ts
vendored
@ -591,11 +591,11 @@ export interface InteractionResponseFields<Cached extends CacheType = CacheType>
|
|||||||
webhook: InteractionWebhook;
|
webhook: InteractionWebhook;
|
||||||
reply(options: InteractionReplyOptions & { fetchReply: true }): Promise<GuildCacheMessage<Cached>>;
|
reply(options: InteractionReplyOptions & { fetchReply: true }): Promise<GuildCacheMessage<Cached>>;
|
||||||
reply(options: string | MessagePayload | InteractionReplyOptions): Promise<void>;
|
reply(options: string | MessagePayload | InteractionReplyOptions): Promise<void>;
|
||||||
deleteReply(): Promise<void>;
|
deleteReply(message?: MessageResolvable | '@original'): Promise<void>;
|
||||||
editReply(options: string | MessagePayload | WebhookEditMessageOptions): Promise<GuildCacheMessage<Cached>>;
|
editReply(options: string | MessagePayload | InteractionEditReplyOptions): Promise<GuildCacheMessage<Cached>>;
|
||||||
deferReply(options: InteractionDeferReplyOptions & { fetchReply: true }): Promise<GuildCacheMessage<Cached>>;
|
deferReply(options: InteractionDeferReplyOptions & { fetchReply: true }): Promise<GuildCacheMessage<Cached>>;
|
||||||
deferReply(options?: InteractionDeferReplyOptions): Promise<void>;
|
deferReply(options?: InteractionDeferReplyOptions): Promise<void>;
|
||||||
fetchReply(): Promise<GuildCacheMessage<Cached>>;
|
fetchReply(message?: MessageResolvable | '@original'): Promise<GuildCacheMessage<Cached>>;
|
||||||
followUp(options: string | MessagePayload | InteractionReplyOptions): Promise<GuildCacheMessage<Cached>>;
|
followUp(options: string | MessagePayload | InteractionReplyOptions): Promise<GuildCacheMessage<Cached>>;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -631,9 +631,9 @@ export abstract class BaseCommandInteraction<Cached extends CacheType = CacheTyp
|
|||||||
public inRawGuild(): this is BaseCommandInteraction<'raw'>;
|
public inRawGuild(): this is BaseCommandInteraction<'raw'>;
|
||||||
public deferReply(options: InteractionDeferReplyOptions & { fetchReply: true }): Promise<GuildCacheMessage<Cached>>;
|
public deferReply(options: InteractionDeferReplyOptions & { fetchReply: true }): Promise<GuildCacheMessage<Cached>>;
|
||||||
public deferReply(options?: InteractionDeferReplyOptions): Promise<void>;
|
public deferReply(options?: InteractionDeferReplyOptions): Promise<void>;
|
||||||
public deleteReply(): Promise<void>;
|
public deleteReply(message?: MessageResolvable | '@original'): Promise<void>;
|
||||||
public editReply(options: string | MessagePayload | WebhookEditMessageOptions): Promise<GuildCacheMessage<Cached>>;
|
public editReply(options: string | MessagePayload | InteractionEditReplyOptions): Promise<GuildCacheMessage<Cached>>;
|
||||||
public fetchReply(): Promise<GuildCacheMessage<Cached>>;
|
public fetchReply(message?: MessageResolvable | '@original'): Promise<GuildCacheMessage<Cached>>;
|
||||||
public followUp(options: string | MessagePayload | InteractionReplyOptions): Promise<GuildCacheMessage<Cached>>;
|
public followUp(options: string | MessagePayload | InteractionReplyOptions): Promise<GuildCacheMessage<Cached>>;
|
||||||
public reply(options: InteractionReplyOptions & { fetchReply: true }): Promise<GuildCacheMessage<Cached>>;
|
public reply(options: InteractionReplyOptions & { fetchReply: true }): Promise<GuildCacheMessage<Cached>>;
|
||||||
public reply(options: string | MessagePayload | InteractionReplyOptions): Promise<void>;
|
public reply(options: string | MessagePayload | InteractionReplyOptions): Promise<void>;
|
||||||
@ -2082,9 +2082,9 @@ export class MessageComponentInteraction<Cached extends CacheType = CacheType> e
|
|||||||
public deferReply(options?: InteractionDeferReplyOptions): Promise<void>;
|
public deferReply(options?: InteractionDeferReplyOptions): Promise<void>;
|
||||||
public deferUpdate(options: InteractionDeferUpdateOptions & { fetchReply: true }): Promise<GuildCacheMessage<Cached>>;
|
public deferUpdate(options: InteractionDeferUpdateOptions & { fetchReply: true }): Promise<GuildCacheMessage<Cached>>;
|
||||||
public deferUpdate(options?: InteractionDeferUpdateOptions): Promise<void>;
|
public deferUpdate(options?: InteractionDeferUpdateOptions): Promise<void>;
|
||||||
public deleteReply(): Promise<void>;
|
public deleteReply(message?: MessageResolvable | '@original'): Promise<void>;
|
||||||
public editReply(options: string | MessagePayload | WebhookEditMessageOptions): Promise<GuildCacheMessage<Cached>>;
|
public editReply(options: string | MessagePayload | InteractionEditReplyOptions): Promise<GuildCacheMessage<Cached>>;
|
||||||
public fetchReply(): Promise<GuildCacheMessage<Cached>>;
|
public fetchReply(message?: MessageResolvable | '@original'): Promise<GuildCacheMessage<Cached>>;
|
||||||
public followUp(options: string | MessagePayload | InteractionReplyOptions): Promise<GuildCacheMessage<Cached>>;
|
public followUp(options: string | MessagePayload | InteractionReplyOptions): Promise<GuildCacheMessage<Cached>>;
|
||||||
public reply(options: InteractionReplyOptions & { fetchReply: true }): Promise<GuildCacheMessage<Cached>>;
|
public reply(options: InteractionReplyOptions & { fetchReply: true }): Promise<GuildCacheMessage<Cached>>;
|
||||||
public reply(options: string | MessagePayload | InteractionReplyOptions): Promise<void>;
|
public reply(options: string | MessagePayload | InteractionReplyOptions): Promise<void>;
|
||||||
@ -2363,13 +2363,13 @@ export class ModalSubmitInteraction<Cached extends CacheType = CacheType> extend
|
|||||||
public webhook: InteractionWebhook;
|
public webhook: InteractionWebhook;
|
||||||
public reply(options: InteractionReplyOptions & { fetchReply: true }): Promise<GuildCacheMessage<Cached>>;
|
public reply(options: InteractionReplyOptions & { fetchReply: true }): Promise<GuildCacheMessage<Cached>>;
|
||||||
public reply(options: string | MessagePayload | InteractionReplyOptions): Promise<void>;
|
public reply(options: string | MessagePayload | InteractionReplyOptions): Promise<void>;
|
||||||
public deleteReply(): Promise<void>;
|
public deleteReply(message?: MessageResolvable | '@original'): Promise<void>;
|
||||||
public editReply(options: string | MessagePayload | WebhookEditMessageOptions): Promise<GuildCacheMessage<Cached>>;
|
public editReply(options: string | MessagePayload | InteractionEditReplyOptions): Promise<GuildCacheMessage<Cached>>;
|
||||||
public deferReply(options: InteractionDeferReplyOptions & { fetchReply: true }): Promise<GuildCacheMessage<Cached>>;
|
public deferReply(options: InteractionDeferReplyOptions & { fetchReply: true }): Promise<GuildCacheMessage<Cached>>;
|
||||||
public deferReply(options?: InteractionDeferReplyOptions): Promise<void>;
|
public deferReply(options?: InteractionDeferReplyOptions): Promise<void>;
|
||||||
public deferUpdate(options: InteractionDeferUpdateOptions & { fetchReply: true }): Promise<GuildCacheMessage<Cached>>;
|
public deferUpdate(options: InteractionDeferUpdateOptions & { fetchReply: true }): Promise<GuildCacheMessage<Cached>>;
|
||||||
public deferUpdate(options?: InteractionDeferUpdateOptions): Promise<void>;
|
public deferUpdate(options?: InteractionDeferUpdateOptions): Promise<void>;
|
||||||
public fetchReply(): Promise<GuildCacheMessage<Cached>>;
|
public fetchReply(message?: MessageResolvable | '@original'): Promise<GuildCacheMessage<Cached>>;
|
||||||
public followUp(options: string | MessagePayload | InteractionReplyOptions): Promise<GuildCacheMessage<Cached>>;
|
public followUp(options: string | MessagePayload | InteractionReplyOptions): Promise<GuildCacheMessage<Cached>>;
|
||||||
public inGuild(): this is ModalSubmitInteraction<'raw' | 'cached'>;
|
public inGuild(): this is ModalSubmitInteraction<'raw' | 'cached'>;
|
||||||
public inCachedGuild(): this is ModalSubmitInteraction<'cached'>;
|
public inCachedGuild(): this is ModalSubmitInteraction<'cached'>;
|
||||||
@ -6822,6 +6822,10 @@ export type WebhookEditMessageOptions = Pick<
|
|||||||
'content' | 'embeds' | 'files' | 'allowedMentions' | 'components' | 'attachments' | 'threadId'
|
'content' | 'embeds' | 'files' | 'allowedMentions' | 'components' | 'attachments' | 'threadId'
|
||||||
>;
|
>;
|
||||||
|
|
||||||
|
export interface InteractionEditReplyOptions extends WebhookEditMessageOptions {
|
||||||
|
message?: MessageResolvable | '@original';
|
||||||
|
}
|
||||||
|
|
||||||
export interface WebhookFetchMessageOptions {
|
export interface WebhookFetchMessageOptions {
|
||||||
cache?: boolean;
|
cache?: boolean;
|
||||||
threadId?: Snowflake;
|
threadId?: Snowflake;
|
||||||
|
Loading…
Reference in New Issue
Block a user