feat(Message): add ReplyMessageOptions for #reply (#5296)

This commit is contained in:
Shubham Parihar
2021-05-11 03:28:19 +05:30
committed by GitHub
parent 31b4390042
commit 7ce741dacd
3 changed files with 30 additions and 10 deletions

View File

@@ -606,11 +606,27 @@ class Message extends Base {
return this;
}
/**
* Options provided when sending a message as an inline reply.
* @typedef {Object} ReplyMessageOptions
* @property {boolean} [tts=false] Whether or not the message should be spoken aloud
* @property {string} [nonce=''] The nonce for the message
* @property {string} [content=''] The content for the message
* @property {MessageEmbed|Object} [embed] An embed for the message
* (see [here](https://discord.com/developers/docs/resources/channel#embed-object) for more details)
* @property {MessageMentionOptions} [allowedMentions] Which mentions should be parsed from the message content
* @property {FileOptions[]|BufferResolvable[]} [files] Files to send with the message
* @property {string|boolean} [code] Language for optional codeblock formatting to apply
* @property {boolean|SplitOptions} [split=false] Whether or not the message should be split into multiple messages if
* it exceeds the character limit. If an object is provided, these are the options for splitting the message
* @property {boolean} [failIfNotExists=true] Whether to error if the referenced message
* does not exist (creates a standard message in this case when false)
*/
/**
* Send an inline reply to this message.
* @param {StringResolvable|APIMessage} [content=''] The content for the message
* @param {MessageOptions|MessageAdditions} [options] The additional options to provide
* @param {MessageResolvable} [options.reply.messageReference=this] The message to reply to
* @param {ReplyMessageOptions|MessageAdditions} [options] The additional options to provide
* @returns {Promise<Message|Message[]>}
*/
reply(content, options) {
@@ -620,7 +636,7 @@ class Message extends Base {
: APIMessage.transformOptions(content, options, {
reply: {
messageReference: this,
failIfNotExists: options?.reply?.failIfNotExists ?? content?.reply?.failIfNotExists ?? true,
failIfNotExists: options?.failIfNotExists ?? content?.failIfNotExists ?? true,
},
}),
);