async function CreateChannel(msg,channelName){
return await Promise.resolve(msg.guild.channels.create(channelName,{parent: 'PARENT_ID'})
.then((msg.channel.send(`${channelName} named channel created !!`)))
.catch(console.error));
}
function SendMessageToChannel(msg,message,channelName){
const channel = msg.guild.channels.cache.find(ch => ch.name === channelName);
if(!channel) return;
channel.send(message);
}
I used the above two functions for a specific command to create a channel
eg: !channel surf
creates a new channel name with surf.
What I want is when channel is created I want to automatically create a greeting message like
Welcome to Channel!
But What I'm facing not sending through code in SendMessageToChannel because the cache of the message guild is not updating.
Help me with this!!
Thank You in advance