'TypeError: Cannot read properties of undefined (reading 'send')

I am writing a discord bot with node.js. I want the bot to send a message automatically when a member joins or leaves the channel. But I keep getting an error about the send function. Can you help me? [1]: https://i.stack.imgur.com/4URud.png

module.exports = (client) => {
    client.on('guildMemberRemove', (member) => {
        console.log(member);
        
    member.guild.channels.cache.get("1234567890912345678").send("byeee");
  });
}


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source