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,