feat(InlineReplies): provide support for inline-replying to messages

This commit is contained in:
monbrey 2020-10-02 16:00:14 +10:00
parent a5ce6cfa9a
commit 9f3108052c
3 changed files with 11 additions and 6 deletions

View file

@ -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;
}

View file

@ -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)
*/
/**

7
typings/index.d.ts vendored
View file

@ -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;