So I'm new to writing code and I've hit a wall. I've looked everywhere but can't figure out how to get these commands to work together. I use Visual Studio Code or discord.js
whatever its called. And I'm completely new to coding.
This code is the only one I could figure out to send me a dm
bot.on("guildMemberRemove", member => {
bot.users.get("485655477812723712").send(member + 'has left the
server')
})
bot.on("guildMemberRemove", member => {
bot.users.get("485655477812723712").send(member + 'has left the
server')
}) //.. this will send me a dm informing me that someone left
});
bot.on('message', message=>{
let args = message.content.substring(PREFIX.length).split(" ");
let member = message.mentions.members.first();
switch(args[0]){
//.. these go onto my case '' commands
SO i am able to start my bot. As a test run I have another account join without problem and then I kick that account out. But it shuts the bot down saying
"TypeError: Cannot read property 'first' of null"
The same will happen if the account leaves. However, I still get notified that that person left. And I'm lost about what I should do. Help please