How to send a message to a specific channel
Well, if you have the "client
" instance of Discord.Client()
, then use this:
SOLUTION UPDATED to work with newer discordjs versions
client.channels.cache.get(`channelID`).send(`Text`)
Don't forget the channeID parameter is a string type, not number. It's really simple yet precise.
Assuming you have the client
(which would be an instance of Discord.Client
) try finding the desired channel by using Client.find
:
const channel = client.channels.cache.find(channel => channel.name === channelName)
channel.send(message)
If you don't have the client
directly but have a message
instance, you could always access it from within the Message.client property.