as the caption says I don't know how I get the guild.id from a server when the bot just joined. I need the guild.id inside the guildCreate event.
EDIT: My problem was a misspell in my code that didn't got tagged as an error. Because I need the guild.id for a database entry I'm using MySQL and I was missing a "`". Thanks for all the help.
Just take the guild as a parameter to guildCreate:
client.on('guildCreate', (guild) => {
const { id } = guild;
// do something with id
});