S
S
scar172021-05-10 20:47:13
Node.js
scar17, 2021-05-10 20:47:13

Sending to all channels with a specific name?

I have a code that sends all messages from the site to a channel called "ochat".
code:
let channel1 = client.channels.cache.find(channel1 => channel1.name === `ochat`)
if(!channel1) return;
channel1.send(message)
The problem is that it only sends to 1 channel with that name, and it's on 2 servers. How to make it send messages to all channels from all servers?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
scar17, 2021-05-15
@scar17

Client.guilds.cache.forEach(g=>g.channels.cache.first().send(msg))
thanks Artem

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question