Recently diving into Discord.JS, I am struggling to understand how to make my bot send a message to the General Chat when a new user joins.
Many examples I've come across suggest using the following code:
const channel = client.channels.cache.find(channel => channel.name === channelName)
channel.send(message)
Unfortunately, this approach is not yielding the desired results for me. Every time I attempt to send a message using channel.send(message)
, I encounter an error message.
I also experimented with another method where you utilize
client.channels.cache.get(<Channel-ID>)
.
Regrettably, this alternative did not work either.