Reputation: 13
I have such a problem that I want to send a message via the bot only to a given channel. How can I do this?
Client.channels.cache.get(id).send(text)
This don't work
Upvotes: 0
Views: 56
Reputation: 1187
You can do like so with discord.js v12:
let channel = client.guilds.cache.get('ID_of_the_guild_in_which_the_channel_is_in').channels.cache.get('channel_ID');
if(channel) channel.send('your message');
Upvotes: 2