Skip to content

Commit

Permalink
feat(InlineReplies): provide support for inline-replying to messages
Browse files Browse the repository at this point in the history
  • Loading branch information
monbrey committed Oct 2, 2020
1 parent 2c671e3 commit 21180e3
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
9 changes: 9 additions & 0 deletions src/structures/APIMessage.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -208,6 +216,7 @@ class APIMessage {
avatar_url: avatarURL,
allowed_mentions: typeof content === 'undefined' ? undefined : allowedMentions,
flags,
message_reference,
};
return this;
}
Expand Down
1 change: 1 addition & 0 deletions src/structures/interfaces/TextBasedChannel.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
*/

/**
Expand Down
7 changes: 1 addition & 6 deletions typings/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down

0 comments on commit 21180e3

Please sign in to comment.