diff --git a/src/structures/APIMessage.js b/src/structures/APIMessage.js index 3451bdb9..46a93063 100644 --- a/src/structures/APIMessage.js +++ b/src/structures/APIMessage.js @@ -198,6 +198,14 @@ class APIMessage { } } + let message_reference; + if (this.options.messageReference) { + message_reference = { + message_id: this.target.messages.resolveID(this.options.messageReference), + channel_id: this.target.id, + }; + } + this.data = { content, tts, @@ -208,6 +216,7 @@ class APIMessage { avatar_url: avatarURL, allowed_mentions: typeof content === 'undefined' ? undefined : allowedMentions, flags, + message_reference, }; return this; } diff --git a/src/structures/interfaces/TextBasedChannel.js b/src/structures/interfaces/TextBasedChannel.js index f5269e97..c0a73379 100644 --- a/src/structures/interfaces/TextBasedChannel.js +++ b/src/structures/interfaces/TextBasedChannel.js @@ -66,6 +66,7 @@ class TextBasedChannel { * @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 {UserResolvable} [reply] User to reply to (prefixes the message with a mention, except in DMs) + * @property {MessageResolvable} [messageReference] The message to inline-reply to (must be in the same channel) */ /** diff --git a/typings/index.d.ts b/typings/index.d.ts index f2bbd2b7..777305a4 100644 --- a/typings/index.d.ts +++ b/typings/index.d.ts @@ -2831,7 +2831,7 @@ declare module 'discord.js' { code?: string | boolean; split?: boolean | SplitOptions; reply?: UserResolvable; - messageReference?: MessageResolvable | MessageReplyReference; + messageReference?: MessageResolvable; } type MessageReactionResolvable = MessageReaction | Snowflake; @@ -2842,11 +2842,6 @@ declare module 'discord.js' { messageID: string | null; } - interface MessageReplyReference { - channelID: string; - messageID: string; - } - type MessageResolvable = Message | Snowflake; type MessageTarget = TextChannel | NewsChannel | DMChannel | User | GuildMember | Webhook | WebhookClient;