feat(Message): add support for crossposting (#4105)

Co-authored-by: Advaith <advaithj1@gmail.com>
Co-authored-by: Joe <56809242+Jo3-L@users.noreply.github.com>
Co-authored-by: Jan <66554238+Vaporox@users.noreply.github.com>
Co-authored-by: Noel <icrawltogo@gmail.com>
This commit is contained in:
Johnson Chen
2020-09-13 20:07:56 +10:00
committed by GitHub
parent 0da65becd3
commit bcb7c721dc
2 changed files with 17 additions and 0 deletions

View File

@@ -448,6 +448,22 @@ class Message extends Base {
});
}
/**
* Publishes a message in an announcement channel to all channels following it.
* @returns {Promise<Message>}
* @example
* // Crosspost a message
* if (message.channel.type === 'news') {
* message.crosspost()
* .then(() => console.log('Crossposted message'))
* .catch(console.error);
* }
*/
async crosspost() {
await this.client.api.channels(this.channel.id).messages(this.id).crosspost.post();
return this;
}
/**
* Pins this message to the channel's pinned messages.
* @param {Object} [options] Options for pinning