discord.js send a message to a specific channel code example

Example 1: send a message to a specific channel discord.js

client.channels.get("<ID of the channel you want to send to>").send("<your message content here>")

Example 2: how to send a message to a discord server using a bot

const channel = client.channels.cache.get(channel => channel.name === 'the channel name')
channel.send(message)

Example 3: discord js send message to specific channel

const channel = client.channels.cache.find(channel => channel.name === channelName)
channel.send(message)

Example 4: discord.js send message to specific channel

client.channels.cache.get("channel ID").send("hello world");