mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-10 08:33:30 +01:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user