#Automatic publish announcements

9 messages · Page 1 of 1 (latest)

quartz needle
#

Hello, I have an announcement channel which I send webhooks to it and I want it to automatically send it to the servers that follows it without me having to click publish, how can I achieve that ?

pseudo cedarBOT
#
  • What's your exact discord.js npm list discord.js and node node -v version?
  • Not a discord.js issue? Check out #1081585952654360687.
  • Consider reading #how-to-get-help to improve your question!
  • Explain what exactly your issue is.
  • Post the full error stack trace, not just the top part!
  • Show your code!
  • Issue solved? Press the button!
  • Marked as resolved by OP
bitter matrixBOT
#

method Message#crosspost() @14.16.3
Publishes a message in an announcement channel to all channels following it.


// Crosspost a message
if (message.channel.type === ChannelType.GuildAnnouncement) {
  message.crosspost()
    .then(() => console.log('Crossposted message'))
    .catch(console.error);
}

quartz needle
#

@outer night so I have to have a bot that is running 24/7 and check messages there ?

#

Also its an embed message that is being sent there

outer night
#

If you want the publishing to be practically instant with respect to when they're posted, yes

quartz needle
outer night
#

You could run some sort of cron job every few hours to fetch messages from that channel and publish each one that hasn't already been published, though that'd still require an app to at least be installed in that guild in order to have access to those messages