mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-10 08:33:30 +01:00
feat(Message): add support for flag editing / embed suppression (#3674)
This commit is contained in:
@@ -532,6 +532,23 @@ class Message extends Base {
|
||||
return this.client.fetchWebhook(this.webhookID);
|
||||
}
|
||||
|
||||
/**
|
||||
* Suppresses or unsuppresses embeds on a message
|
||||
* @param {boolean} [suppress=true] If the embeds should be suppressed or not
|
||||
* @returns {Promise<Message>}
|
||||
*/
|
||||
suppressEmbeds(suppress = true) {
|
||||
const flags = new MessageFlags(this.flags.bitfield);
|
||||
|
||||
if (suppress) {
|
||||
flags.add(MessageFlags.FLAGS.SUPPRESS_EMBEDS);
|
||||
} else {
|
||||
flags.remove(MessageFlags.FLAGS.SUPPRESS_EMBEDS);
|
||||
}
|
||||
|
||||
return this.edit({ flags });
|
||||
}
|
||||
|
||||
/**
|
||||
* Used mainly internally. Whether two messages are identical in properties. If you want to compare messages
|
||||
* without checking all the properties, use `message.id === message2.id`, which is much more efficient. This
|
||||
|
||||
Reference in New Issue
Block a user