mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-10 00:23: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
|
||||
|
||||
1
typings/index.d.ts
vendored
1
typings/index.d.ts
vendored
@@ -1023,6 +1023,7 @@ declare module 'discord.js' {
|
||||
public edit(content: StringResolvable, options: MessageEditOptions | MessageEmbed): Promise<Message>;
|
||||
public equals(message: Message, rawData: object): boolean;
|
||||
public fetchWebhook(): Promise<Webhook>;
|
||||
public crosspost(): Promise<Message>;
|
||||
public fetch(force?: boolean): Promise<Message>;
|
||||
public pin(options?: { reason?: string }): Promise<Message>;
|
||||
public react(emoji: EmojiIdentifierResolvable): Promise<MessageReaction>;
|
||||
|
||||
Reference in New Issue
Block a user