Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

announcement for all server bot is in

bot.guilds.cache.forEach((guild) => {
 console.log(guild.name);

 //This would make the client to send a message "Announcement!" to a channel named "news" in every server, if such a channel didn't exist in a guild, the message wouldn't be sent for that exact guild
 try {
  guild.channels.cache.find((x) => x.name == 'news').send('Announcement!');
 } catch {
  //If message couldn't be sent
  console.log("Message wasn't sent for " + guild.name);
 }
});
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #announcement #server #bot
ADD COMMENT
Topic
Name
4+8 =