feat(Message): add support for flag editing / embed suppression (#3674)

This commit is contained in:
Vlad Frangu
2020-02-16 20:36:10 +02:00
committed by GitHub
parent bc5e2950d0
commit 46ee06b424
3 changed files with 38 additions and 0 deletions

View File

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