mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-12 09:33:32 +01:00
refactor(Interaction): rename defer to deferReply (#6306)
This commit is contained in:
@@ -12,7 +12,7 @@ const MessagePayload = require('../MessagePayload');
|
||||
class InteractionResponses {
|
||||
/**
|
||||
* Options for deferring the reply to an {@link Interaction}.
|
||||
* @typedef {Object} InteractionDeferOptions
|
||||
* @typedef {Object} InteractionDeferReplyOptions
|
||||
* @property {boolean} [ephemeral] Whether the reply should be ephemeral
|
||||
* @property {boolean} [fetchReply] Whether to fetch the reply
|
||||
*/
|
||||
@@ -38,20 +38,20 @@ class InteractionResponses {
|
||||
|
||||
/**
|
||||
* Defers the reply to this interaction.
|
||||
* @param {InteractionDeferOptions} [options] Options for deferring the reply to this interaction
|
||||
* @param {InteractionDeferReplyOptions} [options] Options for deferring the reply to this interaction
|
||||
* @returns {Promise<Message|APIMessage|void>}
|
||||
* @example
|
||||
* // Defer the reply to this interaction
|
||||
* interaction.defer()
|
||||
* interaction.deferReply()
|
||||
* .then(console.log)
|
||||
* .catch(console.error)
|
||||
* @example
|
||||
* // Defer to send an ephemeral reply later
|
||||
* interaction.defer({ ephemeral: true })
|
||||
* interaction.deferReply({ ephemeral: true })
|
||||
* .then(console.log)
|
||||
* .catch(console.error);
|
||||
*/
|
||||
async defer(options = {}) {
|
||||
async deferReply(options = {}) {
|
||||
if (this.deferred || this.replied) throw new Error('INTERACTION_ALREADY_REPLIED');
|
||||
if (options.fetchReply && options.ephemeral) throw new Error('INTERACTION_FETCH_EPHEMERAL');
|
||||
this.ephemeral = options.ephemeral ?? false;
|
||||
@@ -228,7 +228,17 @@ class InteractionResponses {
|
||||
}
|
||||
|
||||
static applyToClass(structure, ignore = []) {
|
||||
const props = ['defer', 'reply', 'fetchReply', 'editReply', 'deleteReply', 'followUp', 'deferUpdate', 'update'];
|
||||
const props = [
|
||||
'deferReply',
|
||||
'reply',
|
||||
'fetchReply',
|
||||
'editReply',
|
||||
'deleteReply',
|
||||
'followUp',
|
||||
'deferUpdate',
|
||||
'update',
|
||||
];
|
||||
|
||||
for (const prop of props) {
|
||||
if (ignore.includes(prop)) continue;
|
||||
Object.defineProperty(
|
||||
|
||||
Reference in New Issue
Block a user