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

@@ -175,12 +175,15 @@ class APIMessage {
}
let message_reference;
if (typeof this.options.replyTo !== 'undefined') {
if (typeof this.options.reply === 'object') {
const message_id = this.isMessage
? this.target.channel.messages.resolveID(this.options.replyTo)
: this.target.messages.resolveID(this.options.replyTo);
? this.target.channel.messages.resolveID(this.options.reply.messageReference)
: this.target.messages.resolveID(this.options.reply.messageReference);
if (message_id) {
message_reference = { message_id };
message_reference = {
message_id,
fail_if_not_exists: this.options.reply.failIfNotExists ?? true,
};
}
}