how to amke a bot send message in every server code example
Example: send message to all servers discord.js
const discord = require('discord.js');
const client = new discord.Client();
client.on('ready', () => {
console.log('On Discord!');
});
client.on('message', () => {
if (message.content === "!sendguildmessages") {
var guildList = client.guilds.array();
try {
guildList.forEach(guild => guild.defaultChannel.send("messageToSend"));
} catch (err) {
console.log("Could not send message to " + guild.name);
}
}
});