Automatic publish announcements

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 ?
7 Replies
d.js toolkit
d.js toolkit3w ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - 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
d.js docs
d.js docs3w ago
:event: (event) Client#messageCreate @14.16.3 Emitted whenever a message is created. :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);
}
// Crosspost a message
if (message.channel.type === ChannelType.GuildAnnouncement) {
message.crosspost()
.then(() => console.log('Crossposted message'))
.catch(console.error);
}
Legita
LegitaOP3w ago
@TÆMBØ 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
TÆMBØ
TÆMBØ3w ago
If you want the publishing to be practically instant with respect to when they're posted, yes
Legita
LegitaOP3w ago
What if the timing is not that important, is there another way around without using a bot ?
TÆMBØ
TÆMBØ3w ago
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
Legita
LegitaOP3w ago
Thanks, apprecaite your help
Want results from more Discord servers?
Add your server