File tree Expand file tree Collapse file tree 2 files changed +17
-0
lines changed Expand file tree Collapse file tree 2 files changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -448,6 +448,22 @@ class Message extends Base {
448448 } ) ;
449449 }
450450
451+ /**
452+ * Publishes a message in an announcement channel to all channels following it.
453+ * @returns {Promise<Message> }
454+ * @example
455+ * // Crosspost a message
456+ * if (message.channel.type === 'news') {
457+ * message.crosspost()
458+ * .then(() => console.log('Crossposted message'))
459+ * .catch(console.error);
460+ * }
461+ */
462+ async crosspost ( ) {
463+ await this . client . api . channels ( this . channel . id ) . messages ( this . id ) . crosspost . post ( ) ;
464+ return this ;
465+ }
466+
451467 /**
452468 * Pins this message to the channel's pinned messages.
453469 * @param {Object } [options] Options for pinning
Original file line number Diff line number Diff line change @@ -1023,6 +1023,7 @@ declare module 'discord.js' {
10231023 public edit ( content : StringResolvable , options : MessageEditOptions | MessageEmbed ) : Promise < Message > ;
10241024 public equals ( message : Message , rawData : object ) : boolean ;
10251025 public fetchWebhook ( ) : Promise < Webhook > ;
1026+ public crosspost ( ) : Promise < Message > ;
10261027 public fetch ( force ?: boolean ) : Promise < Message > ;
10271028 public pin ( options ?: { reason ?: string } ) : Promise < Message > ;
10281029 public react ( emoji : EmojiIdentifierResolvable ) : Promise < MessageReaction > ;
You can’t perform that action at this time.
0 commit comments