From ab5ee838a318879f7b61560ce2f3742c22adb239 Mon Sep 17 00:00:00 2001 From: monbrey Date: Fri, 2 Oct 2020 15:37:40 +1000 Subject: [PATCH] feat(InlineReplies): add Message#replyReference property --- src/structures/Message.js | 11 +++++++++++ typings/index.d.ts | 1 + 2 files changed, 12 insertions(+) diff --git a/src/structures/Message.js b/src/structures/Message.js index 439eb4aa..1d3a9d6b 100644 --- a/src/structures/Message.js +++ b/src/structures/Message.js @@ -223,6 +223,17 @@ class Message extends Base { messageID: data.message_reference.message_id, } : null; + + /** + * The message this message replies to + * @type {?Message} + */ + if ('referenced_message' in data) { + this.replyReference = + this.channel.messages.get(data.referenced_message.id) || this.channel.messages.add(data.referenced_message); + } else { + this.replyReference = null; + } } /** diff --git a/typings/index.d.ts b/typings/index.d.ts index fa273e64..3c6461fa 100644 --- a/typings/index.d.ts +++ b/typings/index.d.ts @@ -1011,6 +1011,7 @@ declare module 'discord.js' { public webhookID: Snowflake | null; public flags: Readonly; public reference: MessageReference | null; + public replyReference: Message | null; public awaitReactions( filter: CollectorFilter, options?: AwaitReactionsOptions,