refactor(MessageOptions): move replyTo to reply#messageReference and add failIfNotExists (#5298)

Co-authored-by: SpaceEEC <spaceeec@yahoo.com>
Co-authored-by: Shubham Parihar <shubhamparihar391@gmail.com>
This commit is contained in:
ckohen
2021-05-10 03:27:36 -07:00
committed by GitHub
parent 533c2471c2
commit 1ecda83da7
4 changed files with 27 additions and 8 deletions

View File

@@ -610,7 +610,7 @@ class Message extends Base {
* 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.replyTo=this] The message to reply to
* @param {MessageResolvable} [options.reply.messageReference=this] The message to reply to
* @returns {Promise<Message|Message[]>}
*/
reply(content, options) {
@@ -618,7 +618,10 @@ class Message extends Base {
content instanceof APIMessage
? content
: APIMessage.transformOptions(content, options, {
replyTo: this,
reply: {
messageReference: this,
failIfNotExists: options?.reply?.failIfNotExists ?? content?.reply?.failIfNotExists ?? true,
},
}),
);
}