Discord.js Network Bot : Getting the users message and sending it to the other channels

Viewed 26

I am new to coding and I was trying to make a network bot for my server. I am trying to have it so if someone sends a message in the network channel, then it will send that message to channels. I need some help as I have no idea what I am doing and can't find anything on Google.

I am going to set the time later but I want to get the first bit working.

Here's my code :

const network = "1022619449662124052"
const channels = [`1009882056970485852`, `1009924409714299040`]
const timeout = 1800000 // 30 minutes

client.on("messageCreate", message => {
  if(message.channel.(network))// The channel that the bot watchs for a message / advertisement 
  let network = new Discord.MessageEmbed()
  .setTitle(`Grow Togethers NetWork`)
  .setDescription(`Ad Posted By : ${message.author.tag}`)
  message.channel.get(channels).send(`${content}` {embed: [network]})
  //${content} = the message that the user used ( advertisement )
})
1 Answers

Iterate through your array of ids and get the channel object. Then send to that channel

channels.forEach(id => {
   const channel = message.guild.channels.cache.get(id);

   channel
      .send(...)
      .catch(console.error);
});
Related