O_nly_James
O_nly_James

Reputation: 21

How would I send a message to all discord servers my bot is in v14 discord.js?

I would like to get help with making code so that I can send a message to all servers when I want too? All the previous posts are discord.py or older versions of discord.js

Upvotes: 0

Views: 618

Answers (1)

yuto0214w
yuto0214w

Reputation: 41

Assuming you meant "all channels on all servers", you can recurse Client#channels.

client.channels.cache.forEach(ch => ch.send("message"));

If you meant "specified channel(s) on all servers", use filter before forEach.

Upvotes: 1

Related Questions