feat: Backport sending message flags (#7560)

This commit is contained in:
Jiralite
2022-03-02 09:32:36 +00:00
committed by GitHub
parent 1d97dcff08
commit 29d42ed319
5 changed files with 17 additions and 5 deletions

View File

@@ -148,11 +148,17 @@ class MessagePayload {
}
let flags;
if ((this.isMessage && typeof this.options.reply === 'undefined') || this.isMessageManager) {
if (
typeof this.options.flags !== 'undefined' ||
(this.isMessage && typeof this.options.reply === 'undefined') ||
this.isMessageManager
) {
// eslint-disable-next-line eqeqeq
flags = this.options.flags != null ? new MessageFlags(this.options.flags).bitfield : this.target.flags?.bitfield;
} else if (isInteraction && this.options.ephemeral) {
flags = MessageFlags.FLAGS.EPHEMERAL;
}
if (isInteraction && this.options.ephemeral) {
flags |= MessageFlags.FLAGS.EPHEMERAL;
}
let allowedMentions =

View File

@@ -116,6 +116,7 @@ class Webhook {
* @property {string} [avatarURL] Avatar URL override for the message
* @property {Snowflake} [threadId] The id of the thread in the channel to send to.
* <info>For interaction webhooks, this property is ignored</info>
* @property {MessageFlags} [flags] Which flags to set for the message. Only `SUPPRESS_EMBEDS` can be set.
*/
/**

View File

@@ -28,6 +28,8 @@ class InteractionResponses {
* @typedef {BaseMessageOptions} InteractionReplyOptions
* @property {boolean} [ephemeral] Whether the reply should be ephemeral
* @property {boolean} [fetchReply] Whether to fetch the reply
* @property {MessageFlags} [flags] Which flags to set for the message.
* Only `SUPPRESS_EMBEDS` and `EPHEMERAL` can be set.
*/
/**

View File

@@ -73,6 +73,7 @@ class TextBasedChannel {
* @typedef {BaseMessageOptions} MessageOptions
* @property {ReplyOptions} [reply] The options for replying to a message
* @property {StickerResolvable[]} [stickers=[]] Stickers to send in the message
* @property {MessageFlags} [flags] Which flags to set for the message. Only `SUPPRESS_EMBEDS` can be set.
*/
/**