I am new to JavaScript and I am trying to figure out how to make a Discord Bot send a message every time it joins a new server. Can someone explain to me how to do this and the logic behind the code?
You should read the docs for this: https://discord.js.org/#/docs/discord.js/stable/class/Client?scrollTo=e-guildCreate
bot.on('guildCreate', (guild) => {
guild.systemChannel.send("I have joined the server!");
});