At this moment I am trying to figure out why my 'Welcoming Message' isn't working at my own Discord server. I have been looking at several Stackoverflow
topics and YouTube tutorials, I have read through the Discord.js
documentation but I wasn't able to a proper solution. So, therefore I am trying to get my answers on this network via this topic.
The code I have so far:
client.on('guildCreate', (guild) => {
let channelToSend;
guild.channels.cache.forEach((channel) => {
if(
channel.type === "text" &&
!channelToSend &&
channel.permissionsFor(guild.me).has("SEND_MESSAGES")
) channelToSend = channel;
});
if(!channelToSend) return;
let channelEmbed = new Discord.MessageEmbed()
.setColor("RED")
.setAuthor(`TEXT TEXT ${guild.name} TEXT!`)
.setDescription("TEXT TEXT")
.addField("Roles", "TEXT TEXT")
channelToSend.send(channelEmbed).catch(e =>{
if (e) {
return;
}});
})
I have absolutely no clue anymore why this isn't working. I also admit that I made the transition from Python
to Javascript
a month ago, so maybe I made an error somewhere?
I hope someone is able to help me out because I am clueless at the moment.
Thank you in advance.